API Authentication
To interact with the OpenCodeHub API programmatically, you need an API Token.
Obtaining a Token
Section titled “Obtaining a Token”Currently, you can obtain a token by logging in via the CLI or inspecting your session. (Future updates will allow generating persistent Personal Access Tokens (PATs) from the UI settings).
Via CLI
Section titled “Via CLI”och auth logincat ~/.ochrcThe token field in your ~/.ochrc file is a valid Bearer token.
Using the Token
Section titled “Using the Token”Pass the token in the HTTP Authorization header.
GET /api/users/me HTTP/1.1Host: git.example.comAuthorization: Bearer eyJhbGciOiJIUz...Session Cookies
Section titled “Session Cookies”If you are developing a browser-based integration (like a plugin), you can also rely on the standard och_session cookie if the user is logged in to the browser.