API Reference

Cortex Asset API — REST endpoints for searching, previewing, and downloading game assets. Base URL: https://api.cortexassets.com/v1

Authentication

All API requests require a Bearer token. Include your API key in the Authorization header. You can generate and manage API keys from your dashboard.

bash
curl https://api.cortexassets.com/v1/account \
  -H "Authorization: Bearer YOUR_API_KEY"

Requests without a valid API key return 401 Unauthorized.


GET/v1/assets/search

Search the asset library. Returns up to 50 results by default. Search and preview are free — no credits consumed.

ParameterTypeRequiredDescription
qstringYesSearch query (e.g. "fire icon", "forest ambience")
typestringNoAsset type: image, audio, model, font
assetClassstringNoSub-class: sprite, tileset, sfx, music, etc.
stylestringNoVisual style: pixel-art, realistic, cartoon, etc.
categorystringNoCategory tag, e.g. characters, ui, environment
themestringNoTheme tag, e.g. fantasy, sci-fi, medieval
licensestringNoFilter by license: cc0, mit, cc-by, etc.
limitintegerNoNumber of results (1–50, default 20)
bash
curl "https://api.cortexassets.com/v1/assets/search?q=fire+icon&type=image&limit=5" \
  -H "Authorization: Bearer YOUR_API_KEY"
json
{
  "results": [
    {
      "id": "ast_01HXYZ123",
      "title": "Flame Icon",
      "type": "image",
      "assetClass": "sprite",
      "style": "pixel-art",
      "license": "cc0",
      "previewUrl": "https://cdn.cortexassets.com/preview/ast_01HXYZ123.webp",
      "creditCost": 5
    }
  ],
  "total": 42,
  "limit": 5,
  "offset": 0
}

Asset Metadata

GET/v1/assets/{id}

Retrieve full metadata for a single asset including all tags, dimensions, and license details.

bash
curl https://api.cortexassets.com/v1/assets/ast_01HXYZ123 \
  -H "Authorization: Bearer YOUR_API_KEY"
json
{
  "id": "ast_01HXYZ123",
  "title": "Flame Icon",
  "description": "Animated pixel-art flame sprite, 32x32.",
  "type": "image",
  "assetClass": "sprite",
  "style": "pixel-art",
  "category": "effects",
  "theme": "fantasy",
  "license": "cc0",
  "licenseUrl": "https://creativecommons.org/publicdomain/zero/1.0/",
  "format": "png",
  "width": 32,
  "height": 32,
  "fileSize": 2048,
  "creditCost": 5,
  "previewUrl": "https://cdn.cortexassets.com/preview/ast_01HXYZ123.webp",
  "createdAt": "2025-11-15T08:22:00Z"
}

Preview

GET/v1/assets/{id}/preview

Returns a 302 redirect to a preview file. Always free — no credits consumed.

  • Images: Watermarked WebP thumbnail
  • Audio: Clipped MP3 (first 15 seconds)
  • 3D models: Rendered PNG thumbnail
  • Fonts: PNG specimen card
bash
curl -L https://api.cortexassets.com/v1/assets/ast_01HXYZ123/preview \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o preview.webp

Download

GET/v1/assets/{id}/download

Download the original asset file. Costs 5 credits per download. Returns a 302 redirect to a signed URL (valid for 60 seconds). Returns 402 if your balance is insufficient.

bash
curl -L https://api.cortexassets.com/v1/assets/ast_01HXYZ123/download \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o flame-icon.png
json
// 402 Payment Required — insufficient credits
{
  "error": "insufficient_credits",
  "message": "You need 5 credits to download this asset. Current balance: 3.",
  "requiredCredits": 5,
  "currentBalance": 3
}

Account

GET/v1/account

Returns basic account information including your current credit balance.

bash
curl https://api.cortexassets.com/v1/account \
  -H "Authorization: Bearer YOUR_API_KEY"
json
{
  "email": "you@example.com",
  "creditBalance": 145,
  "createdAt": "2025-10-01T12:00:00Z"
}

Usage History

GET/v1/account/usage

Returns a paginated list of credit transactions (purchases and downloads).

ParameterTypeRequiredDescription
limitintegerNoResults per page (1–100, default 50)
offsetintegerNoPagination offset (default 0)
bash
curl "https://api.cortexassets.com/v1/account/usage?limit=50&offset=0" \
  -H "Authorization: Bearer YOUR_API_KEY"
json
{
  "transactions": [
    {
      "id": "txn_01HABC999",
      "type": "download",
      "assetId": "ast_01HXYZ123",
      "assetTitle": "Flame Icon",
      "credits": -5,
      "balanceAfter": 145,
      "createdAt": "2026-01-10T14:33:00Z"
    },
    {
      "id": "txn_01HABC888",
      "type": "purchase",
      "credits": 500,
      "balanceAfter": 150,
      "createdAt": "2026-01-09T09:00:00Z"
    }
  ],
  "total": 24,
  "limit": 50,
  "offset": 0
}

Errors

All errors return JSON with error and message fields.

StatusError codeDescription
400bad_requestMissing or invalid parameters.
401unauthorizedMissing or invalid API key.
402insufficient_creditsNot enough credits to complete the download.
404not_foundThe requested asset does not exist.
429rate_limitedToo many requests. Retry after the Retry-After header value.