Errors

Every status code the API answers with, what causes it, and what to do about it.

On this page

A call that succeeds answers 200, 201 or 202. A call that does not succeed comes back with success set to false, an HTTP status code of 400 or above, and a message that says what went wrong in plain English. The status code is repeated in the body as code, so your code can branch on either.

{
  "success": false,
  "message": "The \"workspaceId\" argument is required!",
  "data": null,
  "code": 400,
  "version": "0.0.1740"
}

Read the message before you retry. It usually names the argument, scope or limit at fault.

Every status code

Code Meaning What to do
400 The request itself is wrong: the body, an argument, or a header Fix the request. Repeating it unchanged gets the same answer
401 No token, a token that is invalid, revoked or expired, or a token of a banned account Check the Authorization header, or create a new token
402 The workspace has no AI credits left for this work Add credits or change the plan, then try again
403 The token or your role may not do this here, the site or workspace is out of reach, or a plan or site limit stops it Read the message. Add the scope, check the ids, use another workspace or raise the limit
404 No method by that name, or the thing a method looks up does not exist Check the method name and the ids you sent
405 A method's address was called with GET instead of POST Send a POST
409 The same work is already running Wait for it to finish, then read the result
413 The body is larger than 100 MB. Nothing ran. A body far over the limit is cut off on the way, and that answer has no JSON body Send less in one call
422 The request is well formed, but the method or the idempotency key refuses it Read the message. Repeating it unchanged gets the same answer
429 Too many calls for now, or a queue or quota is full Wait, then try again. See below
500 Something went wrong on Modulify's side Repeat a read after a pause. For a write, read the current state first
503 Modulify could not check access to the workspace, or something the method needs is not available right now Try again after a moment

400: the request is wrong

The body and the arguments are checked before a method runs, and the message names what is wrong:

  • The body is not a JSON object, or is not valid JSON.
  • The body is nested more than 64 levels deep.
  • An argument holds a list of more than 10,000 items.
  • An argument the method does not take, such as a misspelt name.
  • A required argument is missing, null or an empty string.
  • An argument has the wrong type, such as a number where text is expected, or a fraction where a whole number is expected.
  • A text argument is longer than the method allows, or a list holds more items than it allows.
  • A value is not one of the ones the method accepts. The message lists the allowed values.
  • A value deeper inside an argument does not match what the method expects. The message gives its path, such as items[0].key.
  • The Idempotency-Key header on a method that changes something is not 1 to 255 visible characters. A read-only method ignores the header, whatever it holds.
  • The address contains an access token. Revoke that token. See Authentication.

A method can also answer 400 for a value it cannot use, such as a name that is already taken or a date in the wrong format. Its page describes those cases.

401: the token

Message What it means
"An access token is required. Send it in the Authorization header as Bearer followed by the token!" No token arrived, or the header was empty
"This access token is invalid, revoked or expired!" The value does not match a live token
"This access token has expired!" The token passed its expiry date
"This access token belongs to a banned account. If you think this is a mistake, contact [email protected]!" The account that owns the token is banned

All of them carry a WWW-Authenticate header. A 401 never succeeds on a retry: fix the header or create a new token.

402: no credits

Work that spends AI credits is refused when the workspace has none left, for example send_message with an empty balance. Nothing ran and nothing was charged. See Credits.

403: not allowed here

A 403 has several causes, and the message says which:

  • A missing scope. The message names the scope the token needs. Edit the token on the Tokens page to add it, and the change reaches every client already using it.
  • Something the token cannot reach. The workspace, site, folder, comment or attachment you pointed at does not exist, or it is in a workspace you are not a member of. Both cases get the same answer on purpose, so the API never tells anyone whether someone else's id exists. Check the ids with list_workspaces, list_sites, list_folders or list_comments.
  • A chat the call cannot reach. A chatId that is neither main nor a valid chatKey, or one that does not exist or belongs to another site than the projectId you sent, is refused before the method runs. list_chats lists the chats of a site.
  • A token narrowed to other workspaces. The token was limited to specific workspaces when it was created or edited, and this one is not among them. list_workspaces shows where the token can work.
  • A token narrowed to other sites. The token was limited to specific sites, and the method was aimed at another site, or works on a whole workspace, folder or bought domain, or creates a site or a workspace. list_sites shows the sites the token can work on.
  • Your role. Your role in that workspace does not hold the API access permission. A workspace owner can grant it. See Members and roles.
  • No workspace given. A method that works inside a workspace was sent no workspaceId, projectId or other id that tells it where to act.
  • A plan or site limit. Some methods refuse when the workspace is over a limit, and say why in data. For example create_site answers with data.reason set to site-limit-reached with the current count and limit, or credits-limit-reached.
  • A locked site. A site over the plan's site limit cannot be changed until the workspace upgrades or frees a slot. A method that would change it answers, for example, This site is locked because it goes over the plan's site limit, so "write_file" changed nothing. Upgrade the plan or add an extra site to unlock it, or archive, move or delete a site to free a slot! Reading it still works, and so do delete_site, archive_sites, move_site_to_workspace, transfer_site, cancel_site_transfer, cancel_job, archive_chat, clear_site_chat, discard_chat_changes and cancel_site_email_bulk.

404: not found

The method name is not one of the methods, or the method looked up something by its id, such as a scheduled job, a webhook or a backup, and found nothing. For an unknown method the message reads, for example, There is no tool called "list_site". GET /v1/tools lists the tools this token can use!. Method names are lowercase with underscores, exactly as on their pages.

A GET on a name that is not a method answers the same 404, once the token has been checked. A method's address called with a verb other than POST or GET, such as PUT or DELETE, also answers 404, because no route exists for it.

409: already running

The same work is in flight and cannot start twice:

  • A call with the same Idempotency-Key is still running. This 409 carries the header Idempotency-Status: running. Wait, then send it again to get its answer. See Idempotency and retries.
  • The method found the work already under way, for example run_site_cron on a scheduled job that is already running, or create_site while every free site slot in the workspace is already being filled.

422: refused as it stands

  • The Idempotency-Key was already used with a different method or different arguments. This 422 carries the header Idempotency-Status: mismatch. Use a new key for a new request.
  • The method understood the request but will not carry it out, for example trigger_deploy_hook when the publish it would start is refused. The message gives the reason.

429: slow down

Two different limits answer 429:

  • The token's per-minute budget. Every token may make 240 method calls a minute, shared with any MCP client using it. The answer carries Retry-After with the seconds until the token's one-minute window ends. Wait that long.
  • A quota on the work itself. For example a site's chat queue holds at most 20 waiting messages, and the analytics methods share 1,200 lookups per site per hour. The message names the quota. A full chat queue frees up only as its messages run, so waiting for it to drain is the fix, not retrying. A quota that counts calls over a window, such as the analytics lookups or the bought domain limits, also sends Retry-After and data.retryAfter with the seconds to wait, and calling again after that is the fix.

See Rate limits.

500: something broke

The call failed on Modulify's side. A read is safe to repeat after a short pause. A write may have done part of its work before it failed, so read the current state before sending it again. When you sent the write with an Idempotency-Key, its key is kept and a repeat with the same key gets this same failure back with Idempotency-Replayed: true, so use a new key once you have checked that the work still needs doing. If it keeps failing, contact support with the X-Request-Id of the call.

503: try again

Modulify could not finish a check the call depends on. When it could not check access to the workspace the call points at, the message reads "Could not check access to that workspace. Try again!", nothing ran, and an Idempotency-Key sent with it is freed, so repeat the call after a moment. A method can also answer 503 when something it needs is not available right now, such as buying domains, and its message says what.

Details in data

A refusal can carry more than a message. When a method has something to add, it is in data:

Method What data carries on a refusal
create_site reason, plus sitesCount, siteLimit and canPurchaseExtraSite when the plan is full
send_message code, a site chat error code

How to retry

Code Retry?
400, 401, 403, 404, 405, 422 No. Change the request first
402 After adding credits
409 After the running work finishes
429 After Retry-After, or after the quota frees up
500 A read, yes, after a pause. A write, only after reading the current state, with a new Idempotency-Key
503 Yes, after a pause

Next