The File API lets you accept spreadsheet files programmatically. It is an alternative to the users uploading the files manually, via the Csvbox importer. Files submitted via the REST File API will then be pushed to the data destination as set up in the Csvbox dashboard.
After the data is pushed to the destination, the import complete webhook can be triggered as configured in the sheet settings.
The spreadsheet data submitted via File API will not be validated based on the rules configured in the sheet settings. The importer will attempt to push the data directly to the destination in the raw form.
The columns in the file should be arranged in the same order as configured in the sheet template.
Authentication
All REST File API queries require a valid API key. You can find the API key on the Accounts page in the Csvbox dashboard.
Include your API key as a x-csvbox-api-key header on all API queries.
Endpoint
Submits a spreadsheet file
POSThttps://api.csvbox.io/1.1/file
Headers
Name
Type
Description
x-csvbox-api-key*
String
API Key
content-type*
String
application/json
Request Body
Name
Type
Description
import.public_file_url*
String
The public URL of the spreadsheet that is to be submitted.
import.file_sheet_name
String
Worksheet name in case of a file having multiple tabs.
import.sheet_license_key*
String
Sheet license key
import*
Object
Import file data
import.user
Object
import.options
Object
import.dynamic_columns
Object
HTTP/1.1200OK{"import_id": 79418895,"license_key":"jhkjsahjkhkjhkjhkjasdasd","sheet_id": 575,"sheet_name": "Products Import","destination_type": "webhook","import_starttime": 87987897897,"custom_fields": {"user_id":"1a2b3c4d5e6f","team_id":"sales2","permissionLevel":"admin" },"options": {"max_rows":150,"has_header":1 },"dynamic_olumns": [ {"column_name":"qualification","display_label":"Highest Qualification","info_hint":"What is your highest educational degree","matching_keywords":"degree, education","type":"text","validators": {"min_length":2,"max_length":50 },"required":true }, {"column_name":"experience","display_label":"Work Experience","info_hint":"Years of work experience","matching_keywords":"","type":"number","validators": {"min_value":0,"max_value":100 },"required":false } ]}
As an alternative to providing the public file URL to the FILE API, you also have the option to upload the file contents directly. Instead of using the import.public_file_url use the following body param:
Request Body
Name
Type
Description
import.file*
String
The contents of the file to be imported.
The file should be sent with the multipart/form-data content-type.
The REST Admin API supports a limit of 30 requests per minute. This allotment replenishes at a rate of 2 requests per second.
Past the limit, the API will return a 429 Too Many Requests error.
All REST API responses include the x-csvbox-file-api-call-limit header, which shows how many requests the client has made, and the total number allowed per minute.
A 429 response will also include a retry-after header with the number of seconds to wait until retrying your query.
Status and error codes
All API queries return HTTP status codes that can tell you more about the response.
401 Unauthorized
The client doesn’t have the correct authentication credentials.
HTTP/1.1 401 Unauthorized
{
"errors": "[API] Invalid API key or access token."
}
402 Import Limit Reached
The monthly import limit based on the account plan is reached. You can upgrade the plan to increase the import limit.
HTTP/1.1 402 Import Limit Reached
{
"errors": "The account has exceeded the import limit."
}
403 Forbidden
The server is refusing to respond. This is typically caused if File API is disabled.
HTTP/1.1 403 Access Denied
{
"errors": "User does not have access."
}
404 Not Found
The referenced sheet was not found.
HTTP/1.1 404 Not Found
{
"errors": "Sheet not found."
}
422 Unprocessable File
The request body contains file errors. This is typically caused by incorrect file path, invalid file permissions, incorrect file format, corrupt file, file size too large, etc.