Documentation Index Fetch the complete documentation index at: https://docs.qwairy.co/llms.txt
Use this file to discover all available pages before exploring further.
All errors return a JSON object with a structured error field containing a machine-readable code and a human-readable message. Use the error codes for programmatic error handling.
HTTP Status Codes
Code Status Description 200 OK Request succeeded 400 Bad Request Invalid request parameters 401 Unauthorized Missing or invalid authentication 403 Forbidden Valid auth but insufficient permissions 404 Not Found Resource doesn’t exist 429 Too Many Requests Rate limit exceeded 500 Internal Server Error Server-side error
All errors return a JSON response with a structured error object:
{
"error" : {
"code" : "BRAND_NOT_FOUND" ,
"message" : "Brand not found or not accessible"
}
}
Machine-readable error code for programmatic handling
Human-readable error description
Error Codes Reference
Authentication & Authorization
Code HTTP Status Description UNAUTHORIZED401 Authentication required INVALID_TOKEN401 Invalid or expired API token INSUFFICIENT_PLAN403 Growth plan or higher required FORBIDDEN403 Access denied
Not Found
Code HTTP Status Description BRAND_NOT_FOUND404 Brand not found or not accessible COMPETITOR_NOT_FOUND404 Competitor not found SOURCE_NOT_FOUND404 Source not found PROMPT_NOT_FOUND404 Prompt not found ANSWER_NOT_FOUND404 Answer not found RESOURCE_NOT_FOUND404 Generic resource not found ENDPOINT_NOT_FOUND404 API endpoint does not exist
Bad Request
Code HTTP Status Description INVALID_REQUEST400 Invalid request format INVALID_PARAMETER400 Invalid parameter value MISSING_PARAMETER400 Missing required parameter INVALID_DATE_RANGE400 Invalid date range INVALID_SORT_FIELD400 Invalid sort field
Rate Limiting
Code HTTP Status Description RATE_LIMIT_EXCEEDED429 Rate limit exceeded
Server Errors
Code HTTP Status Description INTERNAL_ERROR500 Internal server error
Common Errors
Authentication Errors (401)
// Missing Authorization header
{
"error" : {
"code" : "UNAUTHORIZED" ,
"message" : "Missing or invalid Authorization header. Use: Authorization: Bearer qw-api-xxx"
}
}
// Invalid or revoked token
{
"error" : {
"code" : "INVALID_TOKEN" ,
"message" : "Invalid or expired API token"
}
}
Solution : Ensure you’re using a valid token with the correct Bearer prefix.
Permission Errors (403)
// Team subscription doesn't include API access
{
"error" : {
"code" : "INSUFFICIENT_PLAN" ,
"message" : "Growth plan or higher required"
}
}
Solution : Verify you have the correct permissions and plan level.
Not Found Errors (404)
// Brand doesn't exist
{
"error" : {
"code" : "BRAND_NOT_FOUND" ,
"message" : "Brand not found or not accessible"
}
}
// Competitor doesn't exist
{
"error" : {
"code" : "COMPETITOR_NOT_FOUND" ,
"message" : "Competitor not found"
}
}
Solution : Check that the resource ID is correct and belongs to your team.
Rate Limit Errors (429)
{
"error" : {
"code" : "RATE_LIMIT_EXCEEDED" ,
"message" : "Rate limit exceeded. Please try again in 45 seconds."
}
}
Solution : Wait until X-RateLimit-Reset timestamp, then retry. See Rate Limits .
Server Errors (500)
{
"error" : {
"code" : "INTERNAL_ERROR" ,
"message" : "An unexpected error occurred"
}
}
Solution : Retry after a few seconds. If the error persists, contact support.
Handling Errors
JavaScript/TypeScript Example
async function callQwairyAPI ( endpoint : string ) {
const response = await fetch ( `https://www.qwairy.co/api/v1 ${ endpoint } ` , {
headers: {
'Authorization' : `Bearer ${ process . env . QWAIRY_API_TOKEN } ` ,
},
});
if ( ! response . ok ) {
const data = await response . json ();
const { code , message } = data . error ;
switch ( code ) {
case 'UNAUTHORIZED' :
case 'INVALID_TOKEN' :
throw new Error ( `Authentication failed: ${ message } ` );
case 'INSUFFICIENT_PLAN' :
case 'FORBIDDEN' :
throw new Error ( `Permission denied: ${ message } ` );
case 'BRAND_NOT_FOUND' :
case 'COMPETITOR_NOT_FOUND' :
case 'SOURCE_NOT_FOUND' :
case 'PROMPT_NOT_FOUND' :
case 'ANSWER_NOT_FOUND' :
throw new Error ( `Resource not found: ${ message } ` );
case 'RATE_LIMIT_EXCEEDED' :
const resetTime = response . headers . get ( 'X-RateLimit-Reset' );
throw new Error ( `Rate limited. Retry after: ${ resetTime } ` );
default :
throw new Error ( `API error [ ${ code } ]: ${ message } ` );
}
}
return response . json ();
}
Python Example
import requests
import os
def call_qwairy_api ( endpoint ):
response = requests.get(
f "https://www.qwairy.co/api/v1 { endpoint } " ,
headers = { "Authorization" : f "Bearer { os.environ[ 'QWAIRY_API_TOKEN' ] } " }
)
if not response.ok:
error = response.json().get( 'error' , {})
code = error.get( 'code' , 'UNKNOWN' )
message = error.get( 'message' , 'Unknown error' )
if code in [ 'UNAUTHORIZED' , 'INVALID_TOKEN' ]:
raise Exception ( f "Authentication failed: { message } " )
elif code in [ 'INSUFFICIENT_PLAN' , 'FORBIDDEN' ]:
raise Exception ( f "Permission denied: { message } " )
elif code.endswith( '_NOT_FOUND' ):
raise Exception ( f "Not found: { message } " )
elif code == 'RATE_LIMIT_EXCEEDED' :
reset_time = response.headers.get( 'X-RateLimit-Reset' )
raise Exception ( f "Rate limited. Retry after: { reset_time } " )
else :
raise Exception ( f "API error [ { code } ]: { message } " )
return response.json()
Need Help?
If you encounter persistent errors or unexpected behavior, contact us at team@qwairy.co with:
The endpoint you’re calling
The full error response
Your request headers (without the token)
The timestamp of the request