The Stax.ai Developer API allows you to access your Stax.ai account and leverage the powerful backend AI technology that makes Stax.ai possible. The API gives you access to your Stax.ai team account - or the team account for which the API key was provided. It provides access to the documents within the Stax.ai account, allows you to upload or route new documents into your team, and retrieve extracted data from these documents. You can also use the developer API to perform searches through your documents, manage team accounts, etc.
Interesting Fact
This API is actually what the Stax.ai platform UI uses to communicate with the database (but with a different authentication scheme)!
Request and Response Structure
All requests made to the Stax.ai Developer API must be made using secured (HTTPS) requests to the API URL: https://api.stax.ai
All requests must include an authorization header with your Stax.ai account email address and developer API key. Read more about Stax.ai Developer API authentication.
Requests to the Stax.ai Developer API are either GET or POST requests only.
The request response will always have a 200 HTTP Status Code (OK) IF the request made it to the API and the API processed anything from the request.
Response HTTP Status Codes:
- 200 - The request was received by the API, processed and returned. An error message is sent back if the error was caught by the API.
- 400 - The request was of a bad (un-parse-able) format.
- 404 - The requested endpoint does not exist in the API.
- 500 - There was an internal server error and was not caught.
- 503 - An API instance is not currently available to process your request.
- 504 - Gateway timeout - your request took too long to process.
You should never receive 500, 503, and 504 errors and if you do, it indicates a slight hiccup in the Stax.ai Developer API. Please let us know if you receive one of these errors as soon as possible by sending any email to [email protected].
As mentioned earlier, a 200 HTTP Status Code (OK) is returned even if there are errors in your request or processing as long as the error is caught and handled by the API. The JSON response body contains further information about any errors.
All responses will have a "success" variable which is returned true if you made a successful request and the API successfully executed it.
If the success variable is false, the request failed. An error variable is also returned with a String description of the error.
Any data requested (or update result) from the API is appended to the response body.
{
"success": Boolean, // true or false
"error": String, // Error message if !success, else undefined
"dataKey1": { }, // Any response data
"dataKey2": { } // Any more response data
}
Additionally, an authError parameter is added and set to true if there was an authentication error.
"CRUD" API Functionality
The Stax.ai API is designed as a "CRUD" API with REST-like functionality. CRUD stands for: Create, Retrieve, Update, Delete. Additionally, each resource has other functional endpoints that trigger various actions.
The API has a set of resources at the top level, with CRUD functionality plus other helpful functions for each model.
Using the API the serve multiple clients
If you plan to use the developer API to integrate Stax.ai functionality within your software, you may use your Stax.ai account as the single account for all of your clients documents and AI processing. Stax.ai provides fields which you can use to track different clients by unique IDs.
This method allows you to use a single developer key and manage all of your clients integrations together.