Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.promptingcompany.com/llms.txt

Use this file to discover all available pages before exploring further.

Errors

The Prompting Company’s JSON endpoints return an ApiResult<T> envelope for both success and failure.

Result shape

type ApiSuccess<T> = {
  ok: true;
  data: T;
};

type ApiError = {
  ok: false;
  code: ApiErrorCode;
  message: string;
  details?: unknown;
};

type ApiResult<T> = ApiSuccess<T> | ApiError;
Check ok before reading data:
const result = await response.json();

if (!result.ok) {
  console.error(result.code, result.message, result.details);
  return;
}

console.log(result.data);

Error codes

CodeDefault status
BAD_REQUEST400
UNAUTHORIZED401
PAYMENT_REQUIRED402
FORBIDDEN403
NOT_FOUND404
METHOD_NOT_ALLOWED405
NOT_ACCEPTABLE406
REQUEST_TIMEOUT408
CONFLICT409
GONE410
PAYLOAD_TOO_LARGE413
UNSUPPORTED_MEDIA_TYPE415
UNPROCESSABLE_ENTITY422
TOO_MANY_REQUESTS429
INTERNAL500
NOT_IMPLEMENTED501
BAD_GATEWAY502
SERVICE_UNAVAILABLE503
GATEWAY_TIMEOUT504
VALIDATION_ERROR422
BUSINESS_LOGIC_ERROR422
EXTERNAL_SERVICE_ERROR502
RATE_LIMITED429
MAINTENANCE_MODE503
LIVE_INDEX_NOT_FOUND404
SCOPE_INVALID422

Common messages

MessageMeaning
authentication requiredNo valid session, bearer token, or API key was found.
invalid api keyThe x-api-key value could not be verified.
public_api_onlyAn API key attempted to call an internal route.
auth_method_not_allowedThe endpoint does not accept the credential type you used.
insufficient_scopeYour bearer token or API key is missing a required scope.
rate_limitedYou exceeded the current rate limit bucket.

Request IDs

Every wrapper response includes:
x-request-id: 6efaa25e-3ef6-4a34-91c1-7ff3e0fd4cc8
You may also send your own x-request-id if it uses letters, numbers, _, ., -, or : and is at most 128 characters. TPC replaces unsafe values with a fresh ID. Share the request ID with support when you need help tracing a failed request.