Skip to content

Error Handling

The Prediko API uses conventional HTTP status codes to indicate success or failure.

StatusMeaning
200Success
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
403Forbidden - Valid key but insufficient permissions
404Not Found - Resource doesn’t exist
500Internal Error - Something went wrong on our end

All error responses follow this structure:

{
"detail": "Human-readable error message"
}
{
"detail": "Missing Authorization header"
}

Solutions:

  • Ensure you include the Authorization header
  • Use the format: Authorization: Bearer YOUR_API_KEY
  • Check that your API key is valid and not expired
{
"detail": "Order 'ord_invalid' not found"
}

Solutions:

  • Verify the resource ID is correct
  • Check that the resource exists in your tenant
import requests
response = requests.get(
"https://api.prediko.io/api/v1/orders/ord_123",
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
if response.status_code == 200:
order = response.json()
elif response.status_code == 401:
print("Authentication failed. Check your API key.")
elif response.status_code == 404:
print("Order not found.")
else:
print(f"Error: {response.json().get('detail')}")