SpectrAPI Documentation
SpectrAPI is a dataless API that generates realistic, structured data on demand. No database setup, no seed files, no infrastructure — just describe what you need in plain language and get production-quality data instantly.
Beta Notice: SpectrAPI is currently in beta. The API endpoint is stable but may receive non-breaking additions. Join the waitlist to get early access and an API key.
Quickstart
Get your first response in under 30 seconds.
Get your API key
Sign up on the dashboard to receive your API key. Free tier includes 1,000 requests/month.
Make your first request
curl -X POST "https://api.spectrapi.com/api/v1/generate" \
-H "Authorization: Bearer sk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"instruction": "Generate vehicle listings for Toyota cars",
"count": 3
}'Use the data
The response includes structured JSON data with metadata. Parse it like any standard REST API response.
Authentication
All API requests require a Bearer token in the Authorization header. API keys are scoped to your account and can be managed from the dashboard.
Authorization: Bearer sk_live_your_api_key
Content-Type: application/jsonKey Types
sk_live_*— Production keys. Use in server-side code only.sk_test_*— Test keys. Safe for development, same behavior with test rate limits.
Security: Never expose your API key in client-side code. Always proxy requests through your backend server.
Base URL
All API requests should be made to the following base URL:
https://api.spectrapi.com/api/v1All endpoints are served over HTTPS. HTTP requests will be redirected automatically.
Request Format
SpectrAPI uses a single POST endpoint that accepts JSON request bodies. Describe what you need in plain language using the instruction field.
All requests use Content-Type: application/json with an instruction field describing the data you need. Optionally include a category_id to apply saved output rules.
Response Format
All responses follow a consistent envelope format with data and meta fields.
{
"data": [
{
"id": "veh_a1b2c3d4",
"make": "Toyota",
"model": "Camry",
"year": 2024,
"trim": "SE",
"price": 28945,
"mileage": 12340,
"color": "Celestial Silver"
}
],
"meta": {
"request_id": "req_x7k9m2p4",
"latency_ms": 47,
"count": 1
}
}Meta Fields
| Parameter | Type | Description |
|---|---|---|
request_id | string | Unique identifier for the request, useful for debugging |
latency_ms | integer | Server-side processing time in milliseconds |
count | integer | Number of items returned in this response |
category_id | string | The category ID used for this request, if provided |
Pagination
Control the number of items returned using the count parameter in your request body. You can request between 1 and 100 items per request.
| Parameter | Type | Description |
|---|---|---|
count | integer | Number of items to generate (1-100)Default: 10 |
curl -X POST "https://api.spectrapi.com/api/v1/generate" \
-H "Authorization: Bearer sk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"instruction": "Generate vehicle listings",
"count": 20
}'Generate Endpoint
/api/v1/generateThe single endpoint for all data generation. Describe what you need in plain language, and SpectrAPI will generate structured, realistic data matching your description. Use category_id to apply consistent field names and formatting across requests.
Parameters
| Parameter | Type | Description |
|---|---|---|
instruction | string | Plain-language description of the data you want to generate |
category_id | string | References saved output rules for field names, types, and formatting |
count | integer | Number of items to generate (1-100)Default: 10 |
locale | string | Locale for generated data (e.g., en-US, en-GB, fr-FR)Default: en-US |
Request Example
curl -X POST "https://api.spectrapi.com/api/v1/generate" \
-H "Authorization: Bearer sk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"instruction": "Generate luxury vehicle listings with BMW and Mercedes models from 2022 or newer",
"count": 5,
"locale": "en-US"
}'Response
{
"data": [
{
"id": "veh_k8m3n7p2",
"make": "BMW",
"model": "X5",
"year": 2024,
"trim": "xDrive40i",
"price": 65200,
"mileage": 8420,
"fuel_type": "gasoline",
"transmission": "automatic",
"color": "Alpine White",
"vin": "5UXCR6C09R9S12345",
"features": ["panoramic sunroof", "heated seats", "adaptive cruise"],
"dealer": {
"name": "BMW of Springfield",
"city": "Springfield",
"state": "IL"
}
},
{
"id": "veh_p2q4r6s8",
"make": "Mercedes-Benz",
"model": "E-Class",
"year": 2023,
"trim": "E 350",
"price": 58900,
"mileage": 15200,
"fuel_type": "gasoline",
"transmission": "automatic",
"color": "Obsidian Black",
"vin": "WDDZF4KB5PA123456",
"features": ["leather seats", "navigation", "premium sound"],
"dealer": {
"name": "Mercedes-Benz of Denver",
"city": "Denver",
"state": "CO"
}
}
],
"meta": {
"request_id": "req_b4d6f8h0",
"count": 2,
"latency_ms": 82
}
}Category Rules
Category rules allow you to save and reuse output schemas across requests. When you provide a category_id, SpectrAPI will generate data matching your saved field names, types, and formatting rules.
Coming Soon: Category management will be available in the dashboard, allowing you to create, edit, and share category rules for consistent data generation across your team.
Using Category Rules
Include the category_id parameter in your request to apply saved rules. The instruction still controls the content, but the structure follows your category definition.
curl -X POST "https://api.spectrapi.com/api/v1/generate" \
-H "Authorization: Bearer sk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"instruction": "Generate electric vehicles",
"category_id": "cat_vehicles_automotive",
"count": 3
}'Benefits of Category Rules
Consistency
Ensure all team members receive data in the same format with identical field names and types.
Type Safety
Define strict type constraints and validation rules that are enforced across all requests.
Reusability
Save commonly used schemas once and reference them with different instructions.
Versioning
Update your schema centrally without changing code across multiple services.
Instruction Tips
Writing effective instructions helps SpectrAPI generate exactly the data you need. Here are best practices for crafting clear, precise instructions.
Be Specific
The more details you provide, the more accurate your data will be. Include specific values, ranges, or constraints.
"Generate residential property listings in Austin, TX with 3-4 bedrooms, priced between $400k-$600k""Generate some houses"Include Context
Describe the domain, use case, or scenario to help the API understand what kind of data relationships make sense.
"Generate credit card transactions from the last 30 days, including common grocery stores, restaurants, and gas stations""Generate transactions"Specify Data Types
Mention specific field types or formats you need, especially for dates, numbers, or structured data.
"Generate job postings with title, company name, salary range (as min/max integers), array of required skills, and ISO 8601 posted date""Generate job postings"Use Natural Language
You don't need to use technical jargon or schema notation. Write instructions as you would explain them to a colleague.
{
"instruction": "Generate a list of software engineers with 5+ years experience, including their name, email, phone number, current company, job title, programming languages they know, and years of experience. Make sure emails match the person's name and use common tech company domains."
}Common Patterns
| Pattern | Example |
|---|---|
| Filtering | "only electric vehicles" |
| Ranges | "between 2020 and 2024" |
| Geographic | "in California or Texas" |
| Temporal | "from the last 90 days" |
| Nested Data | "include dealer info with name, city, and state" |
Error Codes
SpectrAPI uses standard HTTP status codes. Errors include a machine-readable code and a human-readable message.
{
"error": {
"code": "invalid_api_key",
"message": "The API key provided is invalid or has been revoked.",
"status": 401
}
}| Status | Code | Description |
|---|---|---|
| 400 | bad_request | The request body or parameters are malformed |
| 401 | invalid_api_key | Missing or invalid API key |
| 403 | insufficient_permissions | Your plan does not include this feature |
| 404 | not_found | The requested resource does not exist |
| 422 | invalid_instruction | The instruction could not be processed or is too vague |
| 429 | rate_limit_exceeded | Too many requests, retry after the specified delay |
| 500 | internal_error | An unexpected error occurred on our end |
Rate Limit Headers
Rate-limited responses include headers to help you manage your usage:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1709683200
Retry-After: 30Rate Limits
Rate limits vary by plan and are enforced per API key.
| Plan | Monthly Requests | Rate Limit |
|---|---|---|
| Free | 1,000 | 10 req/min |
| Pro | 50,000 | 100 req/min |
| Enterprise | Unlimited | Custom |
Need higher limits? Contact us for enterprise pricing with custom rate limits, dedicated infrastructure, and SLA guarantees.
SDKs & Libraries
Official client libraries to integrate SpectrAPI into your application with type safety and convenience methods.
JavaScript / TypeScript
npm install spectrapi
import { SpectrAPI } from "spectrapi";
const spectr = new SpectrAPI("sk_live_your_api_key");
const data = await spectr.generate({
instruction: "Generate Tesla vehicle listings",
count: 10,
});Coming soon — Join the beta waitlist for early SDK access.
Python
pip install spectrapi
from spectrapi import SpectrAPI
client = SpectrAPI("sk_live_your_api_key")
data = client.generate(
instruction="Generate Tesla vehicle listings",
count=10,
)Coming soon — Join the beta waitlist for early SDK access.
Community Libraries
We welcome community-built SDKs for Go, Ruby, PHP, and other languages. If you build one, reach out and we'll feature it here.