Docs / API
API
The REST API the app itself uses, and API tokens for CI and scripts.
Requests#
Every endpoint except sign-in, invitation links, health checks and the webhook needs a signed-in session or an API token. Endpoints about an organization take its name in the x-kodmos-org header, and changes need the roles above. Answers are JSON.
API tokens#
On Team and Business, make a token under Settings → API tokens and send it as Authorization: Bearer kodmos_…. A token belongs to one organization, so it needs no x-kodmos-org header. You see it once, when it is made; Kodmos keeps only a fingerprint.
- Yours: acts as you, never above your role at the time of each request, and stops working if you lose access.
- The organization’s (owner only): acts as a bot named after it, like
release-ci[bot], and keeps working when people leave.
Each token also has scopes, and every endpoint below needs one: Read for anything you can see, Answer to give branches, Plan for events and release trains, Deploy to deploy and run flows, and Edit flows. Deploy and Edit flows need a DevOps token. Your account, people, billing, Slack and tokens themselves only take a signed-in session.
Answer from CI#
Once a branch’s tests pass, CI can answer for its repository in the next open event that deploys it. It only needs the repository and the branch:
- name: Tell Kodmos the branch is ready
if: success()
run: |
curl -fsS -X POST "$KODMOS_URL/api/answers" \
-H "Authorization: Bearer $KODMOS_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"repo\": \"$GITHUB_REPOSITORY\", \"branch\": \"$GITHUB_REF_NAME\"}"
env:
KODMOS_URL: https://kodmos.example.com
KODMOS_TOKEN: ${{ secrets.KODMOS_TOKEN }}Send {"repo": …, "skip": true} to say the repository is not deploying this time, and eventId to answer for a particular event. If no open event deploys the repository, the answer is 404.
Endpoints#
| GET POST | /api/flows | List flows (?archived=1: archived ones), or create one |
| GET PUT DELETE | /api/flows/:id | Read a flow, save a new version, or archive it |
| GET POST | /api/flows/:id/runs | Run history, or start a run |
| GET | /api/runs/:id | A run, with its timeline |
| POST | /api/runs/:id/cancel | Cancel a run |
| GET POST | /api/events | List deployment events, or plan one |
| POST | /api/events/:id/items | Answer for a project: a branch, or not deploying |
| POST | /api/answers | Answer for a repository in the next open event that deploys it (for CI) |
| POST | /api/events/:id/status | Lock, reopen or cancel an event |
| GET POST | /api/events/:id/rollback | What a rollback would do, or roll the event back to what was live before it |
| POST | /api/events/:id/deploy | Deploy an event ({repin: true} deploys branches that moved since the lock) |
| GET | /api/deployments | Deploy history for ?repo=&environment=, or where ?sha= was deployed |
| GET | /api/deployments/live | What is live in each repository and environment |
| GET | /api/audit | The audit log (?format=csv to export) |
| GET | /api/plan | The organization’s plan, trial and repositories |
| GET | /api/me | Who the session or token acts as, its role and, for a token, its scopes |
| GET | /api/health | The server is up and reaches its database |