Skip to main content

API Reference

Response Format

All responses from the Snack Prompt API follow a standard structure. Below is the typical response format for successful requests:

{
"code": number,
"meta": {
"version": string,
"is_authenticated": boolean
},
"response": any
}
  • code: The HTTP status code indicating the result of the request.
  • meta: Meta-information about the response.
    • version: The API version of the response.
    • is_authenticated: A boolean value indicating whether the request was successfully authenticated.
  • response: The actual data returned by the API. This can vary depending on the endpoint.

Error Format

In case of errors, the response will follow a similar structure, but with the error_message field included. Here's an example of an error response:

{
"code": number,
"meta": {
"version": string,
"is_authenticated": boolean
},
"error_message": string
}
  • code: The HTTP status code indicating the type of error.
  • meta: Meta-information about the response, similar to the success response.
  • error_message: A descriptive error message providing details on why the request failed.

Note: Be sure to handle errors properly in your code, especially authentication errors, to ensure smooth integration with the Snack Prompt API.