harb/docs/codeberg-api.md
openhands 878d1337df fix: Clean up dead code and stale domain references across landing + web-app (#189)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 13:04:02 +00:00

32 lines
1.2 KiB
Markdown

# Codeberg API Access
## Authentication
Codeberg API tokens are stored in `~/.netrc` (standard `curl --netrc` format, `chmod 600`):
```
machine codeberg.org
login johba
password <api-token>
```
The `password` field holds the API token — this is standard `.netrc` convention, not an actual password.
## Generating Tokens
Generate tokens at `https://codeberg.org/user/settings/applications`.
## Usage
Pass `--netrc` to curl for authenticated Codeberg API calls:
```bash
# List issues
curl --netrc -s https://codeberg.org/api/v1/repos/johba/harb/issues | jq '.[0].title'
# Get a specific issue
curl --netrc -s https://codeberg.org/api/v1/repos/johba/harb/issues/42 | jq '.title, .body'
# List pull requests
curl --netrc -s https://codeberg.org/api/v1/repos/johba/harb/pulls | jq '.[].title'
```
## Git vs API
The repo uses SSH for git push/pull (`ssh://git@codeberg.org`), so `.netrc` is only used for REST API interactions (issues, PRs, releases).
## Webhooks
Codeberg sends webhooks to `https://ci.niovi.voyage/api/hook` to trigger Woodpecker CI pipelines. If webhooks stop firing (e.g. DNS issues), check Codeberg repo settings → Webhooks to verify delivery history and re-trigger.