POST /api/v2/statements

restsupportedQueries & DML

docs.snowflake.com ↗ · operation SubmitStatement

SQL API

Submits a SQL statement for execution. Submits one or more statements for execution. You can specify that the statement should be executed asynchronously.

Syntax

POST /api/v2/statements

Request body object

PropertyTypeRequired
bindingsobjectoptional
databasestringoptional
parametersobjectoptional
rolestringoptional
schemastringoptional
statementstringoptional
timeoutintegeroptional
warehousestringoptional

Responses

StatusDescriptionSchema
200The statement was executed successfully, and the response includes any data requested.ResultSet
202The execution of the statement is still in progress. Use GET /statements/ and specify the statement handle to check the status of the statement execution.QueryStatus
400Bad Request. The request payload is invalid or malformed. This happens if the application didn't send the correct request payload. The response body may include the error code and message indicating the actual cause. The application must reconstruct the request body for retry.
401Unauthorized. The request is not authorized. This happens if the attached access token is invalid or missing. The response body may include the error code and message indicating the actual cause, e.g., expired, invalid token. The application must obtain a new access token for retry.
403Forbidden. The request is forbidden. This happens if the request is made even if the API is not enabled.
404Not Found. The request endpoint is not valid. This happens if the API endpoint is wrong. For example, if the application hits /api/api/hello which doesn't exist, it will receive this code.
405Method Not Allowed. The request method doesn't match the supported API. This happens, for example, if the application calls the API with GET method but the endpoint accepts only POST. The application must change a method for retry.
408The execution of the statement exceeded the timeout period. The execution of the statement was cancelled.QueryStatus
415The request header Content-Type includes unsupported media type. The API supports application/json only. If none specified, the request payload is taken as JSON, but if any other media type is specified, this error is returned.
422An error occurred when executing the statement. Check the error code and error message for details.QueryFailureStatus
429Limit Exceeded. The number of requests hit the rate limit. The application must slow down the frequency of hitting the API endpoints.
500Internal Server Error. The server hits an unrecoverable system error. The response body may include the error code and message for further guidance. The application owner may need to reach out the customer support.
503Service Unavailable. The request was not processed due to server side timeouts. The application may retry with backoff. The jittered backoff is recommended. https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
504Gateway Timeout. The request was not processed due to server side timeouts. The application may retry with backoff. The jittered backoff is recommended. https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/