Skip to content

Latest commit

 

History

History
88 lines (67 loc) · 1.62 KB

File metadata and controls

88 lines (67 loc) · 1.62 KB

Export API Response Format

The base URL for the export API is https://export-api.sctools.org.

This service exposes one route:

GET /api/:site/:type/:id

Currently supported values:

  • site: vidiq
  • type: channel or video

Success response

All successful responses return HTTP 200 with this wrapper:

{
  "ok": true,
  "site": "vidiq",
  "type": "channel",
  "id": "UC_x5XG1OV2P6uZZ5FSM9Ttw",
  "data": []
}

type=channel

data is an array of channel stat snapshots, sorted by ascending date:

[
  {
    "date": "2024-01-01",
    "subscribers": 1000,
    "views": 50000,
    "videos": 42
  }
]

type=video

data is an array of hourly video stat snapshots:

[
  {
    "date": "2024-01-01T12:00:00.000Z",
    "views": 1200,
    "likes": 80,
    "comments": 12
  }
]

Error response

Errors return:

{
  "ok": false,
  "error": {
    "code": "invalid_request",
    "message": "The request path must include site, type, and id.",
    "details": {}
  }
}

details is optional. Common error codes include:

  • invalid_request with HTTP 400
  • unsupported_resource with HTTP 404
  • upstream_not_found with HTTP 404
  • upstream_rate_limited with HTTP 429
  • upstream_unreachable with HTTP 502
  • upstream_server_error with HTTP 502
  • upstream_request_failed with HTTP 502
  • invalid_upstream_response with HTTP 502

Headers

  • Success responses are cacheable for 3 hours: Cache-Control: public, max-age=10800, s-maxage=10800
  • Error responses are not cached: Cache-Control: no-store
  • All responses include Access-Control-Allow-Origin: *