REST API
Authentication, response format, pagination and the interactive reference.
Everything the web interface does runs through the documented REST API under /api/v1. Every instance serves the complete reference itself:
- interactive:
/api/docs– on codeny.org codeny.org/api/docs - as OpenAPI 3.1:
/api/v1/openapi.yaml
Authentication#
Scripts and tools send an access token in the header:
curl -H "Authorization: Bearer $CODENY_TOKEN" https://codeny.org/api/v1/userRead only tokens may only make GET requests. Modifying requests send JSON with Content-Type: application/json.
Response format#
{ "data": { "…": "…" }, "meta": { "page": 1, "per_page": 30, "total": 42 } }Errors always look like:
{ "error": { "code": "not_found", "message": "Repository not found", "details": {}, "request_id": "…" } }For validation errors (422) details names the field. The request_id helps administrators find a request in the server log.
Pagination#
Lists take page (from 1) and per_page (default 30, at most 100); meta.total gives the total count.
Examples#
# create a repository
curl -X POST -H "Authorization: Bearer $CODENY_TOKEN" -H "Content-Type: application/json" \
-d '{"name":"demo","visibility":"private","auto_init":true}' \
https://codeny.org/api/v1/repositories
# create an issue
curl -X POST -H "Authorization: Bearer $CODENY_TOKEN" -H "Content-Type: application/json" \
-d '{"title":"Login fails","body":"Steps to reproduce …"}' \
https://codeny.org/api/v1/repositories/<owner>/demo/issues
# read a file
curl -H "Authorization: Bearer $CODENY_TOKEN" \
"https://codeny.org/api/v1/repositories/<owner>/demo/contents/README.md?ref=main"Limits#
Sign-in, registration and Git with a password are limited to 10 attempts per minute (per IP and per login name). Code and commit search allow 30 requests per minute. When exceeded the API answers 429 with Retry-After.
Was this page helpful?