# Knot

> XRPC methods served by a knot.

Served by `knot-server` at `https://<knot host>/xrpc/<method>`.

## com.atproto.identity.resolveHandle

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.repo.createRecord

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.repo.deleteRecord

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.repo.describeRepo

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.repo.getRecord

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.repo.listRecords

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.repo.putRecord

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.server.describeServer

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.sync.getBlob

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.sync.getBlocks

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.sync.getLatestCommit

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.sync.getRecord

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.sync.getRepo

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.sync.getRepoStatus

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.sync.listBlobs

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.sync.listRepos

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## com.atproto.sync.subscribeRepos

Standard atproto method, see the [atproto lexicons](https://github.com/bluesky-social/atproto/tree/main/lexicons/com/atproto).

## org.tangled.git.receivePack

`POST`. No-op xrpc endpoint for `git-push` permission scope.

## org.tangled.git.setDefaultBranch

`POST`. Set the default branch of this repository

Input:

* `repo` (string, did, required): DID of the repository
* `branch` (string, required): Branch name without the refs/heads/ prefix

Output:

* `uri` (string, at-uri, required): The repository’s org.tangled.git.refs record
* `cid` (string, cid, required): Version of the refs record after the move

## org.tangled.knot.describeKnot

`GET`.

Output:

* `did` (string, did, required)
* `version` (string, required)
* `capabilities` (array of string): Protocol capability tokens this knot implements. Knots that omit this field are treated as legacy.
* `links` (`links`): URLs of service policy documents.
* `contact` (`contact`): Contact information

## org.tangled.repo.createRepo

`POST`. Create a new repository

Input:

* `name` (string, record-key, required): Name of the repository.
* `did` (string, did): Optional user-provided DID to use as the repo identity instead of minting one.
* `defaultBranch` (string): Default branch of the repository.
* `spindle` (string, did)
* `description` (string)
* `website` (string, uri): Any URI related to the repo
* `topics` (array of string): Topics related to the repo
* `source` (`org.tangled.repo.defs#sourceTangled` or `org.tangled.repo.defs#sourceExternal`): A source to clone from, populate this when forking or importing a repository.
* `createdAt` (string, datetime)

Output:

* `did` (string, did)
* `key` (string): Multibase-encoded public signing key the knot holds for this repository

## org.tangled.repo.deleteRepo

`POST`. Delete a repository

Input:

* `repo` (string, did, required)
* `force` (boolean): Skip the check for a declaration record on the owner’s PDS. Knot admins only.

## org.tangled.repo.getImportStatus

`GET`. How far the knot got importing a repository from its source. Only the repository owner and knot admins see the real reason; everyone else gets a generic one.

Params:

* `repo` (string, did, required): DID of the repository

Output:

* `status` (string, known values `fetching`, `present`, `partial`, `failed`): Where the import from the source is. Omitted when the repository wasn’t created from a source.
* `reason` (string): Why a partial or failed import ended that way

Errors:

* `RepoNotFound`: Repo is not registered on this knot
* `InvalidRequest`: Invalid request parameters

## org.tangled.repo.listRecordVersions

`GET`. Every version of a record this knot hosts, oldest first unless order says otherwise. A version’s bytes are fetched by content id through com.atproto.sync.getBlocks.

Params:

* `uri` (string, at-uri, required): Record in a repo this knot hosts
* `limit` (integer, default `100`, 1 to 500)
* `cursor` (string): Pagination cursor
* `order` (string, known values `asc`, `desc`, default `"asc"`): asc lists the oldest version first, desc the newest.

Output:

* `uri` (string, at-uri, required)
* `versions` (array of `version`, required)
* `cursor` (string): Cursor for the next page, left out when the page already reaches the newest version

Errors:

* `InvalidRequest`: The uri isn’t an at-uri, or the collection isn’t versioned
* `NotFound`: No such record on this knot
* `ProjectionWarming`: The record’s change history is still being folded; retry shortly

## org.tangled.repo.mintToken

`POST`. Mint a service-auth JWT whose issuer is this repo’s DID, signed by the knot that owns the repo’s signing key. When calling this, you’ll need the same perms as git push, ie. being repo owner/collaborator/knot-admin.

Input:

* `repo` (string, did, required): DID of the repo that becomes the token’s issuer. Must be the audience of a given calling session.
* `aud` (string, did, required): Audience of the minted token, a DID service ref for the service, that the token is addressed to.
* `lxm` (string, nsid, required): Lexicon method to which minted token binds.
* `exp` (integer, required): Unix seconds. Must be in the future, and at most 60s after mint time.

Output:

* `token` (string, required): The signed service-auth JWT.

## org.tangled.repo.reserveKey

`POST`. Reserve a repo identity under a DID the caller brings. The knot seals and holds a signing key for the repo DID; the caller publishes the matching public key in that DID’s document before calling org.tangled.repo.createRepo with the same DID.

Input:

* `repo` (string, did, required): The caller-minted DID to reserve

Output:

* `repo` (string, did, required)
* `key` (string, required): Multibase-encoded public signing key the knot holds for this repo identity

## org.tangled.review\.submitPatch

`POST`. Create a patch record, fetching its head from the source repository first. The only way to write org.tangled.review\.patch records.

Input:

* `repo` (string, did, required): DID of the repository
* `patch` (`patch`, required)

Output:

* `uri` (string, at-uri, required): AT-URI of created org.tangled.review\.patch record.
* `cid` (string, cid, required): CID of created org.tangled.review\.patch record.