API Response Codes
Every Fivetran REST API response includes an HTTP status code. Most responses also include a JSON body with a code field and a message field.
Use the HTTP status code to determine whether the request succeeded. If it failed, use the code field for programmatic error handling and the message field for a human-readable explanation.
{
"code": "NotFound_Connector",
"message": "Connector with id 'abc123' does not exist."
}
Supported HTTP status codes
| HTTP status | Description |
|---|---|
200 OK | Request succeeded. The response body contains the requested resource. |
201 Created | Resource was successfully created. The response body contains the new resource. |
204 No Content | Request succeeded. No body is returned, typically for DELETE. |
400 Bad Request | The request body is malformed, missing required fields, or contains invalid values. See the message field for specifics. |
401 Unauthorized | The Authorization header is missing, malformed, or the API key–secret pair is invalid. |
403 Forbidden | The authenticated user does not have permission to perform this action. |
404 Not Found | The requested resource does not exist. The code field identifies which resource type was not found. |
405 Method Not Allowed | The HTTP method used is not supported for this endpoint. |
406 Not Acceptable | The Accept header specifies a media type the API cannot return. Use Accept: application/json or Accept: application/json; version=2. |
409 Conflict | The request conflicts with the current state of the resource. For example, a duplicate role assignment or a sync already in progress. |
415 Unsupported Media Type | The Content-Type header is missing or not application/json on a POST or PATCH request. |
429 Too Many Requests | You have exceeded a rate limit. See Rate Limiting for limits and the Retry-After header for when to retry. |
500 Internal Server Error | An unexpected error occurred on Fivetran's side. If the error persists, contact Fivetran Support. |
Fivetran code values
The code field in responses is a stable string identifier. Use code, not message, to branch your error handling logic.
The following table covers common code values. Some endpoints return additional codes specific to their resource type. Each connector also returns its own connector-specific code values. Refer to the individual endpoint reference pages for the code values specific to that endpoint.
| Code value | HTTP status | Category | Description |
|---|---|---|---|
Success | 200, 201 | Success | The request completed successfully. |
InvalidInput | 400 | Validation | One or more request fields failed validation. See message for the specific field. |
Unauthorized | 401 | Authentication | The API key–secret pair is invalid or missing. |
Forbidden | 403 | Authorization | The authenticated user does not have permission to perform this action. |
NotFound_Connector | 404 | Not found | No connection exists with the provided connectionId. |
NotFound_Role | 404 | Not found | No role exists with the provided role name. |
RoleExists | 409 | Conflict | The role is already assigned to this user for this resource. |
AlreadyInSync | 409 | Conflict | A sync is already in progress and the requested operation cannot proceed until it completes. |
TooManyRequests | 429 | Rate limiting | A rate limit has been exceeded. The response includes a Retry-After header specifying how many seconds to wait before retrying. See Rate Limiting. |
ServerError | 500 | Server error | An unexpected error occurred. Contact Fivetran Support if the issue persists. |
Error handling example based on code
RESPONSE=$(curl -s -w "\n%{http_code}" \
-H "Accept: application/json" \
-u "$FIVETRAN_API_KEY:$FIVETRAN_API_SECRET" \
"https://api.fivetran.com/v1/connections/abc123")
HTTP_STATUS=$(echo "$RESPONSE" | tail -1)
BODY=$(echo "$RESPONSE" | sed '$d')
CODE=$(echo "$BODY" | python3 -c "import json,sys; print(json.load(sys.stdin).get('code',''))")
if [ "$HTTP_STATUS" -ge 400 ]; then
case "$CODE" in
"NotFound_Connector")
echo "Connection not found. Check the connectionId."
;;
"Unauthorized")
echo "Invalid API key or secret. Check your credentials."
;;
"TooManyRequests")
echo "Rate limited. Wait for the Retry-After value before retrying."
;;
*)
echo "Unexpected error: $CODE"
;;
esac
fi
Fivetran-specific success behavior
A 2xx response confirms we accepted your request, but it doesn't always mean the operation has completed or succeeded. Some endpoints return 2xx for asynchronous operations, deferred actions, or requests that require additional validation in the response body.
| Endpoint | What the 2xx means | How to confirm the actual outcome |
|---|---|---|
POST /v1/connections | The connection was created (201), but setup tests may have FAILED or SKIPPED if run_setup_tests: true was set. | Check the status field on each item in data.setup_tests[]. |
POST /v1/connections/{connectionId}/sync | The sync has been triggered, not completed (200). | Poll GET /v1/connections/{connectionId} and check sync_state. |
POST /v1/connections/{connectionId}/resync | The re-sync has been triggered (200). If the connection is paused, the re-sync is scheduled and runs when the connection is re-enabled. | Poll GET /v1/connections/{connectionId} and check sync_state. |
POST /v1/connections/{connectionId}/test | The request was valid (200), but individual setup tests may have FAILED or SKIPPED. | Check the status field on each item in data.setup_tests[]. |
PATCH /v1/connections/{connectionId}/schemas | The schema change was accepted (200), but column drops take effect at the next sync. | Verify the outcome after the next sync completes. |