Introduction
The Stitch Import API enables you to push arbitrary data from a source to Stitch. The Import API acts as a receiving point for data that is sent to Stitch. The Import API will ‘listen’ for new data, which is then processed by Stitch as it’s received.
This API is a RESTful, method-oriented API that allows you to push data from a source (including those Stitch doesn’t currently have an integration for) and send it to Stitch. Each endpoint uses standard HTTP verbs like GET and POST, and will return standard HTTP response codes to indicate request status or errors.
The API is built to accept JSON requests and to return JSON in all responses, including errors.
API functionality
Using the Import API, you can:
- Push data from a source to Stitch
- Check the status of the Import API
- Validate push requests and batches without persisting them to Stitch
Accessing the API
Anyone with a Stitch account can use the Import API. If you don’t currently have an account, sign up for a free trial here.
After you create a Stitch account, refer to the Managing Import API access tokens in Stitch guide for instructions on generating an Import API access token in the Stitch app.
Note: If you’re a Stitch Connect user, refer to the Managing Import API access tokens via the Connect API guide.
API support
While the Import API is a certified Stitch integration, using it does require some technical knowledge. This means that Stitch will address bugs and issues with the API that are within Stitch’s infrastructure, but Stitch doesn’t provide assistance for building or maintaining the scripts that send data to the API.
The table below provides some examples of the types of requests Stitch will and will not provide assistance for.
Stitch Support can assist with: | Stitch Support does not assist with: |
|
|
Refer to the Import API guides and resources for assistance when developing and testing your script.
Additionally, ask the Stitch Community if you’re still stuck.
Base URLs
The base URL you use to interact with the Import API depends on the data pipeline region your Stitch account is in.
For example: If your account is in the Europe (eu-central-1
) region, you’ll use this base URL in your requests to the Import API: https://api.eu-central-1.stitchdata.com
.
Not sure what data pipeline region your account is in? Click here for help.
Data pipeline region | Import API base URL |
North America (us-east-1) | https://api.stitchdata.com |
Europe (eu-central-1) | https://api.eu-central-1.stitchdata.com |
Your base URL is currently set to:
Note: If your requests uses the incorrect base URL, the API will respond with a 401 - Unauthorzied
code and an error.
Authentication
The Import API uses an API access token to authenticate requests. Import API access tokens can be generated and managed in the Integration Settings page for any Import API integration in your Stitch account. If you’re a Stitch Connect user, you can also use the Connect API to create Import API sources and manage their access tokens.
Authentication is performed via bearer auth, where your Import API access token is provided in the header of your request as -H 'Authorization: Bearer at_[IMPORT_API_ACCESS_TOKEN]'
.
Your API access token has write access to the Stitch integration schema or dataset in your destination. Because of this, API access tokens should be treated like passwords - don’t share them in publicly accessible places like Stackoverflow, GitHub, etc. Note: You also shouldn’t share your API access token with Stitch Support. If sharing requests, remember to redact the API access token before sending.
If an API access token is ever lost or compromised, you can revoke it and create a new token.
Refer to the Managing Import API access tokens in Stitch guide for more info.
Stitch client IDs
For some the Push and Validate push request endpoints, you’ll need to include your Stitch client ID for every record contained in a request body. Your Stitch client ID is the unique ID associated with your Stitch account.
curl -X "POST" "https://api.stitchdata.com
/v2/import/push" \
-H 'Authorization: Bearer [ACCESS_TOKEN]' \
-H 'Content-Type: application/json' \
-d \
'[
{
"client_id": 7723, /* Stitch client ID */
"table_name": "customers",
"sequence": 1565880017,
"data": {
"id": 4,
"name": "Beamo"
},
"key_names": [
"id"
],
"action": "upsert"
},
{
"client_id": 7723, /* Stitch client ID */
"table_name": "orders",
"sequence": 1565838645,
"key_names": [
"order_id"
],
"data": {
"order_id": 561,
"customer_id": 4
},
"action": "upsert"
}
]'
To locate your client ID, sign into your Stitch account and look at the URL. The client ID is the four to six-digit number between client
and pipeline
in the URL.
For example: If the URL is https://app.stitchdata.com/v2/client/7723/pipeline/connections
, the client ID would be 7723
.
A client ID may have multiple API access tokens associated with it, but an API access token will only ever be associated with a single client ID.
Response Codes
The API will attempt to return HTTP status codes to indicate the success or failure of a request sent to the API.
In general:
- Codes in the
2xx
range indicate success - Codes in the
4xx
range indicate an error with the request, such as an invalid API access token, missing client ID, malformed request body, etc. - Codes in the
5xx
range indicate an issue with Stitch. Persistent5xx
codes may indicate an outage, which you can monitor on Stitch’s status page.
Your application should handle each of the following statuses gracefully:
Code | Text | Description |
200 |
OK |
Success! New data was added as a result of the request. |
201 |
Created |
The request was accepted and will be processed later. New data will be added once the request is processed. |
202 |
Accepted |
The request was accepted, but cannot currently be processed due to an internal error. Data will be automatically re-processed. |
400 |
Bad Request |
The request includes malformed JSON/Transit, did not provide an array of records, or contains more than 20,000 records. |
401 |
Unauthorized |
Potential causes:
|
403 |
Forbidden |
The request had a valid API token, but is not permitted. The |
404 |
Not Found |
Potential causes:
|
405 |
Method Not Allowed |
The request has an HTTP method that is not supported by the endpoint. |
413 |
Request Entity Too Large |
The size of the request body exceeded 20MB. |
415 |
Unsupported Media Type |
The content header of the request didn’t specify a supported media type, or specified an unsupported media type. The Import API supports JSON ( |
422 |
Unprocessable Entity |
The request body is missing a required argument. |
503 |
Service Unavailable |
The Import API is experiencing problems. Try again later. |
504 |
Gateway Timeout |
The Import API couldn’t process the request in time due to an internal error. Try again later. |
Response and error message formats
The API will return responses - successful or errors - in JSON format. Below are descriptions and examples of each type of response.
Response message formats
For successful responses (codes in the 2xx
range) the API will return messages as a JSON object:
{
"status": "OK",
"message": "Batch Accepted!"
}
In the Import API documentation, this is referred to as a Batch Status object.
Error message formats
For error responses (codes in the 4xx
range), the API will return error messages in JSON format. In the Import API documentation, this is referred to as an Error object.
Some error messages may be returned as strings:
Content-Type must be application/json
While others may be JSON objects:
{
"status": "ERROR",
"error": "Forbidden",
"errors": {
"error": "Access token is not associated with this client."
}
}
Error message text
The text in error messages will vary by root cause and endpoint.
Each endpoint section contains a list of the errors specific to that endpoint. Refer to the documentation for the endpoint for specifics on errors, their possible causes, and the messages the API will return.
Versioning
When we make backwards-incompatible changes to the API, we release a new version. The current version of the Import API is 2.
Methods
API Status
An object describing the status of the Import API at the time a request is sent.
Endpoints
GET | Get Import API status |
Determines if the Import API is operating correctly. This endpoint doesn’t require any authentication. |
The API Status object
An object describing the status of the Import API at the time a request is sent.
name
STRING |
This will always be |
version
STRING |
Stitch internal field. |
revision
STRING |
Stitch internal field. |
status
STRING |
The status of the Import API at the time of the request. |
reason
STRING |
If applicable, the reason for the status. |
Example object
{
"name": "pipeline.gate",
"version": "0.3.3-SNAPSHOT",
"revision": "a154360ad8c43182965049dbf6239aa7c1f3c84d",
"status": "OK",
"reason": null
}
Get Import API status
Determines if the Import API is operating correctly. This endpoint doesn’t require any authentication.
Resource list
Request method |
GET |
Base URL |
The correct base URL for your Stitch data pipeline region. Your base URL is currently set to: |
Resource URL |
/v2/import/status |
Authorization |
Not required. |
Request header |
Not required. See the Request tab below for example requests. |
Request body |
The request body must be valid JSON or Transit and contain the required arguments. |
Response format |
Whether the request succeeds or fails, the API will return JSON. |
Returns
If successful, the API will return a 200 OK
status and an API status object.
curl "https://api.stitchdata.com
/v2/import/status"
{
"name": "pipeline.gate",
"version": "0.3.3-SNAPSHOT",
"revision": "a154360ad8c43182965049dbf6239aa7c1f3c84d",
"status": "OK",
"reason": null
}
Batch
An object containing a table name, a table schema, and message objects representing records to be pushed to Stitch.
Endpoints
POST | Create a batch |
Pushes data for a specified table to Stitch. |
The Batch object
An object containing a table name, a table schema, and message objects representing records to be pushed to Stitch.
table_name
STRING |
The name of the destination table the data is being pushed to. Table names must be unique in each destination schema, or loading issues will occur. Note: The number of characters in the table name should be within the destination’s allowed limits or data will rejected. |
schema
OBJECT (SCHEMA) |
A Schema object containing the JSON schema describing the record(s) in the Message object’s Records must conform to this schema or an error will be returned when the request is sent. |
messages
ARRAY (MESSAGE) |
An array of Message objects, each representing a record to be upserted into the table. |
key_names
ARRAY |
An array of strings representing the Primary Key fields in the source table. Note: A value must be provided, but it may be an empty list to indicate that the source table doesn’t have a Primary Key. If fields are provided, they must comply with the following:
All fields included in |
Example object
{
"table_name": "customers",
"schema": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"age": {
"type": "integer"
},
"has_magic": {
"type": "boolean"
}
}
},
"messages": [
{
"action": "upsert",
"sequence": 1565880017,
"data": {
"id": 1,
"name": "Finn",
"age": 15,
"has_magic": false
}
}
],
"key_names": [
"id"
]
}
Create a batch
Pushes a record or multiple records for a specified table to Stitch. Each request to this endpoint may only contain data for a single table.
When data for a table is pushed for the first time, Stitch will create the table in the destination in the specified integration schema.
How data is loaded during subsequent pushes depends on:
- The loading behavior types used by the destination. Stitch supports Upsert and Append-Only loading.
- Whether the
key_names
property specifies Primary Key fields. If Primary Keys aren’t specified, data will be loaded using Append-Only loading.
Refer to the Understanding loading behavior guide for more info and examples.
Structuring request body data
Refer to the Structuring data for the Import API guide for instructions and examples.
Resource list
Request method |
POST |
Base URL |
The correct base URL for your Stitch data pipeline region. Your base URL is currently set to: |
Resource URL |
/v2/import/batch |
Authorization |
Required. The request header must contain Authorization and your Import API access token. |
Request header |
The request header must contain the following:
See the Request tab below for example requests. |
Request body |
The request body must be valid JSON and contain the required arguments. The request body must also comply with the following:
|
Response format |
Whether the request succeeds or fails, the API will return JSON. |
Errors |
See the Errors tab, below. |
Arguments
This endpoint accepts the following parameters:
table_name
STRING REQUIRED |
The name of the destination table the data is being pushed to. Table names must be unique in each destination schema, or loading issues will occur. Note: The number of characters in the table name should be within the destination’s allowed limits or data will rejected. |
schema
OBJECT (SCHEMA) REQUIRED |
A Schema object containing the JSON schema describing the record(s) in the Message object’s Records must conform to this schema or an error will be returned when the request is sent. |
messages
ARRAY (MESSAGE) REQUIRED |
An array of Message objects, each representing a record to be upserted into the table. |
key_names
ARRAY OPTIONAL |
An array of strings representing the Primary Key fields in the source table. Stitch use these Primary Keys to de-dupe data during loading. If not provided, the table will be loaded in an append-only manner. Note: If included, a value must be provided. However, it may be an empty list to indicate that the source table doesn’t have a Primary Key. If fields are provided, they must adhere to the following:
All fields included in |
Returns
If successful, the API will return a 2xx
status and a Batch status object:
-
201
- The request was accepted and will be processed later. New data will be added once the request is processed. -
202
- The request was accepted, but cannot currently be processed due to an internal error. Data will be automatically re-processed.
Requests for POST /v2/import/batch
curl -X "POST" "https://api.stitchdata.com
/v2/import/batch" \
-H 'Authorization: Bearer [ACCESS_TOKEN]' \
-H 'Content-Type: application/json' \
-d \
'{
"table_name": "customers",
"schema": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"age": {
"type": "integer"
},
"has_magic": {
"type": "boolean"
},
"modified_at":{
"type":"string",
"format":"date-time"
}
}
},
"messages": [
{
"action": "upsert",
"sequence": 1565880017,
"data": {
"id": 1,
"name": "Finn",
"age": 15,
"has_magic": false,
"modified_at":"2020-01-13T21:25:03+0000"
}
}
],
"key_names": [
"id"
]
}'
curl -X "POST" "https://api.stitchdata.com
/v2/import/batch" \
-H 'Authorization: Bearer [ACCESS_TOKEN]' \
-H 'Content-Type: application/json' \
-d \
'{
"table_name":"customers",
"schema":{
"properties":{
"id":{
"type":"integer"
},
"name":{
"type":"string"
},
"age":{
"type":"integer"
},
"has_magic":{
"type":"boolean"
},
"modified_at":{
"type":"string",
"format":"date-time"
}
}
},
"messages":[
{
"action":"upsert",
"sequence":1565881320,
"data":{
"id":2,
"name":"Jake",
"age":6,
"has_magic":true,
"modified_at":"2020-01-13T21:25:03+0000"
}
},
{
"action":"upsert",
"sequence":1565838645,
"data":{
"id":3,
"name":"Bubblegum",
"age":17,
"has_magic":true,
"modified_at":"2020-01-14T13:34:25+0000"
}
}
],
"key_names":[
"id"
]
}'
curl -X "POST" "https://api.stitchdata.com
/v2/import/batch" \
-H 'Authorization: Bearer [ACCESS_TOKEN]' \
-H 'Content-Type: application/json' \
-d \
'{
"table_name":"customers_no_primary_keys",
"schema":{
"properties":{
"name":{
"type":"string"
},
"age":{
"type":"integer"
},
"has_magic":{
"type":"boolean"
},
"modified_at":{
"type":"string",
"format":"date-time"
}
}
},
"messages":[
{
"action":"upsert",
"sequence":1565881320,
"data":{
"name":"BMO",
"age":2,
"has_magic":false,
"modified_at":"2020-01-20T05:57:01+0000"
}
}
]
}'
Responses for POST /v2/import/batch
{
"status": "OK",
"message": "Batch Accepted!"
}
{
"status": "Accepted",
"message": "The batch is queued to be processed."
}
Code | Condition | Response body |
400 |
Request body is missing required arguments |
|
400 |
Request body contains an illegal argument |
|
400 |
Required argument is incorrectly typed |
|
400 |
Record in Message object doesn’t conform to the Schema |
|
400 |
|
|
400 |
Invalid JSON data type in Schema object |
|
400 |
Required argument missing from the Message object |
|
400 |
Value of the |
|
400 |
The Schema object must be an object, not an array |
|
401 |
Access token is missing or invalid |
|
401 |
Base URL doesn’t match account region |
|
401 |
Integration is paused or has been deleted |
|
413 |
Request body exceeds 20MB |
|
415 |
Unsupported content type |
|
Validate
An object containing table information, your client ID, and data objects representing records to be validated without being persisted to Stitch. The Validate object is identical to the Push object.
Endpoints
POST | Validate a push request |
Validates request credentials and batch data, but doesn’t persist the data to Stitch. This allows you to validate your API credentials and batch data during development. |
The Validate object
An object containing table information, your client ID, and data objects representing records to be validated without being persisted to Stitch. The Validate object is identical to the Push object.
client_id
INTEGER |
The Stitch client ID associated with your Stitch account. To locate your client ID, sign into your Stitch account and look at the URL. The client ID is the four to six-digit number between For example: If the URL is |
table_name
STRING |
The name of the destination table the data is being pushed to. Table names must be unique in each destination schema, or loading issues will occur. A single request can push data to multiple tables. Note: The number of characters in the table name should be within the destination’s allowed limits or data will rejected. |
sequence
INTEGER |
An integer that tells the Import API the order in which data points in the request body should be considered for loading. This data will be stored in the destination table in the In other Stitch integrations, Stitch uses a Unix epoch (in milliseconds) as the value for this property. Note: This value cannot exceed the maximum of |
action
STRING |
This will always be |
key_names
ARRAY |
An array of strings representing the Primary Key fields in the destination table.
|
data
OBJECT |
An object representing a record to be pushed into the destination table.
Refer to the Structuring data for the Import API guide for instructions and examples. |
Example object
{
"client_id":7723,
"table_name":"customers",
"sequence":1565880017,
"data":{
"id":1,
"name":"Finn"
},
"key_names":[
"id"
],
"action":"upsert"
}
Validate a push request
Note: With the exception of not persisting data, this endpoint is functionally identical to the Push endpoint. The Validate endpoint will not work if a request body intended for the Batch endpoint is sent.
Validates request credentials and batch data, but doesn’t persist the data to Stitch. This allows you to validate your API credentials and batch data during development.
Regardless of whether the Import API is functional, this endpoint will never return a 503 Service Unavailable
response. Use the Status endpoint to determine if the Import API is experiencing issues.
Resource list
Request method |
POST |
Base URL |
The correct base URL for your Stitch data pipeline region. Your base URL is currently set to: |
Resource URL |
/v2/import/validate |
Authorization |
Required. The request header must contain Authorization and your Import API access token. |
Request header |
The request header must contain the following:
See the Request tab below for example requests. |
Request body |
The request body must be valid JSON or Transit and contain the required arguments. The request body should provide an array (batch) of records to be inserted into the pipeline that comply with the following:
|
Response format |
Whether the request succeeds or fails, the API will return JSON. |
Errors |
See the Errors tab, below. |
Arguments
This endpoint accepts the following parameters:
client_id
INTEGER REQUIRED |
The Stitch client ID associated with your Stitch account. To locate your client ID, sign into your Stitch account and look at the URL. The client ID is the four to six-digit number between For example: If the URL is Note: This must be the same for every record in the request body. |
table_name
STRING REQUIRED |
The name of the destination table the data is being pushed to. Table names must be unique in each destination schema, or loading issues will occur. A single request can push data to multiple tables. Note: The number of characters in the table name should be within the destination’s allowed limits or data will rejected. |
sequence
INTEGER REQUIRED |
An integer that tells the Import API the order in which data points in the request body should be considered for loading. This data will be stored in the destination table in the In other Stitch integrations, Stitch uses a Unix epoch (in milliseconds) as the value for this property. Note: This value cannot exceed the maximum of |
action
STRING REQUIRED |
This will always be |
key_names
ARRAY REQUIRED |
An array of strings representing the Primary Key fields in the destination table.
|
data
OBJECT REQUIRED |
An object representing a record to be pushed into the destination table.
Refer to the Structuring data for the Import API guide for instructions and examples. |
Returns
If successful, the API will return a 200 OK
status and a Batch Status object.
curl -X "POST" "https://api.stitchdata.com
/v2/import/validate" \
-H 'Authorization: Bearer [ACCESS_TOKEN]' \
-H 'Content-Type: application/json' \
-d \
'[
{
"client_id":7723,
"table_name":"customers",
"sequence":1565881320,
"key_names":[
"id"
],
"data":{
"id":1,
"name":"Finn"
},
"action":"upsert"
}
]'
{
"status": "OK",
"message": "Batch is valid!"
}
Code | Condition | Response body |
400 |
Request body is not an array |
|
400 |
Request body is malformed |
|
401 |
Base URL doesn’t match account region |
|
401 |
|
|
401 |
Integration is paused or has been deleted |
|
403 |
|
|
405 |
Unsupported method |
|
413 |
Request body exceeds 20MB |
|
415 |
Unsupported content type |
|
422 |
Multiple client IDs in request |
|
422 |
Required argument is missing or blank |
|
422 |
Required argument is incorrectly typed |
|
422 |
|
|
422 |
|
|
422 |
Key values in |
|
422 |
Key names not provided |
|
422 |
String values in key fields cannot exceed 1,024 characters |
|
Push
An object containing table information, your client ID, and data objects representing records to be pushed to Stitch.
Endpoints
POST | Push data |
Pushes data for a specified table or tables to Stitch. |
The Push object
An object containing table information, your client ID, and data objects representing records to be pushed to Stitch.
client_id
INTEGER |
The Stitch client ID associated with your Stitch account. To locate your client ID, sign into your Stitch account and look at the URL. The client ID is the four to six-digit number between For example: If the URL is |
table_name
STRING |
The name of the destination table the data is being pushed to. Table names must be unique in each destination schema, or loading issues will occur. A single request can push data to multiple tables. Note: The number of characters in the table name should be within the destination’s allowed limits or data will rejected. |
sequence
INTEGER |
An integer that tells the Import API the order in which data points in the request body should be considered for loading. This data will be stored in the destination table in the In other Stitch integrations, Stitch uses a Unix epoch (in milliseconds) as the value for this property. Note: This value cannot exceed the maximum of |
action
STRING |
This will always be |
key_names
ARRAY |
An array of strings representing the Primary Key fields in the destination table.
|
data
OBJECT |
An object representing a record to be pushed into the destination table.
Refer to the Structuring data for the Import API guide for instructions and examples. |
Example object
{
"client_id":7723,
"table_name":"customers",
"sequence":1565880017,
"data":{
"id":1,
"name":"Finn"
},
"key_names":[
"id"
],
"action":"upsert"
}
Push data
Need to enforce data types?
We recommend using the Create a batch endpoint instead. The Batch endpoint allows you to specify a schema and enforce data types, while this endpoint does not.
Pushes data for a specified table or tables to Stitch.
When data for a table is pushed for the first time, Stitch will create the table in the destination in the specified integration schema.
During subsequent pushes, one of two things will happen depending on the destination being used:
- If the destination supports upserts, Stitch will perform an update operation on applicable existing rows to overwrite the data.
- If the destination doesn’t support upserts, Stitch will load the records in an append-only fashion. This means that existing records in the destination table will not be updated, and all records in subsequent pushes will be appended to the end of the table.
Structuring request body data
Refer to the Structuring data for the Import API guide for instructions and examples.
Resource list
Request method |
POST |
Base URL |
The correct base URL for your Stitch data pipeline region. Your base URL is currently set to: |
Resource URL |
/v2/import/push |
Authorization |
Required. The request header must contain Authorization and your Import API access token. |
Request header |
The request header must contain the following:
See the Request tab below for example requests. |
Request body |
The request body must be valid JSON or Transit and contain the required arguments. Additionally, the request body should provide an array (batch) of records to be inserted into the pipeline that adhere to the following:
|
Response format |
Whether the request succeeds or fails, the API will return JSON. |
Errors |
See the Errors tab, below. |
Arguments
This endpoint accepts the following parameters:
client_id
INTEGER REQUIRED |
The Stitch client ID associated with your Stitch account. To locate your client ID, sign into your Stitch account and look at the URL. The client ID is the four to six-digit number between For example: If the URL is Note: This must be the same for every record in the request body. |
table_name
STRING REQUIRED |
The name of the destination table the data is being pushed to. Table names must be unique in each destination schema, or loading issues will occur. A single request can push data to multiple tables. Note: The number of characters in the table name should be within the destination’s allowed limits or data will rejected. |
sequence
INTEGER REQUIRED |
An integer that tells the Import API the order in which data points in the request body should be considered for loading. This data will be stored in the destination table in the In other Stitch integrations, Stitch uses a Unix epoch (in milliseconds) as the value for this property. Note: This value cannot exceed the maximum of |
action
STRING REQUIRED |
This will always be |
key_names
ARRAY REQUIRED |
An array of strings representing the Primary Key fields in the destination table.
|
data
OBJECT REQUIRED |
An object representing a record to be pushed into the destination table.
Refer to the Structuring data for the Import API guide for instructions and examples. |
Returns
If successful, the API will return a 2xx
status and a Batch Status object:
-
201
- The request was accepted and will be processed later. New data will be added once the request is processed. -
202
- The request was accepted, but cannot currently be processed due to an internal error. Data will be automatically re-processed.
Requests for POST /v2/import/push
curl -X "POST" "https://api.stitchdata.com
/v2/import/push" \
-H 'Authorization: Bearer [ACCESS_TOKEN]' \
-H 'Content-Type: application/json' \
-d \
'[
{
"client_id":7723,
"table_name":"customers",
"sequence":1565880017,
"data":{
"id":1,
"name":"Finn"
},
"key_names":[
"id"
],
"action":"upsert"
}
]'
curl -X "POST" "https://api.stitchdata.com
/v2/import/push" \
-H 'Authorization: Bearer [ACCESS_TOKEN]' \
-H 'Content-Type: application/json' \
-d \
'[
{
"client_id":7723,
"table_name":"customers",
"sequence":1565880017,
"data":{
"id":4,
"name":"BMO"
},
"key_names":[
"id"
],
"action":"upsert"
},
{
"client_id":7723,
"table_name":"customers",
"sequence":1565838645,
"data":{
"id":5,
"name":"Ice King"
},
"key_names":[
"id"
],
"action":"upsert"
}
]'
curl -X "POST" "https://api.stitchdata.com
/v2/import/push" \
-H 'Authorization: Bearer [ACCESS_TOKEN]' \
-H 'Content-Type: application/json' \
-d \
'[
{
"client_id":7723,
"table_name":"customers",
"sequence":1565880017,
"data":{
"id":4,
"name":"BMO"
},
"key_names":[
"id"
],
"action":"upsert"
},
{
"client_id":7723,
"table_name":"orders",
"sequence":1565838645,
"data":{
"order_id":561,
"customer_id":4
},
"key_names":[
"order_id"
],
"action":"upsert"
}
]'
Responses for POST /v2/import/push
{
"status": "OK",
"message": "Batch Accepted!"
}
{
"status": "Accepted",
"message": "The batch is queued to be processed."
}
Code | Condition | Response body |
400 |
Request body is not an array |
|
400 |
Request body is malformed |
|
401 |
Base URL doesn’t match account region |
|
401 |
|
|
401 |
Integration is paused or has been deleted |
|
403 |
|
|
405 |
Unsupported method |
|
413 |
Request body exceeds 20MB |
|
415 |
Unsupported content type |
|
422 |
Multiple client IDs in request |
|
422 |
Required argument is missing or blank |
|
422 |
Required argument is incorrectly typed |
|
422 |
|
|
422 |
|
|
422 |
Key values in |
|
422 |
Key names not provided |
|
422 |
String values in key fields cannot exceed 1,024 characters |
|
Data Structures
OBJECT | Batch Status |
A Batch Status object provides information about the validation and acceptance status of a batch of data in a request body. Note: This object is only returned if the request body complies with the endpoint’s requirements. |
OBJECT | Error |
An Error object provides information about the reason a request resulted in an error response from the Import API. |
OBJECT | Error Reason |
Contained in an Error object, the Error Reason object contains additional details about the reason a request resulted in an error response. |
OBJECT | Message |
A Message object contains information about a record to be upserted into a table. |
OBJECT | Schema |
A Schema object contains a valid JSON schema describing the record(s) in a Message object’s Refer to the JSON schema docs for more info about JSON schemas. |
The Batch Status object
A Batch Status object provides information about the validation and acceptance status of a batch of data in a request body. Note: This object is only returned if the request body complies with the endpoint’s requirements.
status
STRING |
The batch status. Possible values are: |
message
STRING |
A message describing the current status of the batch. |
Example object
{
"status": "OK",
"message": "Batch is valid!"
}
{
"status": "OK",
"message": "Batch Accepted!"
}
{
"status": "Accepted",
"message": "The batch is queued to be processed."
}
The Error Reason object
Contained in an Error object, the Error Reason object contains additional details about the reason a request resulted in an error response.
reason
STRING, OBJECT |
A string or an object describing the reason for the error. When an object, the structure of this object is For example: |
Example object
{
"status": "ERROR",
"error": "Request cannot be processed; see errors.",
"errors": [
{
"reason": "The batch contains data points for multiple clients. Only client_id <CLIENT_ID> is allowed"
}
]
}
{
"status": "ERROR",
"error": "Request cannot be processed; see errors.",
"errors": [
{
"reason": {
"data": [
"data must include keys"
]
}
}
]
}
The Error object
An Error object provides information about the reason a request resulted in an error response from the Import API.
status
STRING |
This will always be |
message
STRING |
A message describing the error. |
error
STRING |
The reason for the error. |
errors
ARRAY (ERROR REASON) |
An array of error reason objects that describe the properties causing the error. |
Example object
{
"status": "ERROR",
"error": "Request cannot be processed; see errors.",
"errors": [
{
"reason": {
"data": [
"data must include keys"
]
}
}
]
}
{
"status": "ERROR",
"message": "An array of records is expected"
}
The Message object
A Message object contains information about a record to be upserted into a table.
action
STRING |
This will always be |
sequence
INTEGER |
An integer that tells the Import API the order in which data points in the request body should be considered for loading. This data will be stored in the destination table in the In other Stitch integrations, Stitch uses a Unix epoch (in milliseconds) as the value for this property. Note: This value cannot exceed the maximum of |
data
OBJECT |
The record to be upserted into a table. The record data must conform to the JSON schema contained in the request’s Schema object. |
Example object
{
"action": "upsert",
"sequence": 1574796577000,
"data": {
"id": 1,
"name": "Finn",
"age": 16,
"has_magic": false
}
}
The Schema object
A Schema object contains a valid JSON schema describing the record(s) in a Message object’s data
property.
Refer to the JSON schema docs for more info about JSON schemas.
properties
OBJECT |
The JSON schema that records in the |
Example object
{
"schema":{
"properties":{
"id":{
"type":"integer"
},
"name":{
"type":"string"
},
"age":{
"type":"number"
},
"has_magic":{
"type":"boolean"
}
}
}
}