SpectrAPI

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.

<200ms
Average response time
Unlimited
Data possibilities
REST
JSON-based API

Quickstart

Get your first response in under 30 seconds.

1

Get your API key

Sign up on the dashboard to receive your API key. Free tier includes 1,000 requests/month.

2

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
  }'
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.

Required Headers
Authorization: Bearer sk_live_your_api_key
Content-Type: application/json

Key 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:

Base URL
https://api.spectrapi.com/api/v1

All 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.

POSTJSON Body Required

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.

200 OK
{
  "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

ParameterTypeDescription
request_idstringUnique identifier for the request, useful for debugging
latency_msintegerServer-side processing time in milliseconds
countintegerNumber of items returned in this response
category_idstringThe 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.

ParameterTypeDescription
countintegerNumber 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

POST/api/v1/generate

The 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

ParameterTypeDescription
instructionstringPlain-language description of the data you want to generate
category_idstringReferences saved output rules for field names, types, and formatting
countintegerNumber of items to generate (1-100)Default: 10
localestringLocale 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

200 OK
{
  "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.

GOOD
"Generate residential property listings in Austin, TX with 3-4 bedrooms, priced between $400k-$600k"
VAGUE
"Generate some houses"

Include Context

Describe the domain, use case, or scenario to help the API understand what kind of data relationships make sense.

GOOD
"Generate credit card transactions from the last 30 days, including common grocery stores, restaurants, and gas stations"
VAGUE
"Generate transactions"

Specify Data Types

Mention specific field types or formats you need, especially for dates, numbers, or structured data.

GOOD
"Generate job postings with title, company name, salary range (as min/max integers), array of required skills, and ISO 8601 posted date"
VAGUE
"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.

Example: Natural Language Instruction
{
  "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

PatternExample
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 Response Format
{
  "error": {
    "code": "invalid_api_key",
    "message": "The API key provided is invalid or has been revoked.",
    "status": 401
  }
}
StatusCodeDescription
400bad_requestThe request body or parameters are malformed
401invalid_api_keyMissing or invalid API key
403insufficient_permissionsYour plan does not include this feature
404not_foundThe requested resource does not exist
422invalid_instructionThe instruction could not be processed or is too vague
429rate_limit_exceededToo many requests, retry after the specified delay
500internal_errorAn 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: 30

Rate Limits

Rate limits vary by plan and are enforced per API key.

PlanMonthly RequestsRate Limit
Free1,00010 req/min
Pro50,000100 req/min
EnterpriseUnlimitedCustom

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.

JS

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.

PY

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.