AT Protocol spaces are in development. Expect changes throughout the beta starting on December 1st, 2026.

Chapter 6

Access control and credentials

Revised 2026-11-23Markdown

Because a space is a data perimeter, something has to enforce it, and that is where space credentials come in. A space’s records are spread across the PDSes of the accounts that wrote them, so there is no single door to guard. The space authority decides who can read the data and puts that decision in a short-lived space credential. The space host mints it in authorizeSpaceSync in exchange for up to two signed assertions: a delegation token naming the user’s identity, and a client attestation naming the app. Each repo host checks the credential before it hands a record to a syncer, and it can do so without asking the authority spec.

Space credential token exchange#

The app gets a space credential by trading a short-lived token from Elena’s PDS with Marcus’s space host. This is what that process looks like:

  1. Elena signs in to the family app with OAuth, granting space:com.example.familyUpdates?authority=*.

  2. The app calls com.atproto.space.getDelegationToken on Elena’s PDS and receives a 60-second token naming Elena and the family space.

  3. The app generates a fresh P-256 keypair, signs a client attestation with its own JWKS key, and calls com.atproto.space.authorizeSpaceSync on Marcus’s space host with the token, the attestation, and the new public key.

  4. The space host verifies what it received, asks the space’s policy whether Elena and the app may read, and returns a credential bound to the new key.

  5. The app reads every writer’s repo, from each writer’s own PDS, with that credential and a signature by the bound key.

The PDS hosting the user’s account and space repo follows the space’s policy on who gets the records it holds, and that typically involves confirming who the user is. The space host decides who’s a member and signs the credential that repo hosts check.

A space may require either, neither, or both the delegation token and client attestation. The host must not reject a request just because it carries a valid assertion that the space doesn’t require spec. A space with public read access skips steps 1 and 2, because a delegation token isn’t necessary. A space that admits any app skips the attestation in step 3.

Which of the two assertions a space asks for is set by its policy (Chapter 8). With the member list policy, com.atproto.memberspace.policy, the four combinations look like this:

Reference

What a member list policy asks for spec#

Delegation tokenClient attestationWho can readPolicy settings
Not neededNot neededAnyone, with any apppublicRead, no allowedApps
NeededNot neededMembers only, with any appThe defaults
Not neededNeededAnyone, but only through listed appspublicRead and allowedApps
NeededNeededMembers only, and only through listed appsallowedApps

One credential is used for the whole space, so an app serving many users only needs one credential per space, obtained through any one user’s session spec. Calling authorizeSpaceSync again before the credential expires is reauthorizing. If the space requires a delegation token and the app loses every session for it, the app can no longer reauthorize. Which of its users may see the space is the app’s own decision (Chapter 10).

The delegation token#

This token is minted by the PDS hosting the user’s account. It is single-use, valid 60 seconds by default, and addressed to the space host spec. The short life fits how the token is used. The app trades it for a space credential right away, as the first of two calls made in succession, so it never needs to last longer than that exchange. The app’s session must hold a space: scope with read covering the space.

Reference

getDelegationToken spec#

AuthOAuth readReturns200 token

The family app asks Elena’s PDS for a token.

Try it 6.1 · Get a delegation token#

querycom.atproto.space.getDelegationToken

Host
https://pds-a.example.com
Auth
Your session, once you sign in
ParameterTakesValue
spacespace-ref · requiredat:space/did:plc:ejjl2znzqp3ci25dqaslpkk2/com.example.familyUpdates/our-family
Sample response
{
  "token": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJhdHByb3RvLXNwYWNlLWRlbGVnYXRpb24rand0Iiwia2lkIjoiI2F0cHJvdG8ifQ.eyJpc3MiOiJkaWQ6cGxjOjUzbmk2dzdva3FyeHZqeGV6bW9wZWpvbyIsInN1YiI6ImF0OnNwYWNlL2RpZDpwbGM6ZWpqbDJ6bnpxcDNjaTI1ZHFhc2xwa2syL2NvbS5leGFtcGxlLmZhbWlseVVwZGF0ZXMvb3VyLWZhbWlseSIsImF1ZCI6ImRpZDpwbGM6ZWpqbDJ6bnpxcDNjaTI1ZHFhc2xwa2syI2F0cHJvdG9fcGRzIiwiaWF0IjoxNzk0ODQzMDAwLCJleHAiOjE3OTQ4NDMwNjAsImp0aSI6IjE2ZDk4NWU4MWEyM2M1NzIxOTZhNWI0ODdkOTVhZDk4In0.FDR6c8Gc3uTsGm7M1giXNcLLs7Wl34AnM6Aprc7kO9lYVG2qFTsPqParEX0-hlQvyJPVdoOADyuptkdq1VkYmA"
}

This console replays the sample response and makes no request.

The response holds only the token. Decoded:

JSON
{
  "alg": "ES256K",
  "typ": "atproto-space-delegation+jwt",
  "kid": "#atproto"
}
{
  "iss": "did:plc:53ni6w7okqrxvjxezmopejoo",
  "sub": "at:space/did:plc:ejjl2znzqp3ci25dqaslpkk2/com.example.familyUpdates/our-family",
  "aud": "did:plc:ejjl2znzqp3ci25dqaslpkk2#atproto_pds",
  "iat": 1794843000,
  "exp": 1794843060,
  "jti": "16d985e81a23c572196a5b487d95ad98"
}

It looks like service auth, but it’s a distinct credential type spec:

  • Its typ is atproto-space-delegation+jwt, where service auth uses JWT.

  • It carries no lxm, because it authorizes an exchange rather than one XRPC method.

  • Its sub is the space, so the token is good for that space alone.

It asserts only that Elena delegates to the app. Whether Elena is a member is the authority’s call.

The client attestation#

A client attestation proves which OAuth client is asking for a space credential. It names only the client, never the user. The delegation token names the user, and the space host checks the two independently. The space host can verify it because the app’s OAuth client_id is a URL pointing to its client metadata document, which identifies the signing key. The attestation is signed by the app with a key from its published JWKS, in the shape of an atproto private_key_jwt client assertion but addressed to the space host spec.

Reference

Client attestation spec#

The family app’s attestation, addressed to Marcus’s space host, decoded.

JSON
{
  "alg": "ES256",
  "typ": "atproto-client-attestation+jwt",
  "kid": "key-1"
}
{
  "iss": "https://family.example/client-metadata.json",
  "sub": "https://family.example/client-metadata.json",
  "aud": "did:plc:ejjl2znzqp3ci25dqaslpkk2#atproto_pds",
  "iat": 1794843001,
  "exp": 1794843061,
  "jti": "6998f590a0858fa82833a1ac0f109db8"
}

The host resolves iss to the client metadata, fetches its JWKS, and verifies with the key named by kid. The verified iss is the attested client_id that allowedApps lists compare against and that checkAccess receives as clientId.

Authorizing space sync#

Reference

authorizeSpaceSync spec#

AuthnoneReturns200 credential, spaceRevErrorsSpaceNotFoundSpaceDeletedAccountNotAuthorizedAppNotAuthorizedNotAuthorizedInvalidDelegationTokenInvalidClientAttestationRegistrationNotConfirmedRepoTakendownRepoDeactivated

The family app trades Elena’s token and its attestation for a credential.

Try it 6.2 · Authorize space sync#

procedurecom.atproto.space.authorizeSpaceSync

Host
https://pds-a.example.com
Auth
None
Sample response
{
  "credential": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJhdHByb3RvLXNwYWNlLWNyZWRlbnRpYWwrand0Iiwia2lkIjoiI2F0cHJvdG8ifQ.eyJpc3MiOiJkaWQ6cGxjOmVqamwyem56cXAzY2kyNWRxYXNscGtrMiIsInN1YiI6ImF0OnNwYWNlL2RpZDpwbGM6ZWpqbDJ6bnpxcDNjaTI1ZHFhc2xwa2syL2NvbS5leGFtcGxlLmZhbWlseVVwZGF0ZXMvb3VyLWZhbWlseSIsImNuZiI6eyJraWQiOiJkaWQ6a2V5OnpEbmFleUpyWGdnZmdmc01MeDkxd1FEb0hxazVyTW1HdEU0bmtYR0czeDVYenMxcm4ifSwiaWF0IjoxNzk0ODQzMDAxLCJleHAiOjE3OTQ4NDM2MDEsImp0aSI6IjZkM2RhYmYwODYzOWRjZjk4ZWU5ZmUyOGNmNDMxNGEzIn0.y0z7AVzg7lviXYsXY18vARsPONTG76VWoxoJJMWQaXUcaaPmi-ELKxFgo3kjlFWH6frlUd38sRbm45zxJGhjLg",
  "spaceRev": "3n2gtrxvls22e"
}

This console replays the sample response and makes no request.

The request doesn’t cary transport authentication, such as an OAuth session or service auth, and doesn’t need any. The delegation token and client attestation in the body are signed JWTs that say who is asking, and the credential the host returns is bound to credentialKey, so only the holder of that key can use it spec. credentialKey is required and must be a P-256 did:key; the host puts it in the credential as cnf.kid. notify is optional and registers the caller for update notifications (Chapter 7). The response’s spaceRev is the space’s current revision, omitted before the space’s first update.

The credential, decoded:

JSON#
{
  "alg": "ES256K",
  "typ": "atproto-space-credential+jwt",
  "kid": "#atproto"
}
{
  "iss": "did:plc:ejjl2znzqp3ci25dqaslpkk2",
  "sub": "at:space/did:plc:ejjl2znzqp3ci25dqaslpkk2/com.example.familyUpdates/our-family",
  "cnf": {
    "kid": "did:key:zDnaeyJrXggfgfsMLx91wQDoHqk5rMmGtE4nkXGG3x5Xzs1rn"
  },
  "iat": 1794843001,
  "exp": 1794843601,
  "jti": "6d3dabf08639dcf98ee9fe28cf4314a3"
}

The credential is signed by the authority’s #atproto key. It lasts ten minutes by default and sixty at most. Repo hosts don’t check back with the authority each time a credential is used, so its lifetime is a trade-off. A shorter one makes syncers mint credentials more often. A longer one stretches the window in which a removed member, a removed app, or a leaked credential can still read. It works with every repo host in the space, so it has no aud spec. Generate a new credential key for each credential and discard it when the credential expires.

atproto-pds runs its checks in this order, which balances security against the load on the host crates:

  1. Checks that credentialKey is a P-256 did:key, and that notify is well formed if present.

  2. Confirms it hosts the space’s authority.

  3. Confirms the authority’s account is active.

  4. Answers SpaceDeleted if the space was deleted.

  5. Verifies the delegation token.

  6. Verifies the client attestation.

  7. Asks the space’s policy whether the user and the app may read.

Refusals#

Reference

authorizeSpaceSync errors spec#

ErrorWhen
SpaceDeletedThe space was deleted. Answered before any authorization check.
SpaceNotFoundNo such space, or in place of AccountNotAuthorized to avoid revealing that the space exists
AccountNotAuthorizedThe policy refuses the identity
AppNotAuthorizedThe policy refuses the app, or a required attestation is missing
NotAuthorizedGeneric refusal, which may replace either of the two above
InvalidDelegationTokenToken malformed, expired, wrong aud, sub, typ, or signature
InvalidClientAttestationThe attestation, or the client metadata it points to, can’t be verified
RegistrationNotConfirmedThe notify endpoint did not confirm the registration
RepoTakendown, RepoDeactivatedThe authority’s account is in that state

These are the errors the authorizeSpaceSync lexicon declares spec. Because a host may answer a refused identity with SpaceNotFound or the generic NotAuthorized, don’t infer membership from the error name. atproto-pds answers AppNotAuthorized and InvalidClientAttestation with status 400 and a suspended authority with RepoSuspended. When a managed space’s managing app can’t answer, it returns 502 UpstreamFailure, which the lexicon does not list crates. Treat UpstreamFailure as retryable, never as a refusal.

Presenting the credential#

Every read sends the credential, an audience, and a signature by the bound key:

Reference

A read with a credential spec#

The family app asks Ruth’s PDS for her latest commit.

HTTP
GET /xrpc/com.atproto.space.getLatestCommit
  ?space=at:space/did:plc:ejjl2znzqp3ci25dqaslpkk2/com.example.familyUpdates/our-family
  &repo=did:plc:p4256dosynj6j6tkypz2q2l3
Authorization: Atproto-Space-Credential eyJhbGciOiJFUzI1NksiLCJ0eXAiOi…
Atproto-Space-Audience: did:plc:p4256dosynj6j6tkypz2q2l3
Signature-Input: sig=("authorization"
  "atproto-space-audience");tag="atproto-space-credential"
Signature: sig=:aJSLd/+RWTwSPbsM8ZKMIWXqkzDTt6…:
Accept-Signature: mac=("atproto-space-commit";sf);
  keyid="did:key:zDnaenqFhbY4sffBMz5ZatBohkr8LNNAe1pWTmG6C88rMc477";
  tag="atproto-space-commit"

The audience is the repo owner’s DID for repo methods and the authority’s DID for host methods such as listWriters spec.

A host receiving a credential runs through the following checklist to validate it spec:

  1. requires an Authorization header with the Atproto-Space-Credential scheme (recognized case-insensitively) and an Atproto-Space-Audience header;

  2. validates the credential’s type, issuer, signature, subject space, and expiration;

  3. requires exactly one signature with tag="atproto-space-credential", found by its tag under any label, since intermediaries may relabel;

  4. requires its covered components to be exactly ("authorization" "atproto-space-audience"), in that order;

  5. if the signature has a keyid, requires it to equal cnf.kid; if it has an alg, requires ecdsa-p256-sha256; ignores any other parameters;

  6. requires cnf.kid to be a P-256 did:key and verifies the signature against it;

  7. checks that the audience equals the one the request implies.

The signature base uses the Authorization value exactly as received, with no case normalization.

Expiry and revocation#

When an authority stops authorizing an app or the app has no authorized user’s session left for a space that needs one, then the app can no longer reauthorize, and its credential lapses within its remaining lifetime spec. That makes short expiry the main revocation mechanism.

For faster cutoff the space host may send com.atproto.space.notifyCredentialsRevoked to repo hosts in the space, with service auth from the authority. Its input names the space and 1 to 100 revoked credential IDs (jti) spec:

Reference

notifyCredentialsRevoked spec#

Authservice auth from authorityReturns200 no body

Marcus’s PDS tells each repo host to refuse that credential.

JSON
{
  "space": "at:space/did:plc:ejjl2znzqp3ci25dqaslpkk2/com.example.familyUpdates/our-family",
  "credentials": [
    "8e78341f7da46cf37e3cbd8611ff6bbc"
  ]
}

A repo host must reject a revoked jti and remember it for at least 60 minutes, the longest a credential can live spec. In atproto-pds, revocation is idempotent, so delivery can be retried crates. The space host should also drop a notification registration whose latest credential it revokes spec.

Writing without read access#

With the memberspace policy, each member list entry carries both read and write flags, and they are checked at different moments. read is checked when an app asks for a credential. write is checked when a write notification arrives spec. A managedspace has no member list, and its managing app answers read and write separately through checkAccess spec. A member can hold either one alone, so a space can have members who put records in and never see what anyone else wrote. A suggestion box works this way, and so does a submissions inbox.

Writing records to your own space repository doesn’t use space credentials. The member’s app writes to the member’s own space repo through its OAuth session, and the member’s PDS notifies the space host. The space host finds write: true, adds the repo to the writer set, and tells syncers spec. Readers of the space see those records like any others.

Reading is where the member is turned away. The member’s PDS will still hand the app a delegation token, because it checks the app’s OAuth scope and knows nothing about the member list. The space host then finds read: false and refuses to issue a credential spec. atproto-pds answers SpaceNotFound, in the same words it uses for a space that doesn’t exist crates. The member can still read their own space repo through the OAuth session, which needs no credential spec.

One gap is left to the app. A credential covers the whole space and names no user, so an app that serves both this member and a member who can read already holds the space’s records. The protocol can’t stop that app from showing them to the wrong person. The app has to check each user’s read flag itself, from the published member records when the space sets publishMembers, and show the space to the users who have it (Chapter 10).

Identities without an account#

A member of a space doesn’t need an account. A member list is a list of DIDs, and the space host checks a delegation token by resolving the issuer’s DID document and verifying the signature against the #atproto key it finds there spec. Nothing in that check asks which server signed the token. An identity that holds its own #atproto private key can sign a delegation token itself and trade it for a credential, the same way an app does on a user’s behalf.

Erin’s identity is did:web:erin.example. Its DID document lists a #atproto key but doesn’t have any services because there is no PDS:

JSON#
{
  "@context": [
    "https://www.w3.org/ns/did/v1",
    "https://w3id.org/security/multikey/v1",
    "https://w3id.org/security/suites/secp256k1-2019/v1"
  ],
  "id": "did:web:erin.example",
  "alsoKnownAs": [
    "at://erin.example"
  ],
  "verificationMethod": [
    {
      "id": "did:web:erin.example#atproto",
      "type": "Multikey",
      "controller": "did:web:erin.example",
      "publicKeyMultibase": "zQ3shvWu4gufp9Qp4fCXSRtKdvBeX6nGVEjkvYuE2s3pYgAtz"
    }
  ]
}
Erin's toolSpace hosterin.exampleWriters' repo hostssigns a delegation tokenwith her #atproto keyauthorizeSpaceSyncGET /.well-known/did.jsonDID documentchecks the signatureand the member listspace credentiallistWriterslistRepoOps and getReporecords, with a MAC
Erin's toolSpace hosterin.exampleWriters' repo hostssigns a delegation tokenwith her #atproto keyauthorizeSpaceSyncGET /.well-known/did.jsonDID documentchecks the signatureand the member listspace credentiallistWriterslistRepoOps and getReporecords, with a MAC
Figure 6.1 · Erin signs her own delegation token and reads like any syncer#

The important thing to reiterate is that Erin signs tokens with the key she owns, as published in her DID document.

Marcus adds Erin to the family space with the putMembers call from Chapter 8. Erin has no space repo to write from, so her entry grants read access only:

JSON#
{
  "did": "did:web:erin.example",
  "read": true,
  "write": false
}

Erin’s tool signs a delegation token with her #atproto key, carrying the same claims a PDS would put in one. Decoded:

JSON#
{
  "alg": "ES256K",
  "typ": "atproto-space-delegation+jwt",
  "kid": "#atproto"
}
{
  "iss": "did:web:erin.example",
  "sub": "at:space/did:plc:ejjl2znzqp3ci25dqaslpkk2/com.example.familyUpdates/our-family",
  "aud": "did:plc:ejjl2znzqp3ci25dqaslpkk2#atproto_pds",
  "iat": 1794843420,
  "exp": 1794843480,
  "jti": "c6b0c3082eeaf51efea6a49167ac8a28"
}

It then generates a P-256 credential key and calls authorizeSpaceSync. The family space admits any app, so the request carries no client attestation:

HTTP#
POST /xrpc/com.atproto.space.authorizeSpaceSync
Content-Type: application/json

{
  "space": "at:space/did:plc:ejjl2znzqp3ci25dqaslpkk2/com.example.familyUpdates/our-family",
  "credentialKey": "did:key:zDnaerESMGLw8NRXkwfGkQvpQ9u2R26RMXChzjkUbp9M1K7iw",
  "delegationToken": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOi..."
}

The space host fetches https://erin.example/.well-known/did.json, verifies the token against the #atproto key there, finds Erin on the member list with read: true, and answers with a credential bound to her key. Decoded:

JSON#
{
  "alg": "ES256K",
  "typ": "atproto-space-credential+jwt",
  "kid": "#atproto"
}
{
  "iss": "did:plc:ejjl2znzqp3ci25dqaslpkk2",
  "sub": "at:space/did:plc:ejjl2znzqp3ci25dqaslpkk2/com.example.familyUpdates/our-family",
  "cnf": {
    "kid": "did:key:zDnaerESMGLw8NRXkwfGkQvpQ9u2R26RMXChzjkUbp9M1K7iw"
  },
  "iat": 1794843421,
  "exp": 1794844021,
  "jti": "a9ede65fb181dd467a2bb7ef53de3dd5"
}

From there Erin reads the space like any syncer, starting with the writer set:

HTTP#
GET /xrpc/com.atproto.space.listWriters
  ?space=at:space/did:plc:ejjl2znzqp3ci25dqaslpkk2/com.example.familyUpdates/our-family
  &limit=100
Authorization: Atproto-Space-Credential eyJhbGciOiJFUzI1NksiLCJ0eXAiOi…
Atproto-Space-Audience: did:plc:ejjl2znzqp3ci25dqaslpkk2
Signature-Input: sig=("authorization"
  "atproto-space-audience");tag="atproto-space-credential"
Signature: sig=:QVs7ToEXTf7SUsuiF0mE9umJtzgctS…:

The full delegation token and credential are in Appendix G, and Erin’s keys are in Appendix F.

Erin can read, and only read. Writing to a space means writing records into a space repo, and space repos live on repo hosts, whose write methods accept only an OAuth session on an account there spec. Giving Erin write: true has no effect until she has an account somewhere. Her DID document needs no #atproto_kem key either, since that key serves readers of an account’s space repos, and Erin has none.

A space that sets allowedApps still asks for a client attestation from a listed app. Erin can act as her own client by publishing client metadata with a JWKS, as long as the authority lists her client_id.

The spec describes the delegation token as something the user’s PDS mints, and that is the usual path. An identity with an account keeps its #atproto signing key on its PDS, and the PDS signs the token on the identity’s behalf. Erin’s token is self-signed instead. Her did:web document publishes her #atproto key, she holds the private half herself, and her own tool signs the delegation token with it. The space host verifies both kinds the same way, by resolving the issuer’s DID document and checking the signature against its #atproto key, so it never needs to know who did the signing. A self-signed token should follow the same habits a PDS does, with a 60-second lifetime and a fresh jti every time. A space host caps how long a credential can live but not a delegation token, so Erin’s tool keeps the token’s lifetime short itself.

Common questions#

Does my app need a credential for each user?#

One per space is enough. A credential reads the whole space, and your app can get it through any one user’s session. Which of your users may see that space is your app’s decision (Chapter 10).

Can an app without a backend read spaces?#

It can read spaces that admit any app. A space that lists its allowed apps asks for a client attestation, which takes a private key kept on a server. A public client, such as a single-page app or a mobile app without its own backend, has no such key.

What happens when a member is removed?#

Their sessions stop producing credentials, because the policy now refuses them. Credentials already issued keep working until they expire, ten minutes by default, unless the space host revokes them sooner. Your app may still hold a valid credential through other members, so it also stops showing the space to the removed user.

Chapter 6 of 11 · AT Protocol Spaces: A Field Guide

Search