Authentication and limits
API keys, the scope each tool needs, rate limits, monthly limits and safe retries.
Your API key
Send the key with every request:
Authorization: Bearer <your key>
A key belongs to one PicVid account. Every job it starts is that account's job, paid from its credits and its plan, exactly as if it were made in the app - and it shows in that account's My Creations.
Keys spend the credits of your Personal workspace, whichever workspace you have selected in the app. A key you created works while your plan includes the API: if the plan ends, the key is paused (403 API_NOT_IN_PLAN) and works again once you upgrade.
If a key leaks, revoke it at once on the API keys page - it stops working right away. A key issued to you by the PicVid team can be revoked there too, or by emailing [email protected].
Scopes: which tools a key may use
Each tool needs its own scope on the key. Reading jobs, uploads, the tool list and usage needs no scope.
| Endpoint | Scope |
|---|---|
POST /images/generate | image:generate |
POST /images/edit | image:edit |
POST /images/face-swap | image:face_swap |
POST /images/face-edit | image:face_edit |
POST /images/clothes | image:clothes |
POST /images/headshot | image:headshot |
POST /images/upscale | image:upscale |
POST /images/retouch | image:retouch |
POST /images/restore | image:restore |
POST /images/remove-background | image:remove_background |
POST /images/expand | image:expand |
POST /images/to-text | image:to_text |
POST /videos/generate | video:generate |
POST /videos/from-image | video:from_image |
POST /videos/face-swap | video:face_swap |
POST /videos/talking-photo | video:talking_photo |
GET /tools shows, for each tool, whether your key may use it (allowed). A tool also has to be in the account's plan - see Credits and plans.
Limits
- Rate: 60 requests per minute per key unless agreed otherwise. Over it you get
429 RATE_LIMITEDwith aRetry-Afterheader. - Monthly credits: a key can have a monthly credit limit (UTC). Once reached, new jobs get
429 MONTHLY_CREDIT_LIMIT_REACHED; seeGET /usage. - Tasks at a time and highest resolution follow the account's plan, as in the app.
Safe retries: Idempotency-Key
A network error can leave you not knowing whether a job was started. Send an Idempotency-Key header (any unique string up to 255 characters, e.g. a UUID) when you start a job:
Idempotency-Key: 6f1d1c2e-4b1a-4f0e-9a43-2f1d5f6f3a10
- Sending the same request again with the same key returns the same job (status
200and the headerIdempotency-Replayed: true) - it is never started or charged twice. - Using the same key with a different request is refused with
409 IDEMPOTENCY_KEY_REUSED.