Errors
Every failed request gets the same JSON response: an HTTP status that names the kind of failure, and a body with one error object. Read the status first, then the type and code in the body.
One address answers a refusal in another body: the token address, POST /v1/oauth/token, follows the OAuth 2.0 standard. See Read a refusal of the token address.
Read the error shape
The error object has five fields, and no others.
type: the group the error belongs to, such asinvalid_request_error.code: the stable, snake_case name of the failure, such asresource_not_found. Branch oncodein your own code.message: a sentence that says what went wrong. Show it to a developer, not as a fixed string to match.param: the name of the field or header that caused the error, ornullwhen no single one did.request_id: the ID of the request, the same as itsRequest-Idheader. See Request IDs.
A failed request always answers with Content-Type: application/json, whether or not it sends an Accept header.
Handle each status
Each failure has one status, one type and one code. The table lists every code of the API, with its meaning.
| Status | Type | Code | Meaning |
|---|---|---|---|
| 401 | authentication_error | access_token_invalid | The access token is unknown or has expired. Request a new one. |
| 403 | permission_error | account_not_accessible | The Black-Account header names no account the caller may act in, whether that account exists or not; the answer is the same in every case, so it tells nothing about which accounts exist. |
| 403 | permission_error | account_required | The request names no account this endpoint reaches: a vendor's API client names one of its sub-accounts in the Black-Account header, and a person signed in to the console names one of their accounts there; a vendor's home account is named only on the routes that reach it. |
| 409 | invalid_request_error | already_member | The customer already holds a subscription that is unpaid, running or in its grace period, and a customer holds one at a time. Find it in the list of the customer's subscriptions; a new one can be created once it has ended. |
| 409 | invalid_request_error | already_team_member | This email is already on the account's team, active or turned off. |
| 409 | invalid_request_error | api_client_already_revoked | This API client is already revoked. A revoked API client cannot be restored; create a new one instead. |
| 409 | invalid_request_error | api_client_limit_reached | This environment already has the most active API clients it may hold. Revoke one before creating another. |
| 401 | authentication_error | api_client_revoked | The API client this access token was issued to has been revoked. |
| 409 | invalid_request_error | app_already_archived | This app is archived. An archived app is archived for good and takes no change; register a new app instead. |
| 401 | authentication_error | app_archived | The app of this publishable key is archived, so its keys are refused for good. Register a new app and use its key. |
| 401 | authentication_error | authentication_required | The request carried no access token; send one in the Authorization header as "Bearer" followed by the token. |
| 401 | authentication_error | authorization_header_malformed | The Authorization header must be "Bearer" followed by an access token. |
| 503 | api_error | billing_engine_unavailable | Billing is unavailable for a moment and nothing was saved. Retry the request later. |
| 409 | invalid_request_error | blocked | This customer is blocked, so they cannot subscribe, pay, or resume or change a membership until the block is removed. |
| 409 | invalid_request_error | cancel_not_pending | This subscription is not set to cancel at the end of its period, so there is no cancel to undo. |
| 409 | invalid_request_error | cancel_pending | This subscription is already set to cancel at the end of its period, so it takes no other cancel and no change of plan at the end of its period. Undo the cancel first. |
| 402 | card_error | card_declined | The card was declined, and it was not saved. decline_reason says why. Ask the customer for another card, then try again. |
| 422 | invalid_request_error | card_payment_not_supported | Black charges a card in this environment, and a card payment is not supported here. Subscribe with a card through a hosted checkout, POST /v1/client/checkout-sessions; the account changes the plan of a subscription Black charges. |
| 401 | authentication_error | checkout_secret_invalid | The Black-Checkout-Secret header must carry the secret of this checkout session, from the fragment of its url. |
| 409 | invalid_request_error | checkout_session_complete | This checkout session is complete: its payment is recorded, and it takes no other. Send the customer to its success address. |
| 409 | invalid_request_error | checkout_session_expired | This checkout session has expired and takes no payment. Create a new checkout session. |
| 409 | invalid_request_error | checkout_session_not_confirmed | This checkout session has not been confirmed, so there is no declined payment to pay again. Confirm it first. |
| 409 | invalid_request_error | collection_method_mismatch | The account collects this invoice itself, so Black does not charge it. Report the payment with mark-paid instead. |
| 409 | invalid_request_error | command_set_aside | This request could not be saved and has been set aside for our team to look at. Repeating it gives this answer until they have cleared it. |
| 409 | invalid_request_error | confirmation_required | Subscriptions charged by Black are still running in this environment, and their renewals fail while no gateway is connected. Send confirm set to true to disconnect anyway. |
| 400 | invalid_request_error | credentials_in_query_string | The address carried access_token, client_secret, api_key or refresh_token in its query string, which param names, so the request was refused before any credential was checked and nothing ran, even with a valid credential in its header; credentials go in a header or the request body, never the address. |
| 409 | invalid_request_error | credit_exceeds_charge | The credit for the days left of the paid period is larger than the new plan's price, so the plan cannot be changed now. Change it at the end of the period instead. |
| 422 | invalid_request_error | currency_not_supported | The currency asked for is not one Black knows, is not written in capital letters, or is not on the environment's list of the currencies its prices may be shown and charged in; param names currency, and nothing was converted. A price asked for in its own currency is always shown unchanged. |
| 409 | invalid_request_error | customer_already_blocked | This customer is already blocked. To give another reason, remove the block, then block the customer again. |
| 409 | invalid_request_error | customer_already_flagged | This customer is already flagged. To give another reason, remove the flag, then flag the customer again. |
| 409 | invalid_request_error | customer_block_in_progress | This customer's block is still ending their subscriptions. Remove the block once every one has ended. |
| 422 | invalid_request_error | customer_country_required | The environment takes its tax from a tax service, which needs the country to tax. Set the customer's address country, or send customer_country. |
| 409 | invalid_request_error | customer_deleted | The customer of this subscription was deleted, so its first invoice takes no payment. |
| 409 | invalid_request_error | customer_not_blocked | This customer is not blocked, so there is no block to remove. |
| 409 | invalid_request_error | customer_not_flagged | This customer is not flagged, so there is no flag to remove. |
| 409 | invalid_request_error | customer_reference_in_use | Another customer in this environment has this reference. Send another reference, or first remove it from that customer. |
| 401 | authentication_error | customer_session_expired | The customer's access token has lapsed, or their session has ended. Exchange the refresh token for a new pair; when the refresh is refused too, sign the customer in again. |
| 401 | authentication_error | customer_session_invalid | The customer's token is unknown, or was made for another app or another environment. Sign the customer in again with this app's publishable key. |
| 401 | authentication_error | customer_session_required | This Client API call needs the customer's session as well as the publishable key. |
| 409 | invalid_request_error | email_in_use | A sign-up, or a signed-in customer's change of email, was refused because another customer of the environment who signs in with Black's own sign-in already uses the email, an email identity or a proved one; param names email (none when the change is being confirmed), nothing was made or changed, and the customer signs in, asks for a link to set a new password, or keeps their email. |
| 409 | invalid_request_error | exchange_rate_expired | The exchange rate set named is no longer honoured: a newer set replaced it longer ago than the environment holds a shown price. Read the plans again and use the price they show. |
| 503 | api_error | exchange_rate_unavailable | No exchange rate is in force: the newest rates Black holds are more than 48 hours old, or none has been fetched yet. Retry the request later. |
| 409 | invalid_request_error | export_too_large | More customers match these filters than one export may hold. Narrow the filters, for example by a date range, and export each part. |
| 409 | invalid_request_error | feature_already_attached | This feature is already attached to this product. |
| 409 | invalid_request_error | feature_inactive | The feature is inactive and cannot be attached to a product. Make it active again, or attach another feature. |
| 409 | invalid_request_error | feature_lookup_key_in_use | Another feature in this environment, active or not, has this lookup key. Send another key. |
| 409 | invalid_request_error | gateway_already_connected | This environment already has a gateway connection. Replace its credentials, or disconnect it before connecting another. |
| 422 | invalid_request_error | gateway_credentials_invalid | The gateway refused these credentials, and nothing was stored. Check the secret key, the prefix, the processing channel and the public key, then connect again. |
| 422 | invalid_request_error | gateway_credentials_missing_permission | The gateway accepted the secret key, but it lacks a permission Black uses, and nothing was stored. Give the key every permission Black needs, then connect again. |
| 422 | invalid_request_error | gateway_credentials_wrong_environment | These credentials belong to the gateway's other environment, and nothing was stored. A test environment takes the gateway's sandbox credentials, and a live environment its live ones. |
| 409 | invalid_request_error | gateway_not_connected | This environment has no active gateway connection, so Black cannot charge through one. Connect a gateway first, or replace the credentials of a failing one. |
| 503 | api_error | gateway_unavailable | The payment gateway did not answer, and nothing was stored. Retry the request later. |
| 503 | api_error | google_keys_unavailable | Google's signing keys could not be fetched with certainty, so the Google ID token was not checked and no session was made. Retry the request later. |
| 401 | authentication_error | google_token_invalid | This Google ID token is malformed, not signed by Google, issued for another client ID or by another issuer, expired, or names no account. Sign the customer in with Google again for a new one. |
| 403 | permission_error | grant_by_vendor | Only the account's vendor grants a subscription for free, naming the account in the Black-Account header. |
| 400 | invalid_request_error | idempotency_key_invalid | The Idempotency-Key header must be between 1 and 255 characters of UTF-8 text. |
| 409 | invalid_request_error | idempotency_key_reused | The Idempotency-Key was already used in this environment for a different request, or by a caller its kept answer may not go to: an answer made for an API client is given again to any API client of the environment and never to a person or a publishable key, and one made for a person or a page's publishable key to that person or key alone. Send a new key for a new request. |
| 409 | invalid_request_error | idempotency_request_in_progress | A request with this Idempotency-Key is still being processed. Retry once it has finished. |
| 503 | api_error | identity_keys_unavailable | The key set of the account's own sign-in could not be fetched with certainty, so no identity token was checked and no session was made. Retry the request later. |
| 401 | authentication_error | identity_token_audience_invalid | This identity token names another audience than the one the environment set. Sign it for that audience. |
| 401 | authentication_error | identity_token_expired | This identity token has expired: its end has passed, beyond 60 seconds of leeway. Sign the customer in again for a new token. |
| 401 | authentication_error | identity_token_invalid | This identity token is malformed, names another issuer, lacks a subject, a token ID, an issue time or an end, is not yet valid, or lasts more than 10 minutes. Sign the customer in again for a new token. |
| 401 | authentication_error | identity_token_replayed | This identity token was already exchanged, and each is used once. Sign the customer in again for a new token. |
| 401 | authentication_error | identity_token_signature_invalid | This identity token is not signed with RS256 or ES256 by a key of the key set the environment names, or its signature does not match. Sign it with a key of that set. |
| 500 | api_error | internal_error | Something went wrong on our side. Retry the request later. |
| 400 | invalid_request_error | invalid_api_version | The Black-Version header does not name a supported API version. |
| 400 | invalid_request_error | invalid_request | The request was refused as a whole rather than for one parameter, for example for a method the address does not take, and the HTTP status says which kind of refusal it is. |
| 404 | invalid_request_error | invitation_invalid | The invitation's link is unknown, used, revoked or expired; the answer is the same in every case, so it tells nothing about which invitations exist, and the person asks for a new invitation. |
| 409 | invalid_request_error | invitation_not_pending | Only a pending invitation can be resent or revoked; this one is accepted, revoked or expired. |
| 409 | invalid_request_error | invitation_pending | This email already has a pending invitation to the account. Resend it instead. |
| 409 | invalid_request_error | invoice_already_paid | This invoice is already paid, so it takes no other payment. |
| 409 | invalid_request_error | invoice_not_paid | This invoice is not paid, so there is no payment to refund or dispute. |
| 409 | invalid_request_error | invoice_open | An invoice of this subscription is open. Report it paid before changing the plan. |
| 409 | invalid_request_error | invoice_void | This invoice is void and takes no payment. |
| 409 | invalid_request_error | last_owner | This is the account's last active owner, and an account always keeps one. Make another team member an owner first. |
| 409 | invalid_request_error | last_payment_method | This is the customer's only card, and a subscription of theirs is charged automatically. Add another card first, then remove this one. |
| 401 | authentication_error | link_expired | This sign-in link has expired: it works for 15 minutes. Ask for a new one. |
| 422 | invalid_request_error | link_invalid | The token of a link Black emailed, to prove an email, to set a new password or to confirm a new email, is wrong, used, expired, superseded or sent in another customer's session, or the token of a sign-in link is malformed, unknown or of another environment; or the code a mobile app's customer typed in its place is wrong, used, expired, superseded or tried too often, or its email is no customer's; so nothing changed. param names token or code, and the customer asks for a new link or code. |
| 401 | authentication_error | link_used | This sign-in link was already used, and each works once. Ask for a new one. |
| 409 | invalid_request_error | lookup_key_in_use | Another price in this environment has this lookup key. Send another key; a new price may take it over with transfer_lookup_key: true. |
| 400 | invalid_request_error | mode_header_invalid | Send Black-Mode: live or Black-Mode: test to choose the environment to act in. |
| 401 | authentication_error | notification_signature_invalid | A notification reached a connection's address with no signature, or one its body does not match under the connection's signing key; nothing of it was kept or acted on. |
| 413 | invalid_request_error | notification_too_large | A notification reached a connection's address with a body over 256 KB; nothing of it was kept or acted on. |
| 403 | permission_error | origin_not_allowed | This publishable key's app does not take requests from this caller: a website's key only from one of its allowed origins, and a mobile app's key only with its bundle ID or package name in the Black-App header and no Origin header. |
| 403 | permission_error | owner_required | Giving or taking away the owner role, and turning off, turning on or removing an owner, needs the person acting to be an owner of the account, or of the vendor's team when acting for one of its sub-accounts; nothing changed. |
| 409 | invalid_request_error | owner_role_fixed | The owner role cannot be renamed, changed or deleted. It always holds every permission. |
| 422 | invalid_request_error | parameter_invalid | A parameter is missing or does not meet its rule; param names it and message says what it must be. |
| 422 | invalid_request_error | password_reset_invalid | The token of the link to set a password is wrong, used, expired or another email's, so nothing changed; param names token, and the person needs a new link. |
| 409 | invalid_request_error | payment_at_former_client | A refund was refused because the invoice's payment went through another gateway connection, or under another Checkout.com client, than the one now active: the client that holds the payment is the only one that can give it back, so nothing was sent to the new one and nothing was recorded as refunded. A refund the client changed under before its first send is failed connection_changed, as nothing was sent; one already sent stays pending, held, and invoice.refund_outcome_unknown is sent once. Refund the payment at its former client, then record that refund by POST /v1/invoices/{invoice}/refunds with the former client's action ID for it as gateway_action, or settle a held refund with POST /v1/invoices/{invoice}/refund-outcome. |
| 402 | card_error | payment_declined | The card was declined, and nothing was paid. decline_reason says why. Ask the customer for another card, then pay again. |
| 409 | invalid_request_error | payment_in_progress | A payment of this invoice is in progress. Wait for its result before paying or reporting it again. |
| 409 | invalid_request_error | payment_method_removal_in_progress | Another of this customer's cards is being removed at this moment. Try again in a few seconds. |
| 422 | invalid_request_error | payment_method_type_unsupported | Only cards are accepted, including Apple Pay and Google Pay. Send the single-use card token that the gateway's own fields returned. |
| 409 | invalid_request_error | payment_outcome_known | The outcome of this payment is already recorded, or was already reported, so there is nothing to settle. |
| 409 | invalid_request_error | payment_reference_in_use | Another invoice in this environment was paid under this payment reference. Send the reference of this payment. |
| 403 | permission_error | permission_denied | The access token is valid, but its holder may not perform this action: for a person signed in to the console, their role in the account does not hold the permission the request needs, which the message names, and nothing was read or changed. |
| 409 | invalid_request_error | price_archived | The price is archived and takes no new subscriptions. Make it active again, or subscribe to another price. |
| 409 | invalid_request_error | price_change_not_pending | No change of this subscription's plan at the end of its period is pending, so there is none to undo. An upgrade whose invoice is open cannot be undone; it expires when its invoice is not paid in time. |
| 409 | invalid_request_error | price_change_pending | A change of this subscription's plan is already pending: an upgrade whose invoice is open, or a change at the end of the period. Report the invoice paid, let it expire, or undo the change first, then send the request again with the same Idempotency-Key. |
| 409 | invalid_request_error | price_move_in_progress | A move of the subscriptions on this price is still running. Send the request again once every subscription it reaches has been moved. |
| 422 | invalid_request_error | price_not_recurring | A checkout session sells a recurring price, as a subscription, and this price is charged once. Choose a recurring price. |
| 409 | invalid_request_error | price_unchanged | The subscription is already on this price, so there is no plan to change to. |
| 409 | invalid_request_error | product_archived | The product is archived and takes no new prices or subscriptions. Make it active again, or use another product. |
| 409 | invalid_request_error | product_has_prices | This product has prices, so it cannot be deleted. Archive it instead by setting active to false. |
| 422 | invalid_request_error | promotion_codes_not_supported | A checkout session takes no promotion code. Leave out promotion_code, and send allow_promotion_codes as false or not at all. |
| 409 | invalid_request_error | publishable_key_already_revoked | This publishable key is already revoked. A revoked key cannot be restored; create a new one instead. |
| 401 | authentication_error | publishable_key_invalid | The Black-Publishable-Key header must carry a publishable key of one of the environment's apps. Copy the key from the app's keys. |
| 409 | invalid_request_error | publishable_key_limit_reached | This app already has the most active publishable keys it may hold, two. Revoke one before creating another. |
| 401 | authentication_error | publishable_key_not_allowed | A publishable key opens only the Client API, under /v1/client. Call this endpoint from your server with an API client's access token. |
| 401 | authentication_error | publishable_key_revoked | This publishable key has been revoked. Use the app's other active key, or create a new one. |
| 429 | rate_limit_error | rate_limit_exceeded | The API client sent more reads or more writes in one second than its environment allows; wait the number of seconds in the Retry-After header, then retry. |
| 429 | rate_limit_error | rate_limited | Too many requests reached this address in a short time; wait the number of seconds in the Retry-After header, then retry. |
| 409 | invalid_request_error | refund_outcome_known | This refund has already succeeded or failed, so there is nothing to settle. |
| 409 | invalid_request_error | renewal_deferred | The subscription's renewal waits until the service is on again. |
| 409 | invalid_request_error | renewal_due | This subscription's period has ended and its renewal is about to run, so it cannot be set to cancel or have its plan changed yet. Send the request again in a moment, with the same Idempotency-Key. |
| 409 | invalid_request_error | resource_already_exists | An object with this ID already exists. Send another ID, or none to have one made. |
| 404 | invalid_request_error | resource_not_found | The object or address asked for does not exist in the environment of the access token; when param is set, it names the parameter that refers to the missing object. |
| 409 | invalid_request_error | role_in_use | A team member holds this role, or a pending invitation gives it, so it cannot be deleted. Give the team member another role, or revoke the invitation, first. |
| 409 | invalid_request_error | sales_closed | Sales are closed in this environment, so it takes no new subscription. The plans read gives the reasons; sales open again once none applies. |
| 401 | authentication_error | server_credential_not_allowed | The Client API takes no server credential. Never put an access token or a client secret in a page or an app; send the app's publishable key in the Black-Publishable-Key header. |
| 403 | permission_error | setting_set_by_vendor | Only the account's vendor changes this setting, naming the account in the Black-Account header; the data-processing agreement is changed only with the vendor's live API client. |
| 401 | authentication_error | sign_in_again_required | A signed-in customer with no password asked to change their email in a session that started more than 10 minutes ago, so nothing changed and nothing was sent; the customer signs in again, by an email link or Google, and asks again in the new session. |
| 401 | authentication_error | sign_in_failed | The sign-in was refused: the email or the password is wrong, or a field is missing; the answer is the same in every case, so it tells nothing about which email exists. |
| 403 | permission_error | sign_in_method_disabled | This way of signing in is off, or not set up, in the environment's sign-in settings. For email and password, turn on sign_in.password; for a link sent by email, sign_in.email_link; for Google, sign_in.google with sign_in.google_client_id; for identity tokens, set sign_in.identity_keys_url, sign_in.identity_issuer and sign_in.identity_audience. |
| 401 | authentication_error | sign_in_token_expired | This sign-in token has expired: it is valid for 5 minutes. Ask the account's server for a new one. |
| 401 | authentication_error | sign_in_token_invalid | This sign-in token is unknown, malformed or of another environment. Ask the account's server for a new one, and exchange it with a publishable key of the same environment. |
| 401 | authentication_error | sign_in_token_used | This sign-in token was already exchanged, and each is used once. Ask the account's server for a new one. |
| 409 | invalid_request_error | subscription_busy | The subscription was changed by another request while this one was decided, and nothing was saved. Repeat the request with the same Idempotency-Key. |
| 409 | invalid_request_error | subscription_ended | This subscription has ended, so it can no longer be cancelled, set to cancel, have a cancel undone or have its plan changed. |
| 409 | invalid_request_error | subscription_granted | This subscription was granted for free for one term and ends at the end of it, so its end cannot be undone. |
| 409 | invalid_request_error | subscription_has_several_items | This subscription has more than one item, and only a subscription of one item can have its plan changed. |
| 409 | invalid_request_error | subscription_incomplete | This subscription is incomplete: its first invoice is not paid yet, so it cannot be set to cancel at the end of its period, which a cancel now can do instead, or have its plan changed. |
| 409 | invalid_request_error | tax_not_determined | The environment's tax service gave no rate for the country taxed, for example because the seller is not registered there, and the account has no rate of its own for it, so nothing was saved. Set a rate for the country, or its default rate. |
| 503 | api_error | tax_service_unavailable | The environment's tax service did not answer, and the account has no rate of its own for the country taxed, so nothing was saved. Retry the request later. |
| 409 | invalid_request_error | team_member_already_active | This team member is already active. |
| 409 | invalid_request_error | team_member_already_inactive | This team member is already turned off. |
| 403 | permission_error | team_member_inactive | The email and the password are right, but every membership of the person is turned off, so no session is made; an administrator of one of their teams turns it on again. |
| 403 | permission_error | team_member_required | The team's routes are for people signed in to the console, acting within their role; an API client's token is refused on every one of them. |
| 409 | invalid_request_error | test_clock_advancing | The test clock is advancing, and nothing was saved. Wait until its status is ready, then repeat the request. |
| 409 | invalid_request_error | test_clock_internal_failure | The test clock stopped with an internal failure while it advanced, and nothing was saved. Its customers can no longer be changed; delete the test clock and start with a new one. |
| 409 | invalid_request_error | test_clock_limit_reached | A limit of test clocks is reached: on the test clocks of an environment, on the customers of a test clock, or on the subscriptions of a customer on a test clock. Delete a test clock, or use another one. |
| 403 | permission_error | test_mode_required | This exists only in a test environment, as test clocks, test exchange rates and the practice gateway's notices do. Use the access token of a test API client. |
| 422 | invalid_request_error | trial_not_supported | A checkout session takes no trial: its subscription starts when it is paid. Leave out trial_days. |
| 403 | permission_error | vendor_client_required | This endpoint is for vendors: it takes a vendor's API client, or a person on the vendor's team naming the vendor's home account in the Black-Account header. |
| 409 | invalid_request_error | webhook_endpoint_disabled_by_operator | This webhook endpoint was disabled by Black, and only Black can enable it. Contact support. |
| 409 | invalid_request_error | webhook_endpoint_limit_reached | This environment already has the most webhook endpoints it may hold. Delete one before creating another. |
A failure with any other 4xx status keeps its status and answers with invalid_request.
Fix each failure by its cause:
- 400. Correct the request, then send it again. Sending the same request again gives the same answer. For
idempotency_key_invalid, send a key of 1 to 255 characters. See Idempotency. - 401. Send
Authorization: Bearer <access token>with a valid access token of the environment you call. When the code isaccess_token_invalid, get a new access token. When it isapi_client_revoked, use an active client ID and secret, or ask Black for a new pair. See Authentication. - 403. Use an API key that may perform the action.
- 404. Check the address and the ID in it.
- 409. For
idempotency_key_reused, send a new key for a new request, or send the first request again unchanged. Foridempotency_request_in_progress, wait a moment, then send the request again with the same key. See Idempotency. - 422. Correct the field that
paramnames, followingmessage, then send the request again. - 429. Wait the number of seconds in the
Retry-Afterheader, then send the request again. - 500. Wait, then send the request again. If it fails again, contact support with the
request_id. The message never carries a stack trace, a class name or a query. - 503. Wait, then send the request again. Nothing was saved, so sending it again is safe. If it keeps failing, contact support with the
request_id.
Read a refusal of the token address
The token address, POST /v1/oauth/token, refuses in the body the OAuth 2.0 standard gives for a token endpoint (RFC 6749, section 5.2), so an OAuth client library can read it. The body has two fields and no others: error, the code, and error_description, a sentence for a developer. It has no type, no param and no request_id field: read the ID from the Request-Id header.
| Status | Code | Cause |
|---|---|---|
| 401 | invalid_client | The client ID or the secret is not valid, or the pair is revoked. The description says so when the pair is revoked and the secret is right. |
| 400 | invalid_request | The request has no client_id or no client_secret. |
| 400 | unsupported_grant_type | The request has no grant_type, or one that Black does not issue tokens for. |
| 400 | unauthorized_client | The grant_type is one the client ID may not use. |
A request over a limit of the token address answers 429 rate_limited in the error shape above, and a failure on the Black side answers 500 internal_error in it too. See Authentication for the fix of each refusal.
A token request with a client secret that is not valid answers like this:
curl --request POST https://api.black.example/v1/oauth/token \
--data grant_type=client_credentials \
--data client_id=PLACEHOLDER_CLIENT_ID \
--data client_secret=not-the-client-secret
HTTP/1.1 401 Unauthorized
Content-Type: application/json
Cache-Control: no-store, private
Pragma: no-cache
Request-Id: req_01m77ecgd8e4mzqea9tdav22hn
{"error":"invalid_client","error_description":"Client authentication failed"}