Monica
Log in
API v1
v1
View as Markdown

List exports

GET QUERY /api/v1/exports

List the exports of the account, the newest first, including the ones that failed or expired.

This endpoint answers GET and QUERY alike, and both return the same answer. GET sends the parameters in the address, QUERY in the request body. How QUERY works.

Query parameters

Path parameters go in the address. GET sends the others in the address too, QUERY sends them as JSON in the request body. Anything not listed here is ignored.

page integer Optional default: 1

Which page to answer with.

per_page integer Optional default: 25

How many records one page holds, between 1 and 100. A number outside the range is brought back into it rather than refused.

Returns

A page of export objects, the newest first.

data array

The exports on this page. An empty list rather than an error when there are none.

data[] object

One export.

data[].type string

Always account_export. It names the kind of record, so a caller holding several kinds can tell them apart without looking at where they came from.

data[].id string

The id of this record, as a string even when it reads as a number. It is what every endpoint naming this record takes.

data[].attributes object

Everything the record holds.

data[].attributes.status string

Where the export stands: preparing, ready, failed or expired. The file is prepared in the background, and an email says when it is ready.

data[].attributes.vaults array

The vaults the file holds.

data[].attributes.vaults[] uuid

The id of one of those vaults. A vault deleted since the export was asked for is left out.

data[].attributes.size_in_bytes integer

The size of the file in bytes, or null until it is ready.

data[].attributes.ready_at timestamp

When the file was complete, as a count of seconds since 1970, or null until it is ready.

data[].attributes.expires_at timestamp

When the file is deleted, seven days after it was ready unless a newer export of the account is ready first, as a count of seconds since 1970, or null until it is ready. From that moment it can no longer be downloaded.

data[].attributes.created_at timestamp

When the export was asked for, as a count of seconds since 1970.

data[].links object

Where to find this record.

data[].links.self string

The absolute address this record is read from.

meta object

Where you are in the collection.

meta.page integer

The page this is, counting from 1.

meta.per_page integer

How many one page holds, which is the size that was asked for once it has been brought into the allowed range.

meta.total integer

How many exports there are in all, not how many are on this page.

Status codes

Every code the API answers with, and what the body holds when it does.

Code When Body
422 Unprocessable Content With QUERY, a parameter was sent both in the address and in the body. A message, and an errors object naming each parameter sent twice.

Rate limit

Sixty requests per minute, per user, shared by every key and device. Every answer carries the budget left in X-RateLimit-Remaining.

GET
curl https://friends.ban.is/api/v1/exports?page=2&per_page=10 \
-H "Authorization: Bearer $MONICA_TOKEN"
const response = await fetch('https://friends.ban.is/api/v1/exports?page=2&per_page=10', {
headers: { Authorization: `Bearer ${token}` },
})
const data = await response.json()
$response = Http::withToken($token)->get('https://friends.ban.is/api/v1/exports?page=2&per_page=10');
QUERY
curl https://friends.ban.is/api/v1/exports \
-X QUERY \
-H "Authorization: Bearer $MONICA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"page": 2,
"per_page": 10
}'
const response = await fetch('https://friends.ban.is/api/v1/exports', {
method: 'QUERY',
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
page: 2,
per_page: 10,
}),
})
const data = await response.json()
$response = Http::withToken($token)->query('https://friends.ban.is/api/v1/exports', [
'page' => 2,
'per_page' => 10,
]);
Response 200
{
"data": [
{
"type": "account_export",
"id": "e7a1d9c4-3b6f-4f2a-8d15-6c0b9e2a4f73",
"attributes": {
"status": "ready",
"vaults": [
"9b2d4f6a-1e3c-4a5b-8c7d-0f1e2d3c4b5a",
"c4e6a8b0-2d4f-4a6b-9c8d-1e3f5a7b9c0d"
],
"size_in_bytes": 18734522,
"ready_at": 1792310700,
"expires_at": 1792915500,
"created_at": 1792310400
},
"links": {
"self": "https://friends.ban.is/api/v1/exports/e7a1d9c4-3b6f-4f2a-8d15-6c0b9e2a4f73"
}
}
],
"meta": {
"page": 1,
"per_page": 25,
"total": 1
}
}

Keys act as you, with exactly the access you have. Make one per integration so you can revoke it alone.