autopicDocs

API reference

Account

Manage your API keys and read your usage. These endpoints take a dashboard session, not an API key.

Delete my account

DELETE/v1/accountSession

Revokes all of the user's keys, then deletes the user from Supabase Auth. If Supabase fails (502 `account_delete_failed`) the keys stay revoked and the same request again completes the deletion. Keys and usage are kept, revoked, as billing history.

Requires a dashboard session (Supabase token), not an API key.

Errors

  • 401No session, or an invalid or expired one (`invalid_session`)
  • 429Too many requests (`rate_limited`); see `Retry-After`
  • 502Keys revoked, but the user could not be deleted from Supabase (`account_delete_failed`)
  • 503Accounts are not enabled (`accounts_disabled`), account deletion is not (`account_delete_disabled`), or the session could not be checked (`unavailable`)
Request
curl -X DELETE https://api.autopic.io/v1/account \
  -H "Authorization: Bearer $SESSION_TOKEN"

List API keys

GET/v1/account/keysSession

The signed-in user's keys, newest first, revoked ones included.

Requires a dashboard session (Supabase token), not an API key.

Response 200

  • keysobject[]required
    Show 9 attributes
    • idstring (uuid)required
    • namestringrequired
    • prefixstringrequired

      The start of the key, to recognize it.

    • planstringrequired
    • ratePerMinuteintegerrequired
    • monthlyQuotainteger, nullrequired

      Billable units per calendar month; null for no cap.

    • createdAtstring (date-time)required
    • revokedAtstring (date-time), nullrequired
    • lastUsedAtstring (date), nullrequired

      The last UTC day the key made a request.

Errors

  • 401No session, or an invalid or expired one (`invalid_session`)
  • 429Too many requests (`rate_limited`); see `Retry-After`
  • 503Accounts are not enabled on this server (`accounts_disabled`), or the session could not be checked (`unavailable`)
Request
curl https://api.autopic.io/v1/account/keys \
  -H "Authorization: Bearer $SESSION_TOKEN"
Response 200
{
  "keys": [
    {
      "id": "3f1c2a8e-6b7d-4e1a-9c0b-2d5e8f7a1b34",
      "name": "Garage production",
      "prefix": "apk_3f9c01ab",
      "plan": "free",
      "ratePerMinute": 60,
      "monthlyQuota": 1000,
      "createdAt": "2026-11-27T10:00:00Z",
      "revokedAt": null,
      "lastUsedAt": "2026-11-27"
    }
  ]
}

Create an API key

POST/v1/account/keysSession

Creates a free key (60 requests per minute, 1000 VINs per month). The response is the only time the secret is returned; only its hash is kept. At most five keys may be active at once.

Requires a dashboard session (Supabase token), not an API key.

Request body

  • namestringrequired

    Trimmed; 1 to 60 characters.

Example body

{
  "name": "My garage app"
}

Response 201

  • keyobjectrequired
    Show 9 attributes
    • idstring (uuid)required
    • namestringrequired
    • prefixstringrequired

      The start of the key, to recognize it.

    • planstringrequired
    • ratePerMinuteintegerrequired
    • monthlyQuotainteger, nullrequired

      Billable units per calendar month; null for no cap.

    • createdAtstring (date-time)required
    • revokedAtstring (date-time), nullrequired
    • lastUsedAtstring (date), nullrequired

      The last UTC day the key made a request.

  • secretstringrequired

Errors

  • 400Invalid request
  • 401No session, or an invalid or expired one (`invalid_session`)
  • 409Five keys are already active (`key_limit`)
  • 429Too many requests (`rate_limited`); see `Retry-After`
  • 503Accounts are not enabled on this server (`accounts_disabled`), or the session could not be checked (`unavailable`)
Request
curl -X POST https://api.autopic.io/v1/account/keys \
  -H "Authorization: Bearer $SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"My garage app"}'
Response 201
{
  "key": {
    "id": "3f1c2a8e-6b7d-4e1a-9c0b-2d5e8f7a1b34",
    "name": "Garage production",
    "prefix": "apk_3f9c01ab",
    "plan": "free",
    "ratePerMinute": 60,
    "monthlyQuota": 1000,
    "createdAt": "2026-11-27T10:00:00Z",
    "revokedAt": null,
    "lastUsedAt": "2026-11-27"
  },
  "secret": "apk_3f9c…"
}

Revoke an API key

DELETE/v1/account/keys/{keyId}Session

Revoking an already revoked key of one's own succeeds again. Another user's key answers 404, as an unknown one does.

Requires a dashboard session (Supabase token), not an API key.

Parameters

  • keyIdstring (uuid) · pathrequired

Errors

  • 401No session, or an invalid or expired one (`invalid_session`)
  • 404Resource not found
  • 429Too many requests (`rate_limited`); see `Retry-After`
  • 503Accounts are not enabled on this server (`accounts_disabled`), or the session could not be checked (`unavailable`)
Request
curl -X DELETE https://api.autopic.io/v1/account/keys/{keyId} \
  -H "Authorization: Bearer $SESSION_TOKEN"

Retrieve usage

GET/v1/account/usageSession

Requests and billable units (one per VIN decoded) across the user's keys, per UTC day, route and key. Counts can lag by up to 30 seconds when the API runs on several instances.

Requires a dashboard session (Supabase token), not an API key.

Parameters

  • fromstring (date) · query

    First day, UTC. Defaults to the first day of the current month.

  • tostring (date) · query

    Last day, UTC, included. Defaults to today. At most 366 days after `from`, counting both.

Response 200

  • fromstring (date)required
  • tostring (date)required
  • monthobjectrequired

    The current UTC month, whatever the range.

    Show 2 attributes
    • unitsintegerrequired

      Billable units across all the user's keys.

    • quotainteger, nullrequired

      The sum of the active keys' monthly quotas; null when one has no cap. Each key's quota is enforced on its own.

  • daysobject[]required

    Every day of the range, in order, zeros included.

    Show 3 attributes
    • daystring (date)required
    • requestsintegerrequired
    • unitsintegerrequired
  • routesobject[]required

    Routes used in the range, most units first.

    Show 3 attributes
    • routestringrequired
    • requestsintegerrequired
    • unitsintegerrequired
  • keysobject[]required

    Every active key, and revoked keys used in the range, most units first.

    Show 4 attributes
    • keyIdstring (uuid)required
    • namestringrequired
    • requestsintegerrequired
    • unitsintegerrequired

Errors

  • 400Invalid request
  • 401No session, or an invalid or expired one (`invalid_session`)
  • 429Too many requests (`rate_limited`); see `Retry-After`
  • 503Accounts are not enabled on this server (`accounts_disabled`), or the session could not be checked (`unavailable`)
Request
curl https://api.autopic.io/v1/account/usage \
  -H "Authorization: Bearer $SESSION_TOKEN"
Response 200
{
  "from": "2026-11-27",
  "to": "2026-11-27",
  "month": {
    "units": 0,
    "quota": 0
  },
  "days": [
    {
      "day": "2026-11-27",
      "requests": 0,
      "units": 0
    }
  ],
  "routes": [
    {
      "route": "POST /v1/vin/decode",
      "requests": 0,
      "units": 0
    }
  ],
  "keys": [
    {
      "keyId": "3f1c2a8e-6b7d-4e1a-9c0b-2d5e8f7a1b34",
      "name": "Garage production",
      "requests": 0,
      "units": 0
    }
  ]
}