Simple File API request
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 anx-csvbox-api-key header on all API queries.
Endpoint
Submits a spreadsheet file.Headers
Request body
The
public_file_url must respond to a HEAD request within 5 seconds, or the API returns 422 with The file URL could not be accessed. If the URL path has no file extension, the file type is resolved from the Content-Type the URL returns.
Response
200 OK: File submitted.200 OK
env_nameis theenvironment.env_nameyou sent, ordefaultwhen none was sent.pdf_metacontains the document metadata fields extracted from a PDF, DOCX, or image file. It is an empty object for spreadsheet files.
Document and image files
Besides CSV, XLS, and XLSX, the File API accepts PDF, DOC/DOCX, and image (JPG, JPEG, PNG) files when the sheet has AI Document Import enabled for that file type.- Only the first table found in the file is imported, since no user is present to choose a table.
- Each page processed consumes AI document pages from your account.
- If no table is found, the API returns
422withNo table data found in the file.
Example request
Direct file upload
As an alternative to providing a public file URL, you can upload the file contents directly. Send the request asmultipart/form-data with two parts instead of a JSON body.
Request body
Send the file with the
multipart/form-data content type. If the file part is missing, the API returns 422.Example request
cURL
Rate limits
The REST File API allows 30 requests per minute for each combination of client IP address and API key. The count resets at the end of each one-minute window. Past the limit, the API returns a429 Too Many Requests error.
Responses include these headers:
A
429 response also includes:
Status and error codes
All API queries return HTTP status codes that tell you more about the response.401 Unauthorized
The client doesn’t have the correct authentication credentials.402 Import Limit Reached
The monthly import limit for the account plan is reached. Upgrade the plan to increase the import limit.402 is also returned when the account has run out of AI document pages:
404 Not Found
The referenced sheet was not found.415 Unsupported Media Type
TheContent-Type header doesn’t match the request.
Content-Type must be multipart/form-data.
422 Unprocessable File
The request body or the file can’t be processed.422 messages include:
When a field in the
import object fails validation, the response also includes validation_errors, keyed by field:
429 Too Many Requests
The client has exceeded the rate limit.5xx errors
An internal error occurred in CSVbox. Report such errors to our team.Options
The following additional configuration options are available with the File API.max_rows
- Type: Integer
- Default: Null
- Description: The maximum number of rows to import.
has_header
- Type: Boolean
- Default:
1 - Description: Specify whether the file contains a header row. Acceptable values are
0(no header) and1(has a header row). The first row is treated as a header unless you send0.
auto_map
- Type: Boolean
- Default:
false - Description: Enable automatic column mapping in cases where an exact match is not found.
target_file_name
- Type: String
- Default: Null
- Description: The name of the file (or Google Sheets tab) written to a file-based destination such as Amazon S3, Google Cloud Storage, Azure Blob Storage, FTP, GitHub, or Google Sheets. If not set, a name based on the import ID is used.

