Skip to content

API Authentication

To interact with the OpenCodeHub API programmatically, you need an API 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).

Terminal window
och auth login
cat ~/.ochrc

The token field in your ~/.ochrc file is a valid Bearer token.

Pass the token in the HTTP Authorization header.

GET /api/users/me HTTP/1.1
Host: git.example.com
Authorization: Bearer eyJhbGciOiJIUz...

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.