APIErrorCode for server-side errors and ClientErrorCode for client-side errors.
APIErrorCode
Error codes returned by the Notion API in error responses. These are set as thecode property on APIResponseError.
Enum Values
Error Descriptions
unauthorized
The request lacks valid authentication credentials or the token has insufficient permissions.
Common causes:
- Missing or invalid authentication token
- Token has been revoked
- Integration lacks required capabilities
restricted_resource
The integration doesn’t have permission to access the requested resource.
Common causes:
- Page or database not shared with the integration
- User lacks permission to the resource
object_not_found
The requested object doesn’t exist or the integration doesn’t have access to it.
Common causes:
- Invalid ID
- Object has been deleted
- Integration lacks access (appears as not found for security)
rate_limited
The integration has exceeded its rate limit.
Common causes:
- Too many requests in a short time period
- Concurrent request limits exceeded
retry-after header is respected if present.
Example:
invalid_json
The request body contains invalid JSON.
Common causes:
- Malformed JSON string
- Incorrect content-type header
invalid_request_url
The request URL is malformed or contains invalid parameters.
Common causes:
- Incorrect endpoint path
- Invalid query parameters
invalid_request
The request is invalid but doesn’t fit other categories.
Common causes:
- Missing required parameters
- Invalid parameter combinations
validation_error
The request parameters failed validation.
Common causes:
- Invalid property types
- Missing required fields
- Value constraints violated (e.g., title too long)
conflict_error
The request conflicts with the current state of the resource.
Common causes:
- Concurrent modifications to the same resource
- Resource in an incompatible state for the operation
internal_server_error
Notion’s servers encountered an unexpected error.
Retry behavior:
The SDK automatically retries these errors for idempotent methods (GET, DELETE) only.
Example:
service_unavailable
Notion’s API is temporarily unavailable.
Retry behavior:
The SDK automatically retries these errors for idempotent methods (GET, DELETE) only.
Example:
ClientErrorCode
Error codes generated by the SDK for client-side errors. These indicate issues with the request before it reaches the Notion API.Enum Values
Error Descriptions
notionhq_client_request_timeout
The request exceeded the configured timeout.
Default timeout: 60 seconds
Example:
notionhq_client_response_error
The API returned an unexpected response format.
Common causes:
- Network errors
- Proxy or firewall interference
- Response doesn’t match expected error format
notionhq_client_invalid_path_parameter
A path parameter contains invalid characters that could alter the request path.
Common causes:
- Path traversal attempts (
..) - URL-encoded traversal sequences (
%2e%2e)
NotionErrorCode Type
A union type combining both error code enums:code values on NotionClientError.