Skip to content

Federation API ​

9 endpoints. Request and response schemas are described on the schemas page; the other tags are listed in the API index.

Endpoints ​

GET /api/v1/repositories/{name}/federation ​

Get a repository's federation status

Federation health of one repository: whether it is enabled, the log position, and every peer (with its state, lag and backlog) and inbound token. Requires the repository-scoped manage permission (global administrators have it) or the maintainer or owner role in the repository's project. supported is false for proxy and group repositories and for formats without federation.

Parameters

NameInTypeRequiredDescription
namepathstringyes-

Responses

StatusDescriptionBody
200Federation statusapplication/json: FederationStatus
400Invalid request, including a NUL byte in the URL or the bodyapplication/json: Error
403Manage permission on the repository required-
404Repository not found-

PUT /api/v1/repositories/{name}/federation ​

Enable or disable federation

Enabling backfills the change log from the repository's existing content. Disabling removes the log and all peers. Idempotent. Same permission as the status read.

Parameters

NameInTypeRequiredDescription
namepathstringyes-

Request body (required)

application/json: UpdateFederationRequest

Responses

StatusDescriptionBody
200The new federation statusapplication/json: FederationStatus
400Invalid request, or the repository is not hosted or its format has no federation (error code validation_failed)application/json: Error
403Manage permission on the repository required-
404Repository not found-
409Conflict with the current stateapplication/json: Error

POST /api/v1/repositories/{name}/federation/peers ​

Add a federation peer

Registers a remote instance to pull this repository's changes from. The base URL is validated against the outbound (SSRF) policy. Requires federation to be enabled (409 otherwise) and the repository-scoped manage permission.

Parameters

NameInTypeRequiredDescription
namepathstringyes-

Request body (required)

application/json: CreateFederationPeerRequest

Responses

StatusDescriptionBody
201Peer addedapplication/json: FederationPeer
400Invalid request (error code validation_failed)application/json: Error
403Manage permission on the repository required-
404Repository not found-
409Federation is not enabled, or a peer with this name already existsapplication/json: Error

PATCH /api/v1/repositories/{name}/federation/peers/{id} ​

Update a federation peer

Changes a peer's name, URL, credentials or enabled flag; absent fields stay unchanged. Same permission as the status read.

Parameters

NameInTypeRequiredDescription
namepathstringyes-
idpathstring (uuid)yesPeer id.

Request body (required)

application/json: UpdateFederationPeerRequest

Responses

StatusDescriptionBody
200The updated peerapplication/json: FederationPeer
400Invalid request (error code validation_failed)application/json: Error
403Manage permission on the repository required-
404Repository or peer not found-
409A peer with this name already existsapplication/json: Error

DELETE /api/v1/repositories/{name}/federation/peers/{id} ​

Delete a federation peer

Stops pulling from the peer and forgets its cursor and deferred units. Content already applied stays. Same permission as the status read.

Parameters

NameInTypeRequiredDescription
namepathstringyes-
idpathstring (uuid)yesPeer id.

Responses

StatusDescriptionBody
204Peer deleted-
400Invalid request, including a NUL byte in the URL or the bodyapplication/json: Error
403Manage permission on the repository required-
404Repository or peer not found-
409Conflict with the current stateapplication/json: Error

GET /api/v1/repositories/{name}/federation/peers/{id}/deferred ​

List a peer's deferred units

Units pulled from the peer that could not be applied yet (for example a dependency has not arrived) and are being retried. Same permission as the status read.

Parameters

NameInTypeRequiredDescription
namepathstringyes-
idpathstring (uuid)yesPeer id.

Responses

StatusDescriptionBody
200The deferred unitsapplication/json: FederationDeferredList
400Invalid request, including a NUL byte in the URL or the bodyapplication/json: Error
403Manage permission on the repository required-
404Repository or peer not found-
409Conflict with the current stateapplication/json: Error

POST /api/v1/repositories/{name}/federation/peers/{id}/resync ​

Resync a federation peer

Resets the peer's cursor so the next pass re-reads its whole log and merges it idempotently. Returns at once; the peer reports resync_requested until the pass starts. Same permission as the status read.

Parameters

NameInTypeRequiredDescription
namepathstringyes-
idpathstring (uuid)yesPeer id.

Responses

StatusDescriptionBody
202Resync queuedapplication/json: FederationPeer
400Invalid request, including a NUL byte in the URL or the bodyapplication/json: Error
403Manage permission on the repository required-
404Repository or peer not found-
409Conflict with the current stateapplication/json: Error

POST /api/v1/repositories/{name}/federation/tokens ​

Create an inbound federation token

Mints a token a peer presents to pull this repository's log. The clear-text token is returned only in this response. Requires federation to be enabled (409 otherwise) and the repository-scoped manage permission.

Parameters

NameInTypeRequiredDescription
namepathstringyes-

Request body (required)

application/json: CreateFederationTokenRequest

Responses

StatusDescriptionBody
201Token createdapplication/json: FederationTokenCreated
400Invalid request (error code validation_failed)application/json: Error
403Manage permission on the repository required-
404Repository not found-
409Federation is not enabledapplication/json: Error

DELETE /api/v1/repositories/{name}/federation/tokens/{id} ​

Revoke an inbound federation token

The token stops working at once; it stays listed with revoked_at set. Same permission as the status read.

Parameters

NameInTypeRequiredDescription
namepathstringyes-
idpathstring (uuid)yesToken id.

Responses

StatusDescriptionBody
204Token revoked-
400Invalid request, including a NUL byte in the URL or the bodyapplication/json: Error
403Manage permission on the repository required-
404Repository or token not found-
409Conflict with the current stateapplication/json: Error

Free software under the AGPL-3.0-or-later.