···1+import "@tlex/emitter";
2+3+namespace com.atproto.identity.requestPlcOperationSignature {
4+ @doc("Request an email with a code to in order to request a signed PLC operation. Requires Auth.")
5+ @procedure
6+ op main(): void;
7+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.identity.submitPlcOperation {
4+ @doc("Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry")
5+ @procedure
6+ op main(input: {
7+ @required operation: unknown;
8+ }): void;
9+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.repo.importRepo {
4+ @doc("Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.")
5+ @procedure
6+ op main(
7+ @encoding("application/vnd.ipld.car")
8+ input: void
9+ ): void;
10+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.repo.uploadBlob {
4+ @doc("Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS.")
5+ @procedure
6+ op main(
7+ @encoding("*/*")
8+ input: void
9+ ): {
10+ @required blob: Blob<#[], 0>;
11+ };
12+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.sync.getBlob {
4+ @doc("Get a blob associated with a given account. Returns the full blob as originally uploaded. Does not require auth; implemented by PDS.")
5+ @query
6+ @encoding("*/*")
7+ @errors(BlobNotFound, RepoNotFound, RepoTakendown, RepoSuspended, RepoDeactivated)
8+ op main(
9+ @doc("The DID of the account.")
10+ @required
11+ did: did,
12+13+ @doc("The CID of the blob to fetch")
14+ @required
15+ cid: cid
16+ ): void;
17+18+ model BlobNotFound {}
19+ model RepoNotFound {}
20+ model RepoTakendown {}
21+ model RepoSuspended {}
22+ model RepoDeactivated {}
23+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.sync.getBlocks {
4+ @doc("Get data blocks from a given repo, by CID. For example, intermediate MST nodes, or records. Does not require auth; implemented by PDS.")
5+ @query
6+ @encoding("application/vnd.ipld.car")
7+ @errors(BlockNotFound, RepoNotFound, RepoTakendown, RepoSuspended, RepoDeactivated)
8+ op main(
9+ @doc("The DID of the repo.")
10+ @required
11+ did: did,
12+13+ @required cids: cid[]
14+ ): void;
15+16+ model BlockNotFound {}
17+ model RepoNotFound {}
18+ model RepoTakendown {}
19+ model RepoSuspended {}
20+ model RepoDeactivated {}
21+}
···1+import "@tlex/emitter";
2+import "./defs.tsp";
3+4+namespace com.atproto.sync.getHostStatus {
5+ @doc("Returns information about a specified upstream host, as consumed by the server. Implemented by relays.")
6+ @query
7+ @errors(HostNotFound)
8+ op main(
9+ @doc("Hostname of the host (eg, PDS or relay) being queried.")
10+ @required
11+ hostname: string
12+ ): {
13+ @required hostname: string;
14+15+ @doc("Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor).")
16+ seq?: integer;
17+18+ @doc("Number of accounts on the server which are associated with the upstream host. Note that the upstream may actually have more accounts.")
19+ accountCount?: integer;
20+21+ status?: com.atproto.sync.defs.HostStatus;
22+ };
23+24+ model HostNotFound {}
25+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.sync.getLatestCommit {
4+ @doc("Get the current commit CID & revision of the specified repo. Does not require auth.")
5+ @query
6+ @errors(RepoNotFound, RepoTakendown, RepoSuspended, RepoDeactivated)
7+ op main(
8+ @doc("The DID of the repo.")
9+ @required
10+ did: did
11+ ): {
12+ @required cid: cid;
13+ @required rev: tid;
14+ };
15+16+ model RepoNotFound {}
17+ model RepoTakendown {}
18+ model RepoSuspended {}
19+ model RepoDeactivated {}
20+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.sync.getRecord {
4+ @doc("Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth.")
5+ @query
6+ @encoding("application/vnd.ipld.car")
7+ @errors(RecordNotFound, RepoNotFound, RepoTakendown, RepoSuspended, RepoDeactivated)
8+ op main(
9+ @doc("The DID of the repo.")
10+ @required
11+ did: did,
12+13+ @required collection: nsid,
14+15+ @doc("Record Key")
16+ @required
17+ rkey: recordKey
18+ ): void;
19+20+ model RecordNotFound {}
21+ model RepoNotFound {}
22+ model RepoTakendown {}
23+ model RepoSuspended {}
24+ model RepoDeactivated {}
25+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.sync.getRepo {
4+ @doc("Download a repository export as CAR file. Optionally only a 'diff' since a previous revision. Does not require auth; implemented by PDS.")
5+ @query
6+ @encoding("application/vnd.ipld.car")
7+ @errors(RepoNotFound, RepoTakendown, RepoSuspended, RepoDeactivated)
8+ op main(
9+ @doc("The DID of the repo.")
10+ @required
11+ did: did,
12+13+ @doc("The revision ('rev') of the repo to create a diff from.")
14+ since?: tid
15+ ): void;
16+17+ model RepoNotFound {}
18+ model RepoTakendown {}
19+ model RepoSuspended {}
20+ model RepoDeactivated {}
21+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.sync.getRepoStatus {
4+ @doc("Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay.")
5+ @query
6+ @errors(RepoNotFound)
7+ op main(
8+ @doc("The DID of the repo.")
9+ @required
10+ did: did
11+ ): {
12+ @required did: did;
13+ @required active: boolean;
14+15+ @doc("If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.")
16+ status?: "takendown" | "suspended" | "deleted" | "deactivated" | "desynchronized" | "throttled" | string;
17+18+ @doc("Optional field, the current rev of the repo, if active=true")
19+ rev?: tid;
20+ };
21+22+ model RepoNotFound {}
23+}
···1+import "@tlex/emitter";
2+import "./defs.tsp";
3+4+namespace com.atproto.sync.listHosts {
5+ @doc("Enumerates upstream hosts (eg, PDS or relay instances) that this service consumes from. Implemented by relays.")
6+ @query
7+ op main(
8+ @minValue(1)
9+ @maxValue(1000)
10+ limit?: int32 = 200,
11+12+ cursor?: string
13+ ): {
14+ cursor?: string;
15+16+ @doc("Sort order is not formally specified. Recommended order is by time host was first seen by the server, with oldest first.")
17+ @required
18+ hosts: Host[];
19+ };
20+21+ model Host {
22+ @doc("hostname of server; not a URL (no scheme)")
23+ @required
24+ hostname: string;
25+26+ @doc("Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor).")
27+ seq?: integer;
28+29+ accountCount?: integer;
30+ status?: com.atproto.sync.defs.HostStatus;
31+ }
32+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.sync.listRepos {
4+ @doc("Enumerates all the DID, rev, and commit CID for all repos hosted by this service. Does not require auth; implemented by PDS and Relay.")
5+ @query
6+ op main(
7+ @minValue(1)
8+ @maxValue(1000)
9+ limit?: int32 = 500,
10+11+ cursor?: string
12+ ): {
13+ cursor?: string;
14+ @required repos: Repo[];
15+ };
16+17+ model Repo {
18+ @required did: did;
19+20+ @doc("Current repo commit CID")
21+ @required
22+ head: cid;
23+24+ @required rev: tid;
25+ active?: boolean;
26+27+ @doc("If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.")
28+ status?: "takendown" | "suspended" | "deleted" | "deactivated" | "desynchronized" | "throttled" | string;
29+ }
30+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.sync.listReposByCollection {
4+ @doc("Enumerates all the DIDs which have records with the given collection NSID.")
5+ @query
6+ op main(
7+ @required collection: nsid,
8+9+ @doc("Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists.")
10+ @minValue(1)
11+ @maxValue(2000)
12+ limit?: int32 = 500,
13+14+ cursor?: string
15+ ): {
16+ cursor?: string;
17+ @required repos: Repo[];
18+ };
19+20+ model Repo {
21+ @required did: did;
22+ }
23+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.sync.notifyOfUpdate {
4+ @doc("Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay. DEPRECATED: just use com.atproto.sync.requestCrawl")
5+ @procedure
6+ op main(input: {
7+ @doc("Hostname of the current service (usually a PDS) that is notifying of update.")
8+ @required
9+ hostname: string;
10+ }): void;
11+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.sync.requestCrawl {
4+ @doc("Request a service to persistently crawl hosted repos. Expected use is new PDS instances declaring their existence to Relays. Does not require auth.")
5+ @procedure
6+ @errors(HostBanned)
7+ op main(input: {
8+ @doc("Hostname of the current service (eg, PDS) that is requesting to be crawled.")
9+ @required
10+ hostname: string;
11+ }): void;
12+13+ model HostBanned {}
14+}
···1+import "@tlex/emitter";
2+3+namespace com.atproto.sync.subscribeRepos {
4+ @subscription
5+ @errors(FutureCursor, ConsumerTooSlow)
6+ @doc("Repository event stream, aka Firehose endpoint. Outputs repo commits with diff data, and identity update events, for all repositories on the current server. See the atproto specifications for details around stream sequencing, repo versioning, CAR diff format, and more. Public and does not require auth; implemented by PDS and Relay.")
7+ op main(
8+ @doc("The last known event seq number to backfill from.")
9+ cursor?: integer
10+ ): (Commit | Sync | Identity | Account | Info | unknown);
11+12+ model FutureCursor {}
13+14+ @doc("If the consumer of the stream can not keep up with events, and a backlog gets too large, the server will drop the connection.")
15+ model ConsumerTooSlow {}
16+17+ @doc("Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature.")
18+ model Commit {
19+ @doc("The stream sequence number of this message.")
20+ @required
21+ seq: integer;
22+23+ @doc("DEPRECATED -- unused")
24+ @required
25+ rebase: boolean;
26+27+ @doc("DEPRECATED -- replaced by #sync event and data limits. Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data.")
28+ @required
29+ tooBig: boolean;
30+31+ @doc("The repo this event comes from. Note that all other message types name this field 'did'.")
32+ @required
33+ repo: did;
34+35+ @doc("Repo commit object CID.")
36+ @required
37+ commit: cidLink;
38+39+ @doc("The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event.")
40+ @required
41+ rev: tid;
42+43+ @doc("The rev of the last emitted commit from this repo (if any).")
44+ @required
45+ since: tid | null;
46+47+ @doc("CAR file containing relevant blocks, as a diff since the previous repo state. The commit must be included as a block, and the commit block CID must be the first entry in the CAR header 'roots' list.")
48+ @bytesMaxLength(2000000)
49+ @required
50+ blocks: bytes;
51+52+ @maxItems(200)
53+ @required
54+ @doc("List of repo mutation operations in this commit (eg, records created, updated, or deleted).")
55+ ops: RepoOp[];
56+57+ @doc("DEPRECATED -- will soon always be empty. List of new blobs (by CID) referenced by records in this commit.")
58+ @required blobs: cidLink[];
59+60+ @doc("The root CID of the MST tree for the previous commit from this repo (indicated by the 'since' revision field in this message). Corresponds to the 'data' field in the repo commit object. NOTE: this field is effectively required for the 'inductive' version of firehose.")
61+ prevData?: cidLink;
62+63+ @doc("Timestamp of when this message was originally broadcast.")
64+ @required
65+ time: datetime;
66+ }
67+68+ @doc("Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository.")
69+ model Sync {
70+ @doc("The stream sequence number of this message.")
71+ @required
72+ seq: integer;
73+74+ @doc("The account this repo event corresponds to. Must match that in the commit object.")
75+ @required
76+ did: did;
77+78+ @doc("CAR file containing the commit, as a block. The CAR header must include the commit block CID as the first 'root'.")
79+ @bytesMaxLength(10000)
80+ @required
81+ blocks: bytes;
82+83+ @doc("The rev of the commit. This value must match that in the commit object.")
84+ @required
85+ rev: string;
86+87+ @doc("Timestamp of when this message was originally broadcast.")
88+ @required
89+ time: datetime;
90+ }
91+92+ @doc("Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache.")
93+ model Identity {
94+ @required seq: integer;
95+ @required did: did;
96+ @required time: datetime;
97+98+ @doc("The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details.")
99+ handle?: handle;
100+ }
101+102+ @doc("Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active.")
103+ model Account {
104+ @required seq: integer;
105+ @required did: did;
106+ @required time: datetime;
107+108+ @doc("Indicates that the account has a repository which can be fetched from the host that emitted this event.")
109+ @required
110+ active: boolean;
111+112+ @doc("If active=false, this optional field indicates a reason for why the account is not active.")
113+ status?: "takendown" | "suspended" | "deleted" | "deactivated" | "desynchronized" | "throttled" | string;
114+ }
115+116+ model Info {
117+ @required name: "OutdatedCursor" | string;
118+ message?: string;
119+ }
120+121+ @doc("A repo operation, ie a mutation of a single record.")
122+ model RepoOp {
123+ @required action: "create" | "update" | "delete" | string;
124+ @required path: string;
125+126+ @doc("For creates and updates, the new record CID. For deletions, null.")
127+ @required
128+ cid: cidLink | null;
129+130+ @doc("For updates and deletes, the previous record CID (required for inductive firehose). For creations, field should not be defined.")
131+ prev?: cidLink;
132+ }
133+}