Introduction
orq.ai exposes API to manipulate Datasets. These APIs are used to manage and enrich Datasets programmatically. In this page we’ll see the common use cases for creating, enriching and fetching datasets through the API.Prerequisite
To get started, an API key is needed to use within SDKs or HTTP API.To get an API key ready, see Authentication.
SDKs
Creating a Dataset
To create a Dataset, we’ll use the Create Dataset API. The following information are required to create a Dataset:- a unique name.
- the path within the orq.ai workspace (see Projects).
The API call will return a dataset_id that is used in the next calls.
Adding Datapoints to a Dataset
Datapoints are entries in a Dataset. You can add between 1 and 5,000 datapoints in a single API request. To create datapoints, we’ll use the Create Datapoints API The expected payload contains:- The previously acquired dataset ID
-
An array of datapoints, where each contains:
- Inputs – Variables that can be used in the prompt message, e.g.,
{{firstname}} - Messages – The prompt template, structured with system, user, and assistant roles
- Expected Output – Reference responses that evaluators use to compare against newly generated outputs
- Inputs – Variables that can be used in the prompt message, e.g.,
Batch Limits
- Minimum: 1 datapoint per request
- Maximum: 5,000 datapoints per request
- Requests with more than 500 datapoints are automatically processed in optimized chunks
Large Batch Example
For datasets with many entries, you can programmatically generate and submit datapoints:Creating an Image Dataset
This guide walks you through creating a dataset and populating it with images using the Orq API. You’ll need images in a supported format (JPEG, PNG, GIF, WEBP).1
Create a Dataset
Start by creating a new Dataset to organize your images, we’ll be using the Create Dataset Endpoint.Response:
2
Convert Images to Base64
Images must be encoded as base64 data URLs before adding to the dataset:
3
Add your images to the Dataset
We’ll be using the add Datapoint to a Dataset endpoint.
See the Full Example
View the Full Code
View the Full Code
Here’s a complete working example with error handling:
Image Format Details
Supported Formats
| Format | MIME Type | Extension |
|---|---|---|
| JPEG | image/jpeg | .jpg, .jpeg |
| PNG | image/png | .png |
| GIF | image/gif | .gif |
| WebP | image/webp | .webp |
Detail Parameter
Thedetail parameter controls how the image is processed:
auto(recommended): Automatically optimizes based on image sizelow: Faster processing, lower token usagehigh: More detailed analysis, higher token usage
Error Handling
Common issues and solutions:| Error | Cause | Solution |
|---|---|---|
| Invalid API key | Authentication failed | Check your API key in console.orq.ai/settings/api-keys |
| File not found | Image path is incorrect | Verify the image path and file permissions |
| Unsupported format | Image format not supported | Convert to JPEG, PNG, GIF, or WebP |
| Payload too large | Image file is too large | Compress or resize images before upload |
Listing Datasets
List Datasets using the List Datasets API.Fetching a Dataset
Fetch a Dataset using the Retrieve a Dataset API.Replace here DATASET_ID with a previously acquired dataset ID
Once a Dataset is created and populated with Datapoints, it can used in Experiment, to learn more see Creating an Experiment.