Using the garnix API
garnix offers an API for programmatic access.
Create an access token
- Log into your garnix account
- Navigate to the account page
- Generate an access token with the API scope
Create a JWT
The garnix API uses short-lived JWTs for actual API requests.
Create one using basic auth:
curl -XPOST --basic --user "YOUR_GITHUB_USERNAME:YOUR_ACCESS_TOKEN" https://api.garnix.io/auth/jwt
Make API requests
Use the JWT as a bearer token in the Authorization header:
curl -H "Authorization: Bearer YOUR_JWT" https://api.garnix.io/whoami
Example: Retrieving Build Status and Logs
JWT="YOUR_JWT" # This is an example commit from a public repo. # With a valid JWT this should work for all # public repos and for private repos that you # have access to. COMMIT="fbd9865a68c8f7f4bd9d4e136f27be04098fe1ee" # Select the first build of the commit BUILD_ID=$(curl -sH "Authorization: Bearer $JWT" https://api.garnix.io/commits/$COMMIT | jq -r '.builds.[0] | .id') echo "Logs for build $BUILD_ID:" curl -sH "Authorization: Bearer $JWT" https://api.garnix.io/build/$BUILD_ID/logs/raw echo "Status for build $BUILD_ID:" curl -sH "Authorization: Bearer $JWT" https://api.garnix.io/build/$BUILD_ID | jq -r .status
Unfortunately we do not have full API documentation yet. If you are using the API, we would love feedback via email or on Discord/Matrix.