Every Knit API response follows a consistent envelope structure. This page explains the response body format for success and error cases, along with the response headers returned by Knit
Success Message
Knit API's response will always have success body parameter set. success boolean can be used for evaluating whether an API call was successful. A successful API call will also contain dataobject. The API response will be present within data object. Below is an example for successful Employee Location API response
All responses from Knit's API share a consistent top-level structure:
| Field | Type | Always Present | Description |
|---|---|---|---|
success | boolean | Yes | true if the call succeeded, false if it failed |
data | object | On success only | Contains the API response payload |
error | object | On failure only | Contains error details |
Successful Response
When a request succeeds, success is true and the response payload is nested inside the data object. The shape of data varies by endpoint.
Example - generic structure:
{
"success": true,
"data": {
}
}
Example - Employee Location endpoint:
{
"success": true,
"data": {
"employeeId": "emp_8a7f3k",
"addressLine1": "221B Baker Street",
"addressLine2": "Apt 2",
"city": "London",
"state": "England",
"country": "GB",
"zipCode": "NW1 6XE",
"addressType": "HOME_PRESENT"
}
}Error Message
When a request fails, success is false and the error object contains details about what went wrong.
| Field | Type | Description |
|---|---|---|
error.msg | string | Human-readable description of error |
{
"success": false,
"error": {
"msg": "No such employee exists"
}
}
Tip: Always check the
successfield first before processing thedataobject to avoid runtime errors on failed responses.
Response Headers
Below is a set of Knit headers you can expect in the API Response
| Knit Header | Present On | Type | Description |
|---|---|---|---|
X-Knit-Execution-Id | All Responses | Mandatory | Unique Id for each API call/Webhook dispatch. Use it for debugging a particular execution. |
X-Knit-Signature | Webhook dispatches only | Optional | Only passed with Webhook dispatches for checking the integrity of the Webhook message. |
X-Knit-Integration-Id | Webhook dispatches only | Optional | Only passed with Webhook dispatches. |

