Introduction

collections.rest is a free public data library. Each dataset is a typed list of key/value pairs, accessible via a predictable REST URL.

https://collections.rest/api/v1/

No authentication for public datasets

All public datasets are available without an account, API key or auth header. Just fetch the URL.

Output formats

Append an extension to any collection URL. No extension returns JSON.

/api/v1/collection/nato-alphabet.json  → application/json
/api/v1/collection/nato-alphabet.csv   → text/csv; charset=utf-8
/api/v1/collection/nato-alphabet.html  → text/html
/api/v1/collection/nato-alphabet.txt   → text/plain; charset=utf-8
/api/v1/collection/nato-alphabet.yaml  → application/yaml; charset=utf-8
/api/v1/collection/nato-alphabet.xml   → application/xml; charset=utf-8
/api/v1/collection/nato-alphabet.ndjson → application/x-ndjson; charset=utf-8
/api/v1/collection/nato-alphabet.md    → text/markdown; charset=utf-8

YAML (.yaml, not .yml) has the same fields as the JSON: collection, type, count and items with id, key and value. Integers and decimals stay numbers, and strings that YAML would read as something else (such as yes, null or 1e3) are quoted. It works for the daily and single item routes too.

CSV uses a semicolon (;) between key and value, with a key;value header. A field that contains a semicolon, a double quote or a line break is wrapped in double quotes, with quotes inside doubled.

XML is a <collection name type count> element with one <item id key>value</item> per item. The key is an attribute, never an element name, so any key works; characters XML 1.0 cannot carry (control characters other than tab and line breaks) are left out.

NDJSON (.ndjson) has one JSON object per line, {"id":1,"key":"A","value":"Alpha"}, with no header line; numbers stay numbers. Each line ends with a line break, so the body can be streamed line by line.

Markdown (.md) is a | key | value | table. A pipe or a backslash in a value is escaped with a backslash, and a line break becomes <br>, so every item stays one row.

One item by key

Fetch a single item by its key, in any of the formats above. Keys match exactly, so m and M are different keys. URL-encode the key: a slash becomes %2F, a space %20. A key that itself ends in .json, .csv, .html, .txt, .yaml, .xml, .ndjson or .md needs the format added after it. A missing key returns 404.

/api/v1/collection/chemical-elements/key/Fe
/api/v1/collection/chemical-elements/key/Fe.txt
/api/v1/collection/danish-flag-days/key/06-05.json

Value types

Every dataset declares one type. JSON returns values cast to the correct JavaScript type, not as strings.

string
Text, max 250 chars
integer
Whole number
decimal
Floating-point

Endpoints

Public collection access

Read-only access to public collections. No authentication required.

GET/api/v1/collectionsBrowse & search public collections
GET/api/v1/collection/{slug}Fetch all items in a collection
GET/api/v1/collection/{slug}/dailyGet the daily item (rotates every 24h UTC)
GET/api/v1/collection/{slug}/key/{key}Fetch a single item by key (exact match, URL-encode the key)
GET/api/v1/collection/{slug}/{item}Fetch a single item by ID

Authentication

Register, login, and logout. Login returns a Sanctum bearer token.

POST/api/v1/auth/registerRegister a new user
POST/api/v1/auth/loginLogin, returns Sanctum token
DELETE/api/v1/auth/logoutInvalidate current token

User (requires Bearer token)

Manage your own collections, items, and API keys.

GET/api/v1/meCurrent user profile & active plan
GET/api/v1/me/collectionsList own collections
POST/api/v1/me/collectionsCreate a new collection
GET/api/v1/me/collections/{collection}Show a single collection
PUT/api/v1/me/collections/{collection}Update a collection
DELETE/api/v1/me/collections/{collection}Delete a collection
GET/api/v1/me/collections/{collection}/itemsList items in a collection
POST/api/v1/me/collections/{collection}/itemsAdd an item to a collection
POST/api/v1/me/collections/{collection}/items/importImport many items from CSV, JSON or NDJSON (dry_run for a preview)
PUT/api/v1/me/collections/{collection}/items/{item}Update an item
DELETE/api/v1/me/collections/{collection}/items/{item}Delete an item
GET/api/v1/me/collections/{collection}/share-linksList the private share links of a collection
POST/api/v1/me/collections/{collection}/share-linksCreate a private share link (optional expiry)
POST/api/v1/me/collections/{collection}/share-links/{link}/regenerateReplace a share link with a new one
DELETE/api/v1/me/collections/{collection}/share-links/{link}Revoke a share link
GET/api/v1/me/keysList API keys
POST/api/v1/me/keysGenerate a new API key
DELETE/api/v1/me/keys/{key}Revoke an API key

Response format

All JSON responses follow this structure. Values are cast to the declared type.

{
  "collection": "famous-quotes",
  "type": "string",
  "count": 66,
  "items": [
    { "id": 1, "key": "Albert Einstein", "value": "Imagination is more important than knowledge." }
  ]
}

Plain text (.txt)

When keys are present, each line is key: value. If a collection has no meaningful keys (values only), each line contains just the value.

# With keys (e.g. famous-quotes)
Albert Einstein: Imagination is more important than knowledge.
Marie Curie: I was taught that the way of progress was neither swift nor easy.

# Values only (e.g. a list with no labels)
Imagination is more important than knowledge.
I was taught that the way of progress was neither swift nor easy.

Error response

{ "error": "Not Found", "status": 404 }

Status codes

CodeMeaning
200Success
404Not found (also for private collections without key)
422Validation error, e.g. string value over 250 chars
429Rate limit exceeded

Authentication

Public datasets need no authentication. Private collections (user-created) require an API key.

API key: header (recommended)

X-API-Key: your-api-key-here

API key: query string

GET /api/v1/collection/my-private-col?api_key=your-key
Private collections return 404, not 403, to avoid revealing their existence.