Error format

Every 4xx and 5xx response has one shape. Branch on the code, show the message, log the request id.

Every error, an unknown path and a body that is not JSON included, returns the same envelope:

{
  "error": {
    "code": "not_ready",
    "message": "Add the missing items, then launch again. Nothing was spent.",
    "errors": [
      {
        "param": "contact_email",
        "code": "required",
        "message": "Add a contact email. Some directories register the listing to it."
      }
    ],
    "doc_url": "https://submitator.com/docs/errors#not_ready",
    "request_id": "6b0f2c9e-6a41-4c55-9d2a-0f0d3c1a8e77"
  }
}

Fields

FieldAlways thereWhat it holds
codeYesThe stable code. Branch on it; Error codes lists all 32.
messageYesA sentence for people that says what happened and what to do. It can change, so never parse it.
doc_urlYesThe section of the error codes page for this code.
request_idYesThe request's id, the same as the X-Request-Id header. Quote it when you write to support.
paramNoThe parameter at fault, when there is one.
errorsNoEvery field to fix, on validation_failed, not_ready and invalid_directories.
existingNoThe project in the way, on project_exists and already_launched.

Field errors

Each item of errors names one field in param, as a path such as tagline, competitors[2].url or directories.include[0]. Its code comes from this closed list:

CodeMeaning
requiredThe field is missing or empty.
invalidThe value is not allowed here; message says why.
invalid_enumThe value is not one of the listed values.
invalid_urlNot an http or https URL.
not_public_urlLive mode only: the host is an IP address or a reserved name such as .test.
invalid_emailNot an email address.
too_shortShorter than the minimum length.
too_longLonger than the maximum length.
too_manyThe list has more items than allowed.
immutableThe field cannot change any more, such as contact_email after launch.
file_too_largeThe image is larger than 5 MB.
unsupported_file_typeThe file is not a PNG, JPEG, GIF or WebP image.
import_failedWe could not download an image from the URL.

Handle errors in your code

  • 4xx: the request was wrong. Fix it before you send it again; a retry with the same body gets the same answer.
  • 409 idempotency_key_in_use: the first request with this Idempotency-Key is still running. Retry in 1 second with the same key.
  • 429: wait the seconds in Retry-After, then send the same request again.
  • 500 and 503: retry with backoff, for example after 1, 2, 4 and 8 seconds. Send a POST again with the same Idempotency-Key, so it runs at most once. If it repeats, write to support with the request_id.

Show message to the person who can fix the problem, and keep code and request_id in your logs. A failed launch spends nothing, and its message says so.

HTTP statuses

StatusCodes
400invalid_json, invalid_query, unknown_parameter, invalid_cursor
401api_key_missing, api_key_invalid
402no_launches_left
403account_suspended, permission_denied, test_mode_only
404not_found, route_not_found
405method_not_allowed
409already_launched, project_exists, idempotency_key_in_use
410gone, cursor_expired
415unsupported_media_type
422validation_failed, not_ready, nothing_to_submit, invalid_directories, allowance_exhausted, badge_not_found, image_unreachable, endpoint_url_invalid, idempotency_key_reused, quota_exceeded
429rate_limited
500internal_error
503unavailable