# Codeberg API
> Live profile and repository data from Codeberg as an API — the community-run, Forgejo-powered git host and a leading open-source alternative to GitHub. Look up any user or organisation for their profile and social reach (followers, following, starred repositories, join date, location and website), open any repository for its stats (stars, forks, watchers, open issues, primary language, size and dates), or search Codeberg's repositories ranked by stars. The git-forge community layer for developer, social and dashboard apps. Live, no key, no cache. Distinct from GitHub and GitLab APIs and from package-registry APIs — this is the Codeberg platform's own community and project data.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/codeberg-api/..."
```

## Pricing
- **Free** (Free) — 11,000 calls/Mo, 5 req/s
- **Starter** ($7/Mo) — 150,000 calls/Mo, 15 req/s
- **Pro** ($18/Mo) — 740,000 calls/Mo, 40 req/s
- **Scale** ($44/Mo) — 3,600,000 calls/Mo, 100 req/s

## Endpoints

### User

#### `GET /v1/user` — A user or org profile + social counts

**Parameters:**
- `username` (query, required, string) — Codeberg username or org Example: `forgejo`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/codeberg-api/v1/user?username=forgejo"
```

**Response:**
```json
{
    "data": {
        "id": 70422,
        "type": null,
        "login": "forgejo",
        "avatar": "https://codeberg.org/avatars/dae8ab126a96f6fbd6942cf08ab92382",
        "created": "2022-11-06T07:18:11+01:00",
        "website": "https://forgejo.org",
        "is_admin": false,
        "location": null,
        "followers": 534,
        "following": 0,
        "full_name": "Forgejo",
        "description": "Beyond coding. We forge.",
        "profile_url": "https://codeberg.org/forgejo",
        "starred_repos": 0,
        "account_age_days": 1311
    },
    "meta": {
        "timestamp": "2026-06-09T03:02:07.964Z",
        "request_id": "d112c45e-6c72-4fc8-8b39-764bed472d37"
    },
    "status": "ok",
    "message": "User retrieved successfully",
    "success": true
}
```

### Repo

#### `GET /v1/repo` — A repository stats

**Parameters:**
- `repo` (query, optional, string) — owner/name Example: `forgejo/forgejo`
- `owner` (query, optional, string) — Owner (with name) Example: `forgejo`
- `name` (query, optional, string) — Repo name (with owner) Example: `forgejo`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/codeberg-api/v1/repo?repo=forgejo%2Fforgejo&owner=forgejo&name=forgejo"
```

**Response:**
```json
{
    "data": {
        "url": "https://codeberg.org/forgejo/forgejo",
        "name": "forgejo",
        "forks": 839,
        "owner": "forgejo",
        "stars": 4890,
        "created": "2022-11-06T07:24:57+01:00",
        "is_fork": false,
        "size_kb": 344999,
        "updated": "2026-06-09T04:01:16+02:00",
        "language": "Go",
        "watchers": 119,
        "full_name": "forgejo/forgejo",
        "is_mirror": false,
        "description": "Beyond coding. We forge.",
        "is_archived": false,
        "open_issues": 1340,
        "default_branch": "forgejo"
    },
    "meta": {
        "timestamp": "2026-06-09T03:02:08.087Z",
        "request_id": "71068e86-66af-47ee-9abc-86f4323e1bce"
    },
    "status": "ok",
    "message": "Repository retrieved successfully",
    "success": true
}
```

### Search

#### `GET /v1/search` — Search repositories

**Parameters:**
- `q` (query, required, string) — Search query Example: `markdown`
- `sort` (query, optional, string) — stars|forks|updated Example: `stars`
- `limit` (query, optional, string) — Max results (1-50) Example: `20`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/codeberg-api/v1/search?q=markdown&sort=stars&limit=20"
```

**Response:**
```json
{
    "data": {
        "sort": "stars",
        "count": 20,
        "query": "markdown",
        "repos": [
            {
                "url": "https://codeberg.org/Recommendations/Mirror_to_Codeberg",
                "name": "Mirror_to_Codeberg",
                "forks": 5,
                "owner": "Recommendations",
                "stars": 155,
                "created": "2022-12-30T02:57:44+01:00",
                "is_fork": false,
                "size_kb": 646,
                "updated": "2024-12-03T05:29:22+01:00",
                "language": "Markdown",
                "watchers": 10,
                "full_name": "Recommendations/Mirror_to_Codeberg",
                "is_mirror": false,
                "description": "A central place of information about mirroring repos to Codeberg #GiveUpGitHub",
                "is_archived": false,
                "open_issues": 10,
                "default_branch": "main"
            },
            {
                "url": "https://codeberg.org/swiso/website",
                "name": "website",
                "forks": 33,
                "owner": "swiso",
                "stars": 150,
                "created": "2019-09-27T17:43:10+02:00",
                "is_fork": false,
                "size_kb": 12156,
                "updated": "2026-03-15T17:58:22+01:00",
                "language": "HTML",
                "watchers": 14,
                "full_name": "swiso/website",
                "is_mirror": false,
                "d
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Service metadata

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/codeberg-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "source": "Codeberg (Forgejo) public API (live)",
        "service": "codeberg-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/repo": "A repository's stats (repo=forgejo/forgejo or owner= & name=).",
            "GET /v1/user": "A user/org profile + social counts (username=forgejo).",
            "GET /v1/search": "Search repositories (q=markdown, sort=stars|forks|updated)."
        },
        "description": "Live Codeberg (Forgejo) git-forge community data: any user or organisation's profile and social reach (followers, following, starred repos, join date), any repository's stats (stars, forks, watchers, open issues, language, size, dates), and repository search ranked by stars. Codeberg is the community-run open-source alternative to GitHub. Live, no key. Distinct from GitHub/GitLab and package-registry APIs — this is the Codeberg platform's own community and project data.",
        "upstream_status": "ok"
    },
    "meta": {
        "timestamp": "2026-06-09T03:02:11.773Z",
        "request_id": "2ab1b494-e80c-4c3f-bd51-da309b65a719"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/codeberg-api
OpenAPI spec: https://www.oanor.com/api/codeberg-api/openapi.json
