Cite a fixed version of a source
Register a file's original bytes, publish addressable text units and read a unit by ID, so a citation and a numeric check point at content that cannot change.
Last updated
Endpoints and minimal requests
Three calls give you immutable IDs. POST https://api.webcite.co/api/v2/sources (multipart: assetId and file) registers the bytes of an asset you uploaded and returns a sourceVersionId. POST /api/v2/sources/{versionId}/representations/text publishes plain text or CSV bytes as units. GET /api/v2/sources/{versionId}/representations/{representationId}/units/{unitId} reads one unit. Agents call register_source, publish_text_representation, get_latest_representation and read_source_unit.
curl --fail-with-body -X POST 'https://api.webcite.co/api/v2/sources' \
-H "x-api-key: $WEBCITE_API_KEY" \
-F 'assetId=YOUR_ASSET_ID' \
-F 'file=@us-mint-2024-numismatic-results.txt'Recorded register response, trimmed:
{
"sourceVersionId": "8d640017-9e0d-4d13-8db0-b6c0baf9066a",
"assetId": "975edd39-d9bd-469d-b243-c9db4500e234",
"bytesHash": "4172364885dba4a8820a41846e2a109b03164d28cfd5a49ae27923ee923722b5",
"mediaType": "text/plain",
"byteLength": 438,
"state": "available"
}Recorded publish response:
{
"sourceVersionId": "8d640017-9e0d-4d13-8db0-b6c0baf9066a",
"representationId": "e63be976-824a-4ed5-8ea4-8b49c88754be",
"parserVersion": "native-text/1",
"units": [
{
"sourceUnitId": "5e700227-61ed-46c4-8994-32019e46f4fc",
"locator": {
"kind": "page",
"page": 1
},
"state": "complete"
}
]
}Read a unit before you cite it
A unit carries its locator, its content, a contentHash and an identityHash, so a later reader can confirm that the cited text is the text you checked. The recorded unit is source-unit-mint.json. If you lose the publish response, the latest-representation call lists the unit IDs; when more than one representation exists it answers 409 Representation selection required, as in the recorded call, and you pass the representation explicitly.
When to use it, and what to use instead
Use retained sources when a result must point at content that cannot drift: numeric checks require these IDs, and source preview and batch quote checks accept all three of source_version_id, representation_id and source_unit_id. For reading a document, plain extraction is enough. If an upload already returned a source_version_id, use it instead of registering again.