Every error uses the same JSON envelope and carries the HTTP status that describes it.
The envelope
{
"error": {
"type": "validation_error",
"code": "validation",
"message": "The scheduled_at field must be a time in the future.",
"param": "scheduled_at",
"request_id": "req_a1b2c3d4e5f6a1b2c3d4e5f6",
"doc_url": "https://iqcore.ai/developers/docs/errors#validation"
}
}| Field | Meaning |
|---|---|
type |
The family: invalid_request, authentication_error, billing_error, permission_error, not_found, conflict, validation_error, rate_limit_error, api_error or platform_error. |
code |
A stable, machine-readable code. Branch on this field. |
message |
A sentence in English for a person. It may change at any time. Do not parse it. |
param |
The request field the error is about, or null. |
request_id |
The id of this request (req_ and 24 characters). |
doc_url |
A link to the entry for this code below. |
Every response, success or error, has an X-Request-Id header with the same id. Quote it when you contact Support. IQCore never takes the id from the client.
Messages are in English only and never contain a secret or an internal detail. A 500 says only internal; the request id is enough for Support to find it.
202 is not an error
Some calls answer 202 Accepted with the resource and a requires_action object: nothing ran yet, and a person must act in IQCore first (approve a post, or choose TikTok settings). Treat it as a normal answer. See Post states and approval.
Extra fields
Some errors add fields inside error:
| Field | Seen on | Meaning |
|---|---|---|
details[] |
validation |
A list of {param, message}, one per invalid field. |
required_scope |
missing_scope |
The scope the operation needs. |
required_role |
team_role |
The lowest role that may do this. |
existing_id |
external_ref_exists |
The id of the post that already has this external_ref. |
oldest_cursor |
cursor_expired |
The oldest events cursor still served. Start again from it. |
billing_url |
insufficient_credits |
A dashboard page where credits can be bought. |
credits |
insufficient_credits, quote_exceeded, spend_cap_reached |
The price of the request in credits. |
max_credits |
quote_exceeded |
The limit you sent. |
balance |
insufficient_credits, quote_exceeded |
The credits that could pay. |
limit |
spend_cap_reached |
Which daily cap was reached: key or organization. |
cap |
spend_cap_reached |
The daily limit in credits. |
used |
spend_cap_reached |
Credits used today. |
resets_at |
spend_cap_reached |
When the limit resets. |
Clients must ignore fields they do not know. New fields can appear at any time (see Versioning).
Which errors to retry
| Status | Retry? |
|---|---|
400, 401, 403, 404, 410, 413, 422 |
No. Fix the request, key or permission first. 410 cursor_expired has its own recovery: restart from oldest_cursor (see Events). |
402 |
No. Buy credits, raise max_credits or wait for the daily cap to reset. Nothing was charged. |
409 request_in_progress |
Yes, after Retry-After seconds (it is 1), with the same Idempotency-Key. |
409 (other) |
No. The state changed: read the resource and decide. |
429 |
Yes, after the Retry-After seconds. See Rate limits. |
500, 502 |
Yes, with backoff (1 s, 2 s, 4 s ... up to a minute) and the same Idempotency-Key for writes. If the answer was 500 outcome_unknown on a spend, check the job before you try again. |
Send an Idempotency-Key on every write. Then a retry after a timeout or a 5xx can never act twice. Refusals that changed nothing (4xx, 202) free the key, so you can fix the cause and retry with the same key.
Error codes
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
organization_required | 400 | The key works in several organizations and the request named none. | Send organization_id (query on GET, body on writes). |
key_in_url | 400 | An API key was found in the URL. URLs end up in logs. | Rotate the key now and send it only in the Authorization header. |
malformed_json | 400 | The body is not valid JSON. | Fix the JSON; send Content-Type: application/json. |
invalid_body | 400 | The JSON body is not an object. | Send a JSON object. |
idempotency_key_invalid | 400 | The Idempotency-Key header has the wrong format. | Use 1–100 characters of A–Z a–z 0–9 . _ : - |
method_not_allowed | 405 | This method is not allowed on this path. | Check the method in the reference. |
unsupported_media_type | 415 | The body type does not fit the operation (multipart to a JSON operation, or the other way round). | Send JSON, or multipart/form-data where the reference says so. |
missing_api_key | 401 | No Authorization header. | Send Authorization: Bearer iqk_…. |
invalid_api_key | 401 | The key is unknown or malformed. | Check the key; make a new one on the API keys page. |
api_key_revoked | 401 | The key was revoked (by a person, an admin, or because the password, e-mail or two-step sign-in changed). | Make a new key. |
api_key_expired | 401 | The key expired, or its rotation grace ended. | Use the new key from the rotation, or make a new one. |
insufficient_credits | 402 | Not enough purchased credits for this work. | Buy credits (billing_url) and retry. |
quote_exceeded | 402 | The price is higher than your max_credits. | Check GET /quote and send a higher max_credits if you agree. |
spend_cap_reached | 402 | The daily API credit cap of the key or the organization is reached. | Wait for resets_at, or ask the owner to raise the cap. |
missing_scope | 403 | The key does not have the scope this operation needs (required_scope). | Give the key the scope on the API keys page. |
team_role | 403 | The login behind the key has a role too low for this (required_role), or may no longer hold a key. | Use a key of an owner or admin, or change the role. |
plan_required | 403 | The organization has no plan that includes this (or live keys). | Choose a plan; test keys work on every plan. |
plan_limit | 403 | The organization has more keys than its plan allows (newest keys paused). | Revoke keys or upgrade. |
api_disabled | 403 | The API is not open for this organization (private beta). | Ask support to join the beta. |
organization_suspended | 403 | The organization is suspended. | Contact support. |
login_suspended | 403 | The login behind the key is suspended. | Contact support. |
verify_email | 403 | The login behind the key has not verified its e-mail address. | Verify the e-mail address in IQCore. |
sandbox_forbidden | 403 | A test key tried something only a live key may do: change a live post, spend credits, or change anything other than its own sandbox posts and new media files. | Use a live key for this, or work on sandbox posts. |
storage_full | 403 | The Media library storage of the organization is full. | Delete files or upgrade. |
disabled | 403 | This feature is switched off for now. | Try again later or ask support. |
approval_required | 403 | This action must be done by a person in IQCore. | Open IQCore and do it there. |
forbidden | 403 | Not allowed. | Check the key, its scopes and the organization. |
not_found | 404 | No such resource in this organization (also for another organization's ids). | Check the id and organization_id. |
external_ref_exists | 409 | A post with this external_ref already exists (existing_id). | Use the existing post, or another external_ref. |
not_editable | 409 | The post (or one of its targets) is publishing or published and cannot change. | Read the post; create a new one if needed. |
request_in_progress | 409 | A request with the same Idempotency-Key is still running. | Wait Retry-After seconds and send it again. |
in_progress | 409 | The same action is already running. | Wait Retry-After seconds and read the result. |
stale | 409 | The price or the state changed between the quote and the run. | Read the resource or quote again, then retry. |
version_conflict | 409 | Someone changed the resource at the same time. | Read it again and retry. |
cursor_expired | 410 | The events cursor is older than the oldest kept event (30 days). | Restart from oldest_cursor and reconcile with GET /posts?updated_since=. |
file_too_large | 413 | The file or the request body is too large. | Send a smaller file, or import large videos from a URL. |
validation | 422 | A parameter is missing or wrong (param, details[]). | Fix the parameters named in details[]. |
idempotency_key_reused | 422 | The Idempotency-Key was used for another request in the last 24 hours. | Use a new key for a new request. |
max_credits_required | 422 | An operation that spends credits needs max_credits. | Send max_credits (GET /quote tells the price). |
model_unavailable | 422 | The chosen AI model is not available now. | Choose another model from the models list. |
unsupported_format | 422 | The format is not supported here (for example story). | Use post, reel or carousel. |
media_not_ready | 422 | The media item is not ready (still importing, or failed). | Wait for media.ready or poll GET /media/{id}. |
time_passed | 422 | The time is in the past or too close. | Send a time at least one minute ahead. |
file_upload_failed | 422 | The upload did not arrive complete. | Upload again. |
unsupported_file_type | 422 | The file type (read from its bytes) is not accepted. | Send JPG, PNG, WebP, GIF, MP4, MOV, WebM or a supported audio file. |
file_rejected | 422 | The file was refused by the checks (virus scan, size, type, pixel limit). | Send another file. |
import_failed | 422 | The file could not be stored because of an error on our side. Nothing was saved, and the answer never contains internal details. | Try again later. If it keeps happening, send the request_id to IQCore support. |
empty | 422 | The file or the URL's answer is empty. | Check the file or URL. |
url_invalid | 422 | The URL is not a valid web address. | Send a full https:// URL. |
url_scheme | 422 | Only http:// and https:// URLs can be imported. | Use https. |
url_credentials | 422 | URLs with a user name or password are refused. | Use a signed or public link. |
url_port | 422 | Only the standard ports are accepted (443 for https, 80 for http). | Serve the file on the standard port. |
url_host | 422 | The URL must name a public host (no IP addresses, no local names). | Use a public host name. |
url_unresolvable | 422 | The host of the URL could not be found. | Check the URL. |
url_not_public | 422 | The host of the URL is not a public internet address. | Use a public host. |
rate_limited | 429 | Too many requests for one of the rate-limit buckets. | Wait Retry-After seconds; spread the calls. |
internal | 500 | Something went wrong on our side. No detail is given. | Retry later; give support the request_id. |
outcome_unknown | 500 | A spend started but its result is not known. | Do not repeat blindly: read the job or the list first, then give support the request_id. |
provider_error | 502 | The platform (Meta, TikTok) refused. | Read the message; retry later or fix the content. |