instance_url of the site it belongs to (https://gitea.com,
https://codeberg.org or your own https://git.example.com, with or
without /api/v1). Forgejo and Codeberg serve the same API v1, so the
plugin works there too. A route an older or forked server lacks answers
404 page not found, and a body field it doesn’t know is ignored rather
than refused: the stale-edit check content_version on issues.update
and pulls.update only works on servers that include go-gitea/gitea#37035. Create the token at
<instance>/user/settings/applications with the scopes you need
(read:/write: repository, issue, organization, user, notification,
package, misc, and admin for the site-admin routes); it is sent as
Authorization: token <token>. SDK users can pass instanceUrl in the
plugin options instead of storing it; with a stored token it must match the
stored instance (the token is never sent to another host), else pass key
too.
- Repository routes take
ownerandrepo. Branches, refs, tags and file paths keep their slashes (feature/login,docs/README.md). - Lists page with
page(1-based) andlimit; the plugin sends 50 whenlimitis left out. Gitea clampslimitto the instance’s MAX_RESPONSE_ITEMS (50 unless an admin lowered it), so a short page doesn’t mean the list ended. Paged lists return{ items, next_page }, withnext_pageset while a page has entries: steppageuntil it is null. - Files.
contents.getreturns a file’s metadata and base64 content;contents.raw,contents.media,repos.downloadArchiveand the Actions log and artifact downloads return the bytes as a file. Diffs, patches, signing keys and rendered markdown come back as{ text }. - Risk. Every delete is
destructive, as are site-admin changes to users and organizations, merging a pull request, moving a branch to another commit (branches.setCommit), applying a patch, transfers, renaming an organization and overwriting Actions secrets.admin.*needs a site-admin token. - Webhooks. Register one with
webhooks.create(ororgs.hooks.create,user.hooks.create,admin.hooks.create) usingtype: giteaand aconfig.secret, point it at your Corsair webhook URL, and give the plugin the same secret aswebhookSecret(or store it as the account’s webhook signature). Deliveries are checked againstX-Gitea-Signature(HMAC-SHA256 of the body) and routed byX-Gitea-Event-Typetopush,refCreated,refDeleted,fork,issues,issueComment,pullRequest,pullRequestReview,release,wiki,repository,status,workflowRun,workflowJobandpackage. - Not wrapped: four routes the swagger marks deprecated (each has a
replacement), and
users.tokenslist, create and delete, which Gitea only accepts with the account password (BasicAuth), not a token.
- 530 typed API operations
- 15 incoming webhook event types
Setup
1
Install
2
Add the plugin
corsair.ts
multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.3
Choose authentication
- API Key (Recommended)
Store the Gitea API key before the first call: More: API Key
pnpm corsair setup --plugin=gitea --tenant=acme api_key=<your-key> (leave out --tenant without multiTenancy), or pass it as key in the plugin options. With Hub, each tenant enters their own key on the connect page. See API key auth.4
Connect a tenant
Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see Connect / OAuth.
Example API calls
Get a repositoryWebhooks
This plugin registers 15 webhook event types. Configure the provider to POST to your Corsair HTTP handler, then usewebhookHooks on the plugin factory.
See Webhooks for every event path and payload shape, and Webhooks concept for routing.
What’s next
API reference
Every
gitea.api.* operation with input and output types.Webhooks
Event paths, payloads, and
webhookHooks examples.Connect / OAuth
createLink, Hub delivery, and tenant connect flows.
Use with agents
Expose this plugin’s operations as MCP tools.