Ask AI

Querying EdgeDB Cloud over HTTP and GraphQL

Using EdgeDB Cloud via HTTP and GraphQL works the same as using any other EdgeDB instance. The two differences are in how to discover your instance’s URL and authentication.

EdgeDB Cloud can expose an HTTP endpoint for EdgeQL queries. Since HTTP is a stateless protocol, no DDL or transaction commands, can be executed using this endpoint. Only one query per request can be executed.

In order to set up HTTP access to the database add the following to the schema:

using extension edgeql_http;

Then create a new migration and apply it using edgedb migration create and edgedb migrate, respectively.

Your instance can now receive EdgeQL queries over HTTP at https://<host>:<port>/branch/<branch-name>/edgeql.

To determine the URL of an EdgeDB Cloud instance, find the host by running edgedb instance credentials -I <org-name>/<instance-name>. Use the host and port from that table in the URL format above this note. Change the protocol to https since EdgeDB Cloud instances are secured with TLS.

Your instance can now receive EdgeQL queries over HTTP at https://<hostname>:<port>/branch/<branch-name>/edgeql.

To authenticate to your EdgeDB Cloud instance, first create a secret key using the EdgeDB Cloud UI or edgedb cloud secretkey create. Use the secret key as your token with the bearer authentication method. Here is an example showing how you might send the query select Person {*}; using cURL:

curl -G https://<cloud-instance-host>:<cloud-instance-port>/branch/main/edgeql \
 -H "Authorization: Bearer <secret-key> \
 --data-urlencode "query=select Person {*};"

Usage of the HTTP and GraphQL APIs is identical on an EdgeDB Cloud instance. Reference the HTTP and GraphQL documentation for more information.