Core concepts

Errors

Sublaunch answers with an HTTP status and a JSON error whose type and code never change, so your code can branch on them.

The error object

Every error has the same shape. message is for people and may change, type and code are for your code. Every response, error or not, also carries its Request-Id header.

Attributes

  • typestring
    The family of the error, one per HTTP status.
  • codestring
    What went wrong exactly. See the codes below.
  • messagestring
    A sentence that explains the error.
  • paramstring or null
    The parameter at fault, when there is one.
  • request_idstring
    The request's ID, the same as its Request-Id header. Send it to us when you need help.
  • doc_urlstring
    This page, at the code's entry.
Response400
{
  "error": {
    "type": "invalid_request_error",
    "code": "parameter_invalid",
    "message": "limit must be an integer from 1 to 100.",
    "param": "limit",
    "request_id": "req_7Hq2LmX9pT4vK1sNb3Wd8YcQ",
    "doc_url": "https://sublaunch.com/docs/errors#parameter_invalid"
  }
}

HTTP status codes

StatusTypeMeaning
400invalid_request_errorThe request has a missing, unknown or invalid parameter. A request that conflicts with the Sublaunch, like a coupon code taken, gets this type with a 409, and a method the path does not take with a 405.
401authentication_errorNo key, a wrong key, a revoked key or an expired OAuth token.
403permission_errorThe key is valid but cannot do this, like a read key writing, a Sublaunch whose owner is on the Starter plan, or a team member without edit access. An email sent without enough AI credits gets this type with a 402.
404not_found_errorNo such object in the key's Sublaunch, or no such route.
409idempotency_errorAn Idempotency-Key was reused for another request, or its first request is still running.
429rate_limit_errorToo many requests. Wait for Retry-After seconds.
500api_errorSomething went wrong on our side, a 501 for an endpoint not available yet, a 502 when a Sublaunch service did not answer. Retry later with the same Idempotency-Key.

Error codes

CodeStatusMeaning
api_key_missing401The request has no Authorization or X-Api-Key header.
api_key_invalid401No key matches, or the header is not Bearer and a key. Check that you copied all of it, sl_live_ included.
api_key_revoked401The key was revoked in the app, or the team member who made it left the team. Create a new one.
token_expired401An OAuth access token of an AI app expired. The app refreshes it on its own.
insufficient_scope403The key has the read scope and the request changes data. Use a key with write.
plan_required403The Sublaunch's owner is on the Starter plan. The API works on Business and Premium, and the same key works again once the Sublaunch is on one of them.
insufficient_credits402The account has not enough AI credits to send this email. Quote a broadcast shows what it costs, AI credits are bought in the app.
forbidden403The key's user may not do this, like a team member without edit access to this part of the Sublaunch, or an action the API does not offer.
parameter_missing400A required parameter is missing. param names it.
parameter_invalid400A parameter has a value the API does not accept, like a price above 100 000 or a date that is not ISO 8601. param names it.
parameter_unknown400The query or the body has a parameter this endpoint does not take. param names it.
body_invalid400The body is not valid JSON, or not a JSON object.
cursor_invalid400The cursor is not one the API gave, was made for other filters, or goes deeper than 10 000 objects.
idempotency_key_invalid400The Idempotency-Key is longer than 255 characters.
method_not_allowed405This path does not take this method. The Allow header lists the ones it takes.
validation_failed400The Sublaunch refused the change. The message says why.
price_incomplete400A price of the draft has no amount yet, so the draft cannot be published.
limit_reached400A limit is reached, like 5 tiers on a Sublaunch or 6 prices on a tier. A coupon past 200, a full team or a Sublaunch with 100 pages gets it with a 409.
url_invalid400A webhook URL is not HTTPS, has credentials in it, uses a port other than 443 or 8443, does not resolve, or points to a private address.
webhook_endpoint_limit_reached400The Sublaunch has 10 webhook endpoints already. Delete one first.
username_taken409Another Sublaunch has this link, or it is reserved.
resource_already_exists409It is there already, like a category with this name.
code_taken409A coupon of the Sublaunch has this code already.
tier_in_use409Members joined this tier, so it cannot be deleted. Archive its prices instead.
price_in_use409Members bought this price, so it cannot be deleted. Archive it instead.
post_locked409Someone liked, voted or commented the post, so its words can't change anymore. Its category and comments still can.
comments_off409Comments are turned off for this post.
already_member409This person is on the team already.
slug_taken409Another page of the Sublaunch has this slug. Pick another one.
broadcast_locked409The email cannot change or go out as it stands, like an email sent already, or scheduled and not paused. The message says what to do.
resource_missing404No object with this ID in the key's Sublaunch. An ID of another Sublaunch answers the same.
route_not_found404No endpoint at this path.
idempotency_key_reused409This Idempotency-Key was used in the last 24 hours for a different method, path or body.
idempotency_key_in_use409The first request with this Idempotency-Key is still running. Retry in a second.
rate_limit_exceeded429More than 120 requests in the minute with this key, 300 on the Sublaunch, or a webhook limit. Wait for Retry-After seconds.
internal_error500An unexpected error on our side. The request_id helps us find it.
request_timeout500The request took too long. Narrow the filters, or retry with the same Idempotency-Key if it changes data.
not_implemented501This endpoint is not available yet.
upstream_unavailable502A Sublaunch service did not answer. Nothing changed, try again in a minute.
upstream_error502A course could not be made. Try again.
publish_failed502A course, an affiliate's commission, a page or an email of the draft could not be published. What comes after it stays in the draft, try again.

Handle errors

  • 400, 401, 403 and 404 never succeed as they are, nor a 409 that conflicts with the Sublaunch, like code_taken. Fix the request before sending it again.
  • 409 with idempotency_key_in_use succeeds a second later. Retry with the same Idempotency-⁠Key.
  • 429 succeeds after Retry-After seconds. See Rate limits.
  • 500 and 502 can be retried after a short wait. Send the same Idempotency-Key for requests that change data, so nothing happens twice.
  • Log the request_id of every error, it lets us find the request in seconds.