YepAPI
Getting Started

Errors

Standard error codes and how to handle them.

Error Format

All errors follow the same format:

{
  "ok": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable description"
  }
}

Error Codes

CodeHTTP StatusDescription
INVALID_API_KEY401Missing or invalid API key
REVOKED_API_KEY401API key has been revoked
NO_CREDITS402Insufficient balance for this request
ACCOUNT_FROZEN403The account is temporarily frozen pending a billing review. Contact [email protected]
VALIDATION_ERROR400Request body validation failed
NOT_FOUND404Endpoint or resource not found
JOB_NOT_FOUND404Media job not found
JOB_EXPIRED410Job result has expired, resubmit your request
MEDIA_MODEL_NOT_FOUND400Unknown media model ID
RATE_LIMITED_UPSTREAM429The upstream provider is rate-limiting; retry after a short wait
UPSTREAM_ERROR503Upstream provider returned an error
AI_UPSTREAM_ERROR503AI provider returned an error
UPSTREAM_TIMEOUT503Upstream provider timed out; safe to retry
REQUEST_TIMEOUT503The request ran past the API's time limit; safe to retry
INTERNAL_ERROR500Something went wrong on our end

Every error, including upstream failures and timeouts, comes back as this JSON body. Branch on error.code rather than the HTTP status: upstream failures and timeouts share 503.

Handling Errors

const res = await fetch('https://api.yepapi.com/v1/seo/keywords', {
  method: 'POST',
  headers: {
    'x-api-key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ keywords: ['nextjs seo'] }),
});

const result = await res.json();

if (!result.ok) {
  const { code, message } = result.error;

  if (code === 'NO_CREDITS') {
    // Add funds at https://yepapi.com/dashboard/billing
  }
}

Request IDs

Every response carries an x-request-id header and a top-level request_id field in the JSON body:

{
  "ok": false,
  "request_id": "3f1c9e2a-7b4d-4e8f-9a21-0c5d6e7f8a9b",
  "error": {
    "code": "UPSTREAM_ERROR",
    "message": "Upstream data source returned an error"
  }
}

You can look up any data API call — including failed ones (4xx and 5xx, timeouts included) — under Dashboard → API Logs. It lists the request ID, endpoint, status code, cost and latency for your latest 100 data API calls. Failed calls are never charged.

Include the request ID when contacting support so we can find the exact call.

Upstream Errors

When an upstream data source returns an error, we return an UPSTREAM_ERROR with additional context:

{
  "ok": false,
  "error": {
    "code": "UPSTREAM_ERROR",
    "message": "Upstream data source returned an error",
    "upstream": {
      "status": 500,
      "message": "Internal server error"
    }
  }
}

On this page