XTDB API

Download OpenAPI specification:Download

DB

Get the resolved db-basis for the given valid-time/transaction

query Parameters
valid-time
string
tx-time
string
tx-id
integer <int64>
await-tx-id
integer <int64>
await-tx-time
string
await-tx-timeout
integer <int64>

Responses

Response samples

Content type
{
  • "txId": 4,
  • "txTime": "2020-11-04T15:43:12Z",
  • "validTime": "2020-11-05T17:19:39Z"
}

Status

Get status information from the node

Responses

Response samples

Content type
{
  • "kvStore": "xtdb.rocksdb.RocksKv",
  • "estimateNumKeys": 3,
  • "revision": null,
  • "consumerState": null,
  • "indexVersion": 13,
  • "version": "1.24.3",
  • "size": 132665
}

Entity

Get information about a particular entity

query Parameters
sort-order
string
start-tx-id
integer <int64>
valid-time
string
end-tx-id
integer <int64>
link-entities?
boolean
await-tx-timeout
integer <int64>
eid-json
string

JSON formatted entity ID

with-corrections
boolean
start-tx-time
string
eid-edn
string

EDN formatted entity ID

start-valid-time
string
tx-time
string
await-tx-time
string
end-tx-time
string
with-docs
boolean
history
boolean
await-tx-id
integer <int64>
eid
string
tx-id
integer <int64>
end-valid-time
string

Responses

Response samples

Content type
{
  • "age": 20,
  • "xt/id": "hello"
}

Query

Perform a datalog query

query Parameters
in-args-json
Array of any
Example: in-args-json=["foo",123]

JSON formatted :in binding arguments

valid-time
string
link-entities?
boolean
await-tx-timeout
integer <int64>
in-args-edn
Array of any
Example: in-args-edn=["foo" 123]

EDN formatted :in binding arguments

tx-time
string
await-tx-time
string
query-edn
string
Example: query-edn={:find [e], :where [[e :xt/id _]], :limit 100}

EDN formatted Datalog query

await-tx-id
integer <int64>
tx-id
integer <int64>

Responses

Response samples

Content type
[
  • [
    ],
  • [
    ],
  • [
    ]
]

Query

Perform a datalog query

query Parameters
in-args-json
Array of any
Example: in-args-json=["foo",123]

JSON formatted :in binding arguments

valid-time
string
link-entities?
boolean
await-tx-timeout
integer <int64>
in-args-edn
Array of any
Example: in-args-edn=["foo" 123]

EDN formatted :in binding arguments

tx-time
string
await-tx-time
string
query-edn
string
Example: query-edn={:find [e], :where [[e :xt/id _]], :limit 100}

EDN formatted Datalog query

await-tx-id
integer <int64>
tx-id
integer <int64>
Request Body schema:
query
required
any (xtdb.http-server.query/query)

Datalog query

in-args
Array of any (xtdb.http-server.query/in-args)

:in binding arguments

Responses

Request samples

Content type
{
  • "query": {
    },
  • "in-args": [
    ]
}

Response samples

Content type
[
  • [
    ],
  • [
    ],
  • [
    ]
]

Entity Tx

Get transactional information an particular entity

query Parameters
valid-time
string
await-tx-timeout
integer <int64>
eid-json
required
string

JSON formatted entity ID

eid-edn
required
string

EDN formatted entity ID

tx-time
string
await-tx-time
string
await-tx-id
integer <int64>
eid
required
string
tx-id
integer <int64>

Responses

Response samples

Content type
{
  • "txId": 5,
  • "contentHash": "99747f80357c336ee5efd073c878313bf85b07f9",
  • "txTime": "2020-10-16T14:29:35Z",
  • "id": "5aeebab117b892fa42002146e4c62be676bc4621",
  • "validTime": "2020-10-16T14:29:35Z"
}

Attribute Stats

Get frequencies of indexed attributes

Responses

Response samples

Content type
{
  • "first-name": 2,
  • "age": 1,
  • "lastName": 1,
  • "last-name": 2,
  • "firstName": 1,
  • "xt/id": 3
}

Sync

Wait until the Kafka consumer’s lag is back to 0

query Parameters
tx-time
string
timeout
integer <int64>

Responses

Response samples

Content type
{
  • "txTime": "2020-10-16T14:29:35Z"
}

Await Tx

Wait until the node has indexed a transaction at or past the supplied tx-id

query Parameters
tx-id
required
integer <int64>
timeout
integer <int64>

Responses

Response samples

Content type
{
  • "txId": 5,
  • "txTime": "2020-10-16T14:29:35Z"
}

Await Tx Time

Wait until the node has indexed a transaction that is past the supplied tx-time

query Parameters
tx-time
required
string
timeout
integer <int64>

Responses

Response samples

Content type
{
  • "txTime": "2020-10-16T14:29:35Z"
}

Tx Log

Get a list of all transactions

query Parameters
with-ops?
boolean
after-tx-id
integer <int64>
await-tx-id
integer <int64>
await-tx-time
string
await-tx-timeout
integer <int64>

Responses

Response samples

Content type
[
  • {
    },
  • {
    }
]

Submit Tx

Takes a vector of transactions - Writes to the node

Request Body schema:
object (xtdb.api/submit-tx-opts)
tx-ops
required
Array of any

Responses

Request samples

Content type
{
  • "xtdb.api/submit-tx-opts": {
    },
  • "tx-ops": [
    ]
}

Response samples

Content type
{
  • "txId": 6,
  • "txTime": "2020-10-19T09:21:29Z"
}

Tx Committed

Checks if a submitted tx was successfully committed

query Parameters
tx-id
required
integer <int64>
await-tx-id
integer <int64>
await-tx-time
string
await-tx-timeout
integer <int64>

Responses

Response samples

Content type
{
  • "txCommitted?": true
}

Latest Completed Tx

Get the latest transaction to have been indexed by this node

query Parameters
await-tx-id
integer <int64>
await-tx-time
string
await-tx-timeout
integer <int64>

Responses

Response samples

Content type
{
  • "txId": 5,
  • "txTime": "2020-10-16T14:29:35Z"
}

Latest Submitted Tx

Get the latest transaction to have been submitted to this cluster

Responses

Response samples

Content type
{
  • "txId": 5
}

Active Queries

Get a list of currently running queries

Responses

Response samples

Content type
[
  • {
    }
]

Recent Queries

Get a list of recently completed/failed queries

Responses

Response samples

Content type
[
  • {
    }
]

Slowest Queries

Get a list of slowest completed/failed queries ran on the node

Responses

Response samples

Content type
[
  • {
    }
]