pub.techne.draft.permissioned.putRecords

Up to 200 putRecord writes, applied in order, each in its own transaction, for one write of your rate. Not atomic: each write's result says what happened to it, and a write refused for itself does not stop the others (AccountDeleting or an HTTP 500 stops the rest), except in a roster batch (one with any pub.techne.draft.membership write), which stops at its first refused write and reports each later one as Conflict, not written; as a circle, every prefix of its membership writes must keep the circle a manager. Send a failed batch again whole: re-putting what landed is a no-op (in an app's space, only under covering scopes or with no scope claim). Space scopes and space.private apply to each write as in putRecord: a first write is never refused by its space's policy (only by the token's `space:` scopes), but replacing a record already written for an app's space needs `space:` scopes covering it or no scope claim, and that write's result is Forbidden. Every write names its `space` (a write with none refuses the whole call, InvalidRequest; public records go through com.atproto.repo.putRecord). Draft tier.

Details · procedure
Kindprocedure
Authoritypermissioned.draft.techne.pub
Commit rev3n3iob6yxkg2u
Indexed

Procedure

procedure · POST

Input

application/json

repo

requiredstring · did

The owner's DID. Must equal the caller.

writes

requiredarray

The writes, applied in this order. Two writes of the same record are applied one after the other, as two putRecord calls would be.

  • minLength: 1
  • maxLength: 200
itemsref
Reference

Output

application/json

results

requiredarray

One result per write, in the order of writes.

itemsunion
One of (closed)

Errors

InvalidRequest

HTTP 400. Malformed input (a bad repo DID, no writes or more than 200, or a write with no `space`: name one, since public records go through com.atproto.repo.putRecord; nothing is written). Also HTTP 413, 415, 400 or 422 for a request body that is not the method's input (see the description). A write that is malformed on its own is reported in its result instead.

Forbidden

HTTP 403. repo is not the caller's own (or a collective's or circle's the caller may write as, see the description). Nothing is written.

LastManager

HTTP 409. The write, as a circle, would leave it with members and nobody at role >= 30, after the whole batch or after any prefix of its membership writes (a roster batch stops at its first refused write, so any prefix may be what is left written). Make someone else manager first. Nothing is written.

AccountDeleting

HTTP 403. The caller's account is being deleted, or is deleted. Nothing more is written; writes applied before the deletion began go with the account.

AuthenticationRequired

HTTP 401. No credential, or one that fails verification (for a service-auth JWT: wrong aud or lxm, expired, replayed, or an issuer whose key does not resolve right now; retry later in that case).

RateLimitExceeded

HTTP 429. The caller has written faster than its per-DID write limit allows (by default 20 writes a second, a burst of 200; a putRecords call spends one, whatever the number of writes it carries; counted per AppView instance). Retry later. Also HTTP 429, with nothing written, for a pub.techne.draft.contact write that binds a number to an account (`phone` and `did` both set, where the stored contact does not already carry both): such a write refused because that account does not hold the number (IdentityConflict) spends one of the caller's phone lookups, the budget pub.techne.draft.identity.accountsForPhones spends (10 a minute per caller, counted per AppView instance), and a matching one spends none; with none left every such write's result is RateLimitExceeded, nothing of it is written, and the next write is applied. Retry it in a minute.

#write

object

One write: a putRecord input without repo.

Properties

collection

requiredstring · nsid

record

requiredunknown

The record body. Its `$type` must equal `collection`; a collection with a published lexicon must satisfy it.

rkey

requiredstring · record-key
  • maxLength: 512

space

requiredstring · at-uri

The space this record is for. Public records are written with com.atproto.repo.putRecord, not here. Required: at://{authority}/{spaceType}/{skey} (a record only you read goes in your own pub.techne.draft.space.personal, at://{you}/pub.techne.draft.space.personal/self; a source's own records in at://{repo}/pub.techne.draft.space.source/self). A write naming no space refuses the whole call as InvalidRequest, and nothing is written. The key holds one record per space (the 0016 record address): writing it for another space writes another record and leaves this one; to move a record, delete it and write it again.

swapCid

string · cid

Write only if the record's current CID is this one. A missing record never matches.

#writeError

object

A write refused, and nothing of it written: the error putRecord would have answered.

Properties

error

requiredstring

InvalidRequest (malformed, a body that fails its collection's published lexicon, or a record over 2 MiB, more than a putRecord body may be), InvalidSwap (swapCid did not match the current version), Conflict (the same key holds a public record in the caller's repo, or a concurrent write replaced this version before it was recorded), IdentityConflict (the write would change a contact's identity, which writing again never fixes; see putRecord), DuplicatePhone (a contact write introduces a number another of the caller's active contacts carries; see putRecord), RateLimitExceeded (a contact write that binds a number to an account found the caller's phone lookups spent; retry it in a minute) or Forbidden (the call's `space:` scopes do not cover the write, or it replaces a record already written for an app's space under `space:` scopes that do not cover it; see putRecord).

  • knownValues: InvalidRequest | InvalidSwap | Conflict | IdentityConflict | DuplicatePhone | RateLimitExceeded | Forbidden

message

requiredstring

#writeResult

object

A write applied: putRecord's output for it.

Properties

cid

requiredstring · cid

The DAG-CBOR CID of the record, the same CID a PDS would compute.

read

requiredarray

As putRecord's `read`: the DIDs the `share`s placed in the space the record counts in name, when the caller may read that space; empty otherwise.

itemsstring · did

rev

requiredstring · tid

The repo revision of the version now current.

space

string · at-uri

The space the record counts in now. Absent when it counts in none.

uri

requiredstring · at-uri

Similar lexicons

semantic match

Lexicons whose schemas describe something close to this one. Check them before publishing a new one that overlaps.

  • Write a record into the caller's own repo, as a permissioned record (the generic private write). The caller authenticates with its own credential: a session from any sign-in lane (OAuth included), or an atproto service-auth JWT (iss = the caller, aud = the AppView's service DID, lxm = this method). repo must be the caller, or a collective or circle the platform holds the credential of whose own member space (`space.collective.member/self`) the caller manages (that space's manage leg alone hands

  • Write as a collective: a batch of creates, updates and deletes applied atomically to the repo of a collective account whose credential this service holds, written with that credential. The same input and output as com.atproto.repo.applyWrites, with `repo` the collective's DID; each write is a com.atproto.repo.applyWrites#create, #update or #delete. The service checks the caller's role in the collective first: whoever manages the collective's own member space (`pub.techne.draft.space.collective.m

  • Delete a record from the caller's own repo (a takedown, a mistake, or a `share` the owner withdraws, which stops that reader's future reads, with a 'revoke-read' receipt once no share in its source space names it). The caller authenticates with its own credential: a session from any sign-in lane (OAuth included), or an atproto service-auth JWT (iss = the caller, aud = the AppView's service DID, lxm = this method). repo must be the caller, or a collective or circle the platform holds the credenti

  • Writes records to the requesting user's repo in a space the AppView hosts for them. The write is authorized the way the space's authority would authorize it, stored, and indexed like a synced write. Records keep the URIs they will have on the user's PDS after a migration.

  • Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS.