Fauna Account API
Download OpenAPI specification:Download
The Fauna Account HTTP API lets you manage features of a Fauna account. For example, you can use the API to:
- Request and download Fauna Logs
- Manage OAuth client apps for integrations
Account API endpoints use https://account.fauna.com
as the base URL.
For example, the full URL for the /api/v1/logs
(Request Query
Logs) is
https://account.fauna.com/api/v1/logs
.
Fauna routes requests to accounts based on the account key secret used for authentication.
You authenticate with the Account API using an account key's secret. Account keys are different from keys used for query requests.
Create an account key
You can create an account key in the Fauna Dashboard.
Log in to the Fauna Dashboard and click Account in the left navigation.
Click Account Keys.
Click Create Key.
Enter a Name and an optional TTL. The TTL is the number of days until the account key expires.
Click Create.
Copy the Key Secret.
Use the Fauna Logs endpoints to programmatically request and fetch query logs. You can use Fauna Logs to monitor the performance of your Fauna databases and diagnose issues.
For an overview of the API workflow and an example implementation, see Access Fauna Logs using the HTTP API.
Request Fauna Logs endpoint
Requests a set of Fauna Logs.
The operation is asynchronous. The response contains a request ID. To check the status of the request, pass the ID to the Get Fauna Logs Request Status endpoint.
Authorizations:
query Parameters
type required | string Example: type=query Type of logs to retrieve. Valid value is |
header Parameters
Authorization required | string Example: Bearer <ACCOUNT_KEY_SECRET> A Fauna account key's secret, passed as a bearer token. Account keys are different from keys used for query requests. See Authentication. |
Request Body schema: application/jsonrequired
database | string Path, including the Region Group and hierarchy, for the database to
get logs for. Separate path components using Omit this parameter to get logs for all databases for a region group. |
region_group | string Region Group to get logs for. Accepted values are If requesting logs for a specific database, omit this parameter. If
you provide the |
time_start required | string <date-time> ISO 8601 timestamp for the log start time (inclusive). Can not be:
|
time_end required | string <date-time> ISO 8601 timestamp for the log end time (exclusive). |
idempotency_token | string <uuid> Optional idempotency token. If the same |
Responses
Request samples
- Payload
- curl
{- "database": "us-std/production/customers",
- "region_group": "us-std",
- "time_start": "2099-09-19T20:42:16.828Z",
- "time_end": "2019-08-24T14:15:22Z",
- "idempotency_token": "813831FE-8F2A-423F-9467-55551F784250"
}
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
- 500
{- "request_id": "123456",
- "database": "us-std/production/customers",
- "region_group": "us-std",
- "state": "Complete",
- "time_start": "2099-09-19T20:42:16.828Z",
- "time_end": "2099-09-19T20:42:16.828Z",
- "updated_at": "2099-09-19T20:42:16.828Z",
- "version": 0
}
Get Fauna Logs Request Status endpoint
Gets the status of a Fauna Logs request. You can submit a request using the Request Fauna Logs endpoint.
If the request is complete, the response includes a presigned URL for the log file, compressed using gzip. For the log schema, see Log record format.
The presigned URL expires at a time provided in the response. To request a new URL after expiration, use the Create Fauna Logs File URL endpoint.
Authorizations:
path Parameters
request_id required |
query Parameters
type required | string Example: type=query Type of logs to retrieve. Valid value is |
header Parameters
Authorization required | string Example: Bearer <ACCOUNT_KEY_SECRET> A Fauna account key's secret, passed as a bearer token. Account keys are different from keys used for query requests. See Authentication. |
Responses
Request samples
- curl
curl -X GET \ 'https://account.fauna.com/api/v1/logs/123456?type=query' \ -H 'Authorization: Bearer <ACCOUNT_KEY_SECRET>'
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
- 500
{- "request_id": "123456",
- "database": "us-std/production/customers",
- "presigned_url_expiration_time": "2099-09-19T21:42:16.828Z",
- "region_group": "classic",
- "state": "Complete",
- "time_start": "2099-09-19T20:42:16.828Z",
- "time_end": "2099-09-19T20:42:16.828Z",
- "updated_at": "2099-09-19T20:42:16.828Z",
- "version": 0
}
Create Fauna Logs File URL endpoint
Creates a new presigned URL for a log file from a completed log request.
If a Fauna logs request is complete, the Get Fauna Logs Request Status endpoint returns a a presigned URL for the log file. The presigned URL expires at a provided time.
You typically use this endpoint to request a presigned URL after a previous presigned URL expires.
Authorizations:
path Parameters
request_id required | string Example: 123456 Request ID associated with the logs - returned by the /api/v1/logs POST request. |
query Parameters
type required | string Example: type=query Type of logs to retrieve. Valid value is |
header Parameters
Authorization required | string Example: Bearer <ACCOUNT_KEY_SECRET> A Fauna account key's secret, passed as a bearer token. Account keys are different from keys used for query requests. See Authentication. |
Request Body schema: application/jsonoptional
Optional request body for controlling URL creation.
version | integer Optional optimistic lock version of the log. |
Responses
Request samples
- Payload
- curl
{- "version": 1
}
Response samples
- 200
- 400
- 401
- 403
- 404
- 429
- 500
{- "request_id": "123456",
- "database": "us-std/production/customers",
- "region_group": "us-std",
- "state": "Complete",
- "time_start": "2099-09-19T20:42:16.828Z",
- "time_end": "2099-09-19T20:42:16.828Z",
- "updated_at": "2099-09-19T20:42:16.828Z",
- "version": 0
}
List Fauna Log Requests endpoint
Gets a list of log requests for the account.
If a request is complete, the request item includes a presigned URL for the log file and its expiration timestamp.
Authorizations:
query Parameters
type required | string Example: type=query The type of logs to retrieve (e.g. query). |
header Parameters
Authorization required | string Example: Bearer <ACCOUNT_KEY_SECRET> A Fauna account key's secret, passed as a bearer token. Account keys are different from keys used for query requests. See Authentication. |
Request Body schema: application/jsonrequired
Inputs bounding the logs you want to list.
states required | Array of strings (LogState) State of log requests to retrieve. Cannot be empty. Valid values are:
|
next_token | string Pagination token used to retrieve the next page of results. If omitted, the first page is retrieved. |
max_results | integer Maximum number of items to retrieve. Must be |
Responses
Request samples
- Payload
- curl
{- "states": [
- "Complete",
- "Requested"
], - "next_token": "slkdj823knl",
- "max_results": 100
}
Response samples
- 200
- 400
- 401
- 403
- 429
- 500
{- "next_token": "slkdj823knl",
- "results": [
- {
- "request_id": "123456",
- "database": "us-std/production/customers",
- "region_group": "us-std",
- "state": "Complete",
- "time_start": "2099-09-19T20:42:16.828Z",
- "time_end": "2099-09-19T20:42:16.828Z",
- "updated_at": "2099-09-19T20:42:16.828Z",
- "version": 1,
- "presigned_url_expiration_time": "2019-08-24T14:15:22Z"
}
]
}
Some integrations, such as the Cloudflare Worker integration, automatically create an OAuth client app in your Fauna account when you connect them.
You can use the OAuth 2.0 Apps endpoints to manage OAuth apps for your Fauna account. The endpoints mirror the functionality of the Fauna Dashboard's OAuth Apps page.
List OAuth Apps endpoint
List the OAuth apps authorized for your Fauna account.
Authorizations:
query Parameters
next_token | string Example: next_token=slkdj823knl Pagination token used to retrieve the next page of results. |
max_results | integer Example: max_results=100 Maximum number of items to retrieve. Must be |
header Parameters
Authorization required | string Example: Bearer <ACCOUNT_KEY_SECRET> A Fauna account key's secret, passed as a bearer token. Account keys are different from keys used for query requests. See Authentication. |
Responses
Request samples
- curl
curl -X GET \ 'https://account.fauna.com/api/v1/oauth/apps' \ -H 'Authorization: Bearer <ACCOUNT_KEY_SECRET>'
Response samples
- 200
- 400
- 401
- 403
- 429
- 500
{- "next_token": "slkdj823knl",
- "results": [
- {
- "id": "12311231",
- "oauth2_client": "Cloudflare",
- "scope": [
- {
- "id": "list_databases",
- "display_name": "List Databases"
}
], - "created_at": "2022-09-19T20:42:16.828Z"
}
]
}
Delete OAuth App endpoint
Deletes an OAuth app authorized for your Fauna account.
Deleting the app disables the integration. Once deleted, the integration can no longer access your Fauna account.
Authorizations:
path Parameters
id required | string (Id) Example: 12311231 ID of the OAuth app to delete. You can get an ID using the List OAuth Apps endpoint. |
header Parameters
Authorization required | string Example: Bearer <ACCOUNT_KEY_SECRET> A Fauna account key's secret, passed as a bearer token. Account keys are different from keys used for query requests. See Authentication. |
Responses
Request samples
- curl
curl -X DELETE \ 'https://account.fauna.com/api/v1/oauth/apps/{id}' \ -H 'Authorization: Bearer <ACCOUNT_KEY_SECRET>'
Response samples
- 400
- 401
- 403
- 404
- 429
- 500
{- "reason": "Details about the error"
}
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!