Error response format
All error responses include adetail field:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Understand error responses and status codes.
detail field:
{
"detail": "Contact not found"
}
{
"detail": [
{
"loc": ["body", "email"],
"msg": "value is not a valid email address",
"type": "value_error.email"
}
]
}
| Code | Meaning | Description |
|---|---|---|
200 | OK | Request succeeded |
201 | Created | Resource successfully created |
204 | No Content | Request succeeded with no response body (deletes) |
400 | Bad Request | Invalid request body or parameters |
401 | Unauthorized | Missing or invalid authentication |
403 | Forbidden | Valid auth but insufficient permissions |
404 | Not Found | Resource does not exist |
409 | Conflict | Resource already exists or conflicts with current state |
422 | Unprocessable Entity | Request body failed validation |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Unexpected server error |
import requests
response = requests.get(
"https://api.morphic.io/api/contacts/invalid-id",
headers={"X-API-Key": "sk_your_api_key_here"},
)
if response.status_code == 404:
print("Contact not found")
elif response.status_code == 401:
print("Check your API key")
elif response.status_code >= 400:
error = response.json()
print(f"Error: {error['detail']}")
const response = await fetch(
"https://api.morphic.io/api/contacts/invalid-id",
{ headers: { "X-API-Key": "sk_your_api_key_here" } }
);
if (!response.ok) {
const error = await response.json();
switch (response.status) {
case 404:
console.log("Contact not found");
break;
case 401:
console.log("Check your API key");
break;
default:
console.log(`Error: ${error.detail}`);
}
}