Execute Query
POST https://%7B%7Bvault_uri%7D%7D.vault.skyflowapis.com/v1/vaults/{vaultID}/queryContent-Type: application/jsonReturns records for a valid SQL query. This endpoint \Can return redacted record values.Supports only the SELECT command.Returns a maximum of 25 records. To return additional records, perform another query using the OFFSET keyword.Can’t modify the vault or perform transactions.Can’t return tokens.Can’t return file download or render URLs.Doesn’t support the WHERE keyword with columns using transient tokenization.Doesn’t support ? conditional for columns with column-level encryption disabled.\
Authentication
Section titled “Authentication”Authorizationheader (bearer token, required) — Access token, prefixed byBearer.
Servers
Section titled “Servers”https://%7B%7Bvault_uri%7D%7D.vault.skyflowapis.com(Production, default)https://%7B%7Bvault_uri%7D%7D.vault.skyflowapis-preview.com(Sandbox)
Request
Section titled “Request”Path parameters
Section titled “Path parameters”vaultID(string, required) — ID of the vault.
Body (application/json)
Section titled “Body (application/json)”This endpoint expects an object.
query(string, required) — The SQL query to execute.Supported commands: SELECT Supported operators: > < = AND OR NOT LIKE ILIKE NULL NOT NULL Supported keywords: FROM JOIN INNER JOIN LEFT OUTER JOIN LEFT JOIN RIGHT OUTER JOIN RIGHT JOIN FULL OUTER JOIN FULL JOIN OFFSET LIMIT WHERE Supported functions: AVG() SUM() COUNT() MIN() MAX() REDACTION()
Response
Section titled “Response”OK
records(list of object, optional) — Records returned by the query.fields(map from string to any, optional) — Fields and values for the record. For example,{'field_1':'value_1', 'field_2':'value_2'}.tokens(map from string to any, optional) — Fields and tokens for the record. For example,{'field_1':'token_1', 'field_2':'token_2'}.
Errors
Section titled “Errors”400 Bad Request Error
Section titled “400 Bad Request Error”Returned when the request is invalid or cannot be served.
error(object, required)grpc_code(integer, required) — gRPC status codes. See https://grpc.io/docs/guides/status-codes.http_code(integer, required) — HTTP status codes. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status.http_status(string, required)message(string, required)details(list of map from string to any, optional)
401 Unauthorized Error
Section titled “401 Unauthorized Error”Returned when the request is unauthorized.
error(object, required)grpc_code(integer, required) — gRPC status codes. See https://grpc.io/docs/guides/status-codes.http_code(integer, required) — HTTP status codes. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status.http_status(string, required)message(string, required)details(list of map from string to any, optional)
422 Unprocessable Entity Error
Section titled “422 Unprocessable Entity Error”Returned when the request is well-formed but contains semantic errors that prevent it from being processed.
error(object, required)grpc_code(integer, required) — gRPC status codes. See https://grpc.io/docs/guides/status-codes.http_code(integer, required) — HTTP status codes. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status.http_status(string, required)message(string, required)details(list of map from string to any, optional)
500 Internal Server Error
Section titled “500 Internal Server Error”An unexpected error response.
error(object, required)grpc_code(integer, required) — gRPC status codes. See https://grpc.io/docs/guides/status-codes.http_code(integer, required) — HTTP status codes. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status.http_status(string, required)message(string, required)details(list of map from string to any, optional)
Examples
Section titled “Examples”Request
{ "query": "select * from opportunities where id=\"01010000ade21cded569d43944544ec6\""}Response
{ "records": [ { "fields": { "Estimated Value": 10000, "Expected Close Date": "2017-07-12", "Opportunity Name": "BPS Pilot", "Owner": { "email": "kat+collab15@skyflow.com", "id": "usrijG9SC4EQlq5cm", "name": "Jess Patel" }, "Priority": "Medium", "Proposal Deadline": "2017-06-14", "Status": "Qualification" } }, { "fields": { "Estimated Value": 24791, "Expected Close Date": "2017-07-07", "Opportunity Name": "BPS second use case", "Owner": { "email": "kat+collab36@skyflow.com", "id": "usrGqHsNLhH41Q91M", "name": "Sandy Hagen" }, "Priority": "Very Low Deprioritize", "Status": "Proposal" } } ]}SDK Code
import requests
url = "https://{{vault_uri}}.vault.skyflowapis.com/v1/vaults/vaultID/query"
payload = { "query": "select * from opportunities where id=\"01010000ade21cded569d43944544ec6\"" }headers = { "Authorization": "Bearer <token>", "Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())const url = 'https://{{vault_uri}}.vault.skyflowapis.com/v1/vaults/vaultID/query';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"query":"select * from opportunities where id=\"01010000ade21cded569d43944544ec6\""}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://{{vault_uri}}.vault.skyflowapis.com/v1/vaults/vaultID/query"
payload := strings.NewReader("{\n \"query\": \"select * from opportunities where id=\\\"01010000ade21cded569d43944544ec6\\\"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}require 'uri'require 'net/http'
url = URI("https://{{vault_uri}}.vault.skyflowapis.com/v1/vaults/vaultID/query")
http = Net::HTTP.new(url.host, url.port)http.use_ssl = true
request = Net::HTTP::Post.new(url)request["Authorization"] = 'Bearer <token>'request["Content-Type"] = 'application/json'request.body = "{\n \"query\": \"select * from opportunities where id=\\\"01010000ade21cded569d43944544ec6\\\"\"\n}"
response = http.request(request)puts response.read_bodyimport com.mashape.unirest.http.HttpResponse;import com.mashape.unirest.http.Unirest;
HttpResponse<String> response = Unirest.post("https://{{vault_uri}}.vault.skyflowapis.com/v1/vaults/vaultID/query") .header("Authorization", "Bearer <token>") .header("Content-Type", "application/json") .body("{\n \"query\": \"select * from opportunities where id=\\\"01010000ade21cded569d43944544ec6\\\"\"\n}") .asString();<?phprequire_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://{{vault_uri}}.vault.skyflowapis.com/v1/vaults/vaultID/query', [ 'body' => '{ "query": "select * from opportunities where id=\\"01010000ade21cded569d43944544ec6\\""}', 'headers' => [ 'Authorization' => 'Bearer <token>', 'Content-Type' => 'application/json', ],]);
echo $response->getBody();using RestSharp;
var client = new RestClient("https://{{vault_uri}}.vault.skyflowapis.com/v1/vaults/vaultID/query");var request = new RestRequest(Method.POST);request.AddHeader("Authorization", "Bearer <token>");request.AddHeader("Content-Type", "application/json");request.AddParameter("application/json", "{\n \"query\": \"select * from opportunities where id=\\\"01010000ade21cded569d43944544ec6\\\"\"\n}", ParameterType.RequestBody);IRestResponse response = client.Execute(request);import Foundation
let headers = [ "Authorization": "Bearer <token>", "Content-Type": "application/json"]let parameters = ["query": "select * from opportunities where id=\"01010000ade21cded569d43944544ec6\""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://{{vault_uri}}.vault.skyflowapis.com/v1/vaults/vaultID/query")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)request.httpMethod = "POST"request.allHTTPHeaderFields = headersrequest.httpBody = postData as Data
let session = URLSession.sharedlet dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) }})
dataTask.resume()