Access the Data API

SingleStore's Data API can be accessed using Basic and Bearer Authentication methods at protocol://hostname:port/api/version/ where:

  • protocol is HTTPS/HTTP; protocol must be HTTPS when SSL is enabled

  • hostname represents the host where SingleStore is running

  • port is the secure WebSocket proxy port configured

  • version is the Data API version; currently v1 and v2 are supported

To access SingleStore’s Data API via Basic Authentication, you need to provide your SingleStore account credentials (username and password) in each HTTP request. The credentials must be passed as a Base-64 encoded username:password string in the Authorization header in the HTTP client. For example, the Authorization header of demo:Afu4XjzB1ns would appear as follows.

Authorization: Basic ZGVtbzpBZnU0WGp6QjFucw==

Using an HTTP client such as cURL, you can either pass your credentials as parameters in the --user or the -u option or add them before the hostname in the HTTP request, as shown below.

curl -u "username:password" https://hostname:port/api/v2/exec
curl https://username:password@hostname:port/api/v2/exec

cURL will then encode the username:password string using Base-64 and insert it in an Authorization header before sending the HTTP request to the server.

Here's an example of using Bearer Authentication to access the Data API via cURL:

curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.C1um3oUNP4178sTG9WahtfZxN0-GqnYTPsbx-zhH9Qk" https://hostname:port/api/v2/exec

You can use API development tools and libraries to send Data API requests and handle responses. You can also test-run the Data API at the Linux command line. For more information on how to use the Data API, refer to Data API Endpoint Reference.

Last modified: May 9, 2023

Was this article helpful?

Verification instructions

Note: You must install cosign to verify the authenticity of the SingleStore file.

Use the following steps to verify the authenticity of singlestoredb-server, singlestoredb-toolbox, singlestoredb-studio, and singlestore-client SingleStore files that have been downloaded.

You may perform the following steps on any computer that can run cosign, such as the main deployment host of the cluster.

  1. (Optional) Run the following command to view the associated signature files.

    curl undefined
  2. Download the signature file from the SingleStore release server.

    • Option 1: Click the Download Signature button next to the SingleStore file.

    • Option 2: Copy and paste the following URL into the address bar of your browser and save the signature file.

    • Option 3: Run the following command to download the signature file.

      curl -O undefined
  3. After the signature file has been downloaded, run the following command to verify the authenticity of the SingleStore file.

    echo -n undefined |
    cosign verify-blob --certificate-oidc-issuer https://oidc.eks.us-east-1.amazonaws.com/id/CCDCDBA1379A5596AB5B2E46DCA385BC \
    --certificate-identity https://kubernetes.io/namespaces/freya-production/serviceaccounts/job-worker \
    --bundle undefined \
    --new-bundle-format -
    Verified OK