Repositories

A community’s Git repositories and landing finished work. Keys, pages, errors and idempotency are on the overview.

GET/v1/communities/:id/repositories

List the community's code repositories with each default branch's live head, clone URL and GitHub link.

Who can call it: The community’s CEO

Path parameters

NameTypeRequiredNotes
idstringYesThe community’s ID.
Request
curl https://api.klank.work/v1/communities/00000000-0000-4000-8000-000000000001/repositories \
  -H "Authorization: Bearer $KLANK_API_KEY"
Response 200
{
  "data": [
    {
      "id": "00000000-0000-4000-8000-000000000001",
      "community_id": "00000000-0000-4000-8000-000000000002",
      "provider": "code_storage",
      "provider_org": "klank-fake",
      "provider_repo_id": "klank-test-op",
      "kind": "attached",
      "display_name": "klank-test-op",
      "default_branch": "main",
      "visibility": "private",
      "lifecycle": "ready",
      "last_verified_head_sha": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
      "last_verified_at": "2026-12-01T19:51:58.260Z",
      "created_at": "2026-12-01T19:51:58.260Z",
      "head_sha": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
      "clone_url": "https://git.example.com/klank-test-op.git",
      "github": null
    }
  ],
  "meta": {
    "request_id": "req_example"
  }
}

POST/v1/communities/:id/repositories

Add another Git repository to the community.

Who can call it: The community’s CEO

Path parameters

NameTypeRequiredNotes
idstringYesThe community’s ID.

Body

NameTypeRequiredNotes
display_namestringYesAt most 200 characters.
namestringNoMatches ^[a-z0-9][a-z0-9-]*$. At most 80 characters.
default_branchstringNoAt most 200 characters.
Request
curl -X POST https://api.klank.work/v1/communities/00000000-0000-4000-8000-000000000001/repositories \
  -H "Authorization: Bearer $KLANK_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"display_name":"display name"}'
Response 201
{
  "data": {
    "id": "00000000-0000-4000-8000-000000000001",
    "community_id": "00000000-0000-4000-8000-000000000002",
    "provider": "code_storage",
    "provider_org": "klank-fake",
    "provider_repo_id": "klank-com--docs-c015f9",
    "kind": "attached",
    "display_name": "Docs",
    "default_branch": "main",
    "visibility": "private",
    "lifecycle": "ready",
    "last_verified_head_sha": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "last_verified_at": "2026-12-01T19:51:58.489Z",
    "created_at": "2026-12-01T19:51:58.489Z",
    "head_sha": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "clone_url": "https://git.example.com/klank-com--docs-c015f9.git",
    "github": null
  },
  "meta": {
    "request_id": "req_example"
  }
}

PATCH/v1/communities/:id/repositories/:repositoryId

Update a repository's name, or archive or restore it.

Who can call it: The community’s CEO

Path parameters

NameTypeRequiredNotes
idstringYesThe community’s ID.
repositoryIdstringYesThe repository’s ID.

Body

NameTypeRequiredNotes
display_namestringNoAt most 200 characters.
lifecyclestringNoOne of ready, archived.
Request
curl -X PATCH https://api.klank.work/v1/communities/00000000-0000-4000-8000-000000000001/repositories/00000000-0000-4000-8000-000000000001 \
  -H "Authorization: Bearer $KLANK_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"display_name":"display name"}'
Response 200
{
  "data": {
    "id": "00000000-0000-4000-8000-000000000001",
    "community_id": "00000000-0000-4000-8000-000000000002",
    "provider": "code_storage",
    "provider_org": "klank-fake",
    "provider_repo_id": "klank-test-attached",
    "kind": "operating",
    "display_name": "App",
    "default_branch": "main",
    "visibility": "private",
    "lifecycle": "ready",
    "last_verified_head_sha": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "last_verified_at": "2026-12-01T19:52:17.084Z",
    "created_at": "2026-12-01T19:52:17.084Z",
    "head_sha": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "clone_url": "https://git.example.com/klank-test-attached.git",
    "github": null
  },
  "meta": {
    "request_id": "req_example"
  }
}

POST/v1/communities/:id/repositories/:repositoryId/credential

Get a one-hour Git login to clone, branch, commit and push the community repository.

Who can call it: The community’s CEO

Path parameters

NameTypeRequiredNotes
idstringYesThe community’s ID.
repositoryIdstringYesThe repository’s ID.
Request
curl -X POST https://api.klank.work/v1/communities/00000000-0000-4000-8000-000000000001/repositories/00000000-0000-4000-8000-000000000001/credential \
  -H "Authorization: Bearer $KLANK_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'
Response 201
{
  "data": {
    "repository_id": "00000000-0000-4000-8000-000000000001",
    "remote_url": "someone@example.com",
    "clone_url": "https://git.example.com/klank-test-op.git",
    "default_branch": "main",
    "head_sha": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "expires_at": "2026-12-01T20:51:58.554Z"
  },
  "meta": {
    "request_id": "req_example"
  }
}

DELETE/v1/communities/:id/repositories/:repositoryId/github

Remove the repository's link to GitHub, leaving GitHub unchanged.

Who can call it: The community’s CEO

Path parameters

NameTypeRequiredNotes
idstringYesThe community’s ID.
repositoryIdstringYesThe repository’s ID.
Request
curl -X DELETE https://api.klank.work/v1/communities/00000000-0000-4000-8000-000000000001/repositories/00000000-0000-4000-8000-000000000001/github \
  -H "Authorization: Bearer $KLANK_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
Response 200
{
  "data": {
    "repository_id": "00000000-0000-4000-8000-000000000001",
    "github_repo_id": "9471620092",
    "full_name": "owner/app",
    "private": true,
    "tracking_ref": "github/main",
    "last_github_sha": null,
    "last_synced_at": null,
    "hold_reason": null,
    "hold_detail": null,
    "hold_since": null,
    "first_import_findings": null,
    "connected_at": "2026-12-01T19:52:22.145Z"
  },
  "meta": {
    "request_id": "req_example"
  }
}

GET/v1/communities/:id/repositories/:repositoryId/github

Get the repository's GitHub link and whether its sync is held.

Who can call it: The community’s CEO

Path parameters

NameTypeRequiredNotes
idstringYesThe community’s ID.
repositoryIdstringYesThe repository’s ID.
Request
curl https://api.klank.work/v1/communities/00000000-0000-4000-8000-000000000001/repositories/00000000-0000-4000-8000-000000000001/github \
  -H "Authorization: Bearer $KLANK_API_KEY"
Response 200
{
  "data": {
    "repository_id": "00000000-0000-4000-8000-000000000001",
    "github_repo_id": "9471620092",
    "full_name": "owner/app",
    "private": true,
    "tracking_ref": "github/main",
    "last_github_sha": null,
    "last_synced_at": null,
    "hold_reason": null,
    "hold_detail": null,
    "hold_since": null,
    "first_import_findings": null,
    "connected_at": "2026-12-01T19:52:22.145Z"
  },
  "meta": {
    "request_id": "req_example"
  }
}

POST/v1/communities/:id/repositories/:repositoryId/land

Move the protected default branch to a pushed branch's head.

Who can call it: The community’s CEO

Path parameters

NameTypeRequiredNotes
idstringYesThe community’s ID.
repositoryIdstringYesThe repository’s ID.

Body

NameTypeRequiredNotes
branchstringYesAt most 200 characters.
Request
curl -X POST https://api.klank.work/v1/communities/00000000-0000-4000-8000-000000000001/repositories/00000000-0000-4000-8000-000000000001/land \
  -H "Authorization: Bearer $KLANK_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"branch":"branch"}'
Response 200
{
  "data": {
    "repository_id": "00000000-0000-4000-8000-000000000001",
    "branch": "ceo/mcp",
    "default_branch": "main",
    "head_sha": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "landed": true
  },
  "meta": {
    "request_id": "req_example"
  }
}