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
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
UPSTREAM_ERROR502Upstream provider returned an error
AI_UPSTREAM_ERROR502AI provider returned an error
INTERNAL_ERROR500Something went wrong on our end

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
  }
}

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