Skip to content

Authentication

Every automated call uses an access token. Humans sign in to the website with email and password (plus optional MFA). Git and the API do not use the account password.

GET /v1/account/usage HTTP/1.1
Host: api.amendable.io
access-token: YOUR_TOKEN

There is no Authorization header. The header name is access-token.

Terminal window
curl -sS https://api.amendable.io/v1/account/usage \
-H "access-token: $AMENDABLE_TOKEN"
https://amendable.io/r/<username>/<repo>.git

HTTP Basic:

  • Username: your Amendable username (the token lookup uses the password, so a dummy username can work, but using the real username keeps credential helpers sane)
  • Password: the access token

The token needs GIT_HTTP_READ to clone and GIT_HTTP_WRITE to push.

https://amendable.io/access-tokens/create

Leave Grant All Permissions on unless you know you want a narrower token.

Terminal window
amendable login

This calls POST https://api.amendable.io/v1/auth/sessions with your hostname, prints a code, and opens:

https://amendable.io/access-tokens/create?auth_session_id=<uuid>

Confirm the code matches, grant the token, and the CLI polls GET /v1/auth/sessions/{id}/poll?secret_token=... until it receives the secret. Poll returns 202 until you grant.

Those session routes are omitted from the public OpenAPI schema (include_in_schema=False) but they work. If you call create yourself, poll HTTPS https://api.amendable.io/v1/auth/sessions/{id}/poll. Ignore a poll_url field if it is http://.

Creating tokens via API requires the calling token to have grant ALL and scope ALL_REPO.

Terminal window
curl -sS -X POST https://api.amendable.io/v1/access-tokens \
-H "access-token: $AMENDABLE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "ci-readwrite",
"scope": "ALL_REPO",
"grants": ["GIT_HTTP_READ", "GIT_HTTP_WRITE", "API_REPOS_WRITE"]
}'

The secret is in token on this response only.

Create a trust rule, then:

Terminal window
curl -sS -X POST https://api.amendable.io/v1/oidc/token \
-H "Content-Type: application/json" \
-d "{\"id_token\": \"$ID_TOKEN\"}"

No access-token header on this call. The response is a short-lived token (15 minutes) plus expires_at.

See OIDC for machines.

VariableMeaning
AMENDABLE_TOKENAccess token (overrides the config file)
AMENDABLE_API_URLDefault https://api.amendable.io. Staging: https://stage.api.amendable.io
AMENDABLE_APP_URLDefault https://amendable.io. Staging: https://stage.amendable.io
AMENDABLE_USERNAMEUsed when you pass a bare repo name
AMENDABLE_CONFIGPath to the TOML config file

Config file default: ~/.config/amendable/config.toml.