autopicDocumentation

Référence de l'API

Compte

Gérer ses clés API et lire sa consommation. Ces routes demandent une session du site, pas une clé API.

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.

Demande la session du site (jeton Supabase), pas une clé API.

Erreurs

  • 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`)
Requête
curl -X DELETE https://api.autopic.io/v1/account \
  -H "Authorization: Bearer $SESSION_TOKEN"

Lister ses clés API

GET/v1/account/keysSession

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

Demande la session du site (jeton Supabase), pas une clé API.

Réponse 200

  • keysobject[]obligatoire
    Afficher les 9 attributs
    • idstring (uuid)obligatoire
    • namestringobligatoire
    • prefixstringobligatoire

      The start of the key, to recognize it.

    • planstringobligatoire
    • ratePerMinuteintegerobligatoire
    • monthlyQuotainteger, nullobligatoire

      Billable units per calendar month; null for no cap.

    • createdAtstring (date-time)obligatoire
    • revokedAtstring (date-time), nullobligatoire
    • lastUsedAtstring (date), nullobligatoire

      The last UTC day the key made a request.

Erreurs

  • 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`)
Requête
curl https://api.autopic.io/v1/account/keys \
  -H "Authorization: Bearer $SESSION_TOKEN"
Réponse 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"
    }
  ]
}

Créer une clé API

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.

Demande la session du site (jeton Supabase), pas une clé API.

Corps de la requête

  • namestringobligatoire

    Trimmed; 1 to 60 characters.

Exemple de corps

{
  "name": "My garage app"
}

Réponse 201

  • keyobjectobligatoire
    Afficher les 9 attributs
    • idstring (uuid)obligatoire
    • namestringobligatoire
    • prefixstringobligatoire

      The start of the key, to recognize it.

    • planstringobligatoire
    • ratePerMinuteintegerobligatoire
    • monthlyQuotainteger, nullobligatoire

      Billable units per calendar month; null for no cap.

    • createdAtstring (date-time)obligatoire
    • revokedAtstring (date-time), nullobligatoire
    • lastUsedAtstring (date), nullobligatoire

      The last UTC day the key made a request.

  • secretstringobligatoire

Erreurs

  • 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`)
Requête
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"}'
Réponse 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…"
}

Révoquer une clé API

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.

Demande la session du site (jeton Supabase), pas une clé API.

Paramètres

  • keyIdstring (uuid) · cheminobligatoire

Erreurs

  • 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`)
Requête
curl -X DELETE https://api.autopic.io/v1/account/keys/{keyId} \
  -H "Authorization: Bearer $SESSION_TOKEN"

Lire sa consommation

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.

Demande la session du site (jeton Supabase), pas une clé API.

Paramètres

  • fromstring (date) · requête

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

  • tostring (date) · requête

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

Réponse 200

  • fromstring (date)obligatoire
  • tostring (date)obligatoire
  • monthobjectobligatoire

    The current UTC month, whatever the range.

    Afficher les 2 attributs
    • unitsintegerobligatoire

      Billable units across all the user's keys.

    • quotainteger, nullobligatoire

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

  • daysobject[]obligatoire

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

    Afficher les 3 attributs
    • daystring (date)obligatoire
    • requestsintegerobligatoire
    • unitsintegerobligatoire
  • routesobject[]obligatoire

    Routes used in the range, most units first.

    Afficher les 3 attributs
    • routestringobligatoire
    • requestsintegerobligatoire
    • unitsintegerobligatoire
  • keysobject[]obligatoire

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

    Afficher les 4 attributs
    • keyIdstring (uuid)obligatoire
    • namestringobligatoire
    • requestsintegerobligatoire
    • unitsintegerobligatoire

Erreurs

  • 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`)
Requête
curl https://api.autopic.io/v1/account/usage \
  -H "Authorization: Bearer $SESSION_TOKEN"
Réponse 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
    }
  ]
}