Skip to content

Errors

Failures answer with an HTTP status and one JSON shape:

json
{
  "error": {
    "code": "invalid_request",
    "message": "limit must be between 1 and 50",
    "param": "limit"
  }
}

Branch on error.code. message is written for your logs and is free to change wording; code that parses it will break on a release that fixes a typo.

StatusCodeMeaningWhat to do
400invalid_requestA parameter is missing or out of range. param names itFix the call. Retrying is pointless
401invalid_keyKey missing, unknown or disabledCheck the header, then the key
403forbiddenThe key is valid but the plan does not include this endpointChange plan or drop the call
404not_foundNo such clip, or no clips for that wordShow the empty state. Read didYouMean
429rate_limitedMinute window spentBack off, retry. See rate limits
429quota_exceededPeriod quota spentStop retrying until the period resets
5xxinternalOur faultRetry once with backoff, then surface a soft failure

A miss is not an error state for your user

404 from a word lookup usually means the corpus has not covered that word yet, not that the word is wrong. The response carries didYouMean when close words exist:

json
{
  "error": {
    "code": "not_found",
    "message": "No clips indexed for this word",
    "didYouMean": ["receive"]
  }
}

Offering that suggestion is a better experience than an error banner. See Word matching for how close a match has to be.

Timeouts

Set a client timeout of a few seconds and treat a timeout like internal: one retry, then degrade. Clip playback should never block on us; the embed URL is derivable from a videoId you already stored.

Metadata only. Playback runs on YouTube, through your own embed.