POST/documents
Create a document
Operation documents.create
Description
Creates a document from a signed document access event, its document link-set manifest, and its content-key bundle, optionally committing the document's first encrypted update in the same transaction. Requires write access to the target container through an authorizing container path. A retry of a create that already committed returns 409 document_manifest_already_exists, which lets the client adopt it.
Authentication
Requires a signed-in session: the client sends its session token as a bearer token in the Authorization header.
Request body
application/jsonDocumentCreateRequest
A signed document create: the document's first link-set manifest, its content-key bundle, and optionally its first encrypted update.
9 fields
bodyany JSON valuerequired- at most 16 items
eventobject with any fieldsrequiredexpectedManifestHashstringrequired- not empty
manifestobject with any fieldsrequired- 1 to 100 items
The document's first queued update, committed in the create transaction under every check a sync makes.
Other fields are allowed.
Responses
200 OK
application/jsonDocumentCreateResponse
Acknowledges a document create by hash.
7 fields
contentKeyEpochintegerrequired- greater than 0
Content-key epoch the API stored.
eventHashstringrequired- not empty
Hash of the signed event.
idstringrequiredmanifestHashstringrequired- not empty
Hash of the committed document link-set manifest.
targetHashstringrequired- not empty
Key target hash the API derived.
createdAtstringrequiredinitialSyncobjectoptionalPresent exactly when the request carried a seed; names the accepted update and its commit position.
3 fields
acceptedOutgoingUpdateIdslist of stringrequired- at most 1 item
- each item: not empty
commitLsnstringrequirednullablecommitLsnModestringrequired- one of
tracked,untracked
- one of
Other fields are allowed.
Other fields are allowed.
Other responses
| Status | Meaning | Body |
|---|---|---|
| 400 | Bad Request |
|
| 401 | Unauthorized |
|
| 402 | Payment Required |
|
| 403 | Forbidden |
|
| 404 | Not Found |
|
| 409 | Conflict |
|
| 500 | Internal Server Error |
|
| 503 | Service Unavailable |
|
Additional rules
The server also enforces these rules, which the schema above cannot express.
A document create seed must contain exactly one outgoing update and no container rekeys, and serialize within the document sync request limit.
inlineRekeyCommitIdmust be present exactly whencontainerRekeysis non-empty.authorizingContainerPathRefsis required whenoutgoingUpdatesis non-empty.containerRekeysmay be non-empty only whenoutgoingUpdatesis non-empty.Outgoing update ids must be unique within the request.
A request carrying
pullCursormust not contain outgoing updates, container rekeys, a content-key bundle, or authorizing paths.historyMode"raw" must not be combined with outgoing updates, container rekeys, a content-key bundle, or authorizing paths.historyMode"raw" requireslocalVersionVectorto be null so the complete retained history is requested.checkpointKind,checkpointPayloadKind, andsourceVersionVectormust be absent together or form a rotation baseline.