GitHub Builds

Use these endpoints to trigger GitHub builds manually, list history, inspect a specific build, and read incremental pipeline logs.

These logs are different from GET /project/:id/logs. GET /project/:id/logs returns logs from the running application; the endpoints below return logs from the GitHub build pipeline.

Trigger a manual build

POST /project/:id/github/deploy

Body

FieldTypeRequiredDescription
branchstringNoBranch used for the build. When omitted, the API uses the branch configured on the project
commit_shastringNoSpecific commit used to trigger the build

Response

{
  "status": "success",
  "message": "Build triggered successfully",
  "data": {
    "build_id": "665f1f77bcf86cd799439011"
  }
}

List project builds

GET /project/:id/github/builds

Query

FieldTypeRequiredDescription
pagenumberNoCurrent page. Default 1
limitnumberNoPage size. Default 10, maximum 50
branchstringNoFilters by branch
statusstringNoFilters by pending, building, success, or failed

Response

{
  "status": "success",
  "message": "builds listed successfully",
  "data": [
    {
      "id": "665f1f77bcf86cd799439011",
      "commit_sha": "abc123def456789012345678901234567890abcd",
      "branch": "main",
      "status": "success",
      "started_at": "2026-06-03T14:10:00.000Z",
      "finished_at": "2026-06-03T14:11:09.000Z",
      "triggered_by": "manual",
      "created_at": "2026-06-03T14:10:00.000Z",
      "updated_at": "2026-06-03T14:11:09.000Z"
    }
  ],
  "pagination": {
    "total": 12,
    "page": 1,
    "limit": 10
  }
}

Get a specific build

GET /project/:id/github/builds/:buildId

Response

{
  "status": "success",
  "message": "build retrieved successfully",
  "data": {
    "id": "665f1f77bcf86cd799439011",
    "commit_sha": "abc123def456789012345678901234567890abcd",
    "branch": "main",
    "status": "pending",
    "triggered_by": "manual",
    "created_at": "2026-06-03T14:10:00.000Z",
    "updated_at": "2026-06-03T14:10:00.000Z"
  }
}

Get incremental build logs

GET /project/:id/github/builds/:buildId/logs

Query

FieldTypeRequiredDescription
cursornumberNoLast consumed sequence. Default 0
limitnumberNoMaximum number of chunks. Default 200, maximum 500

Response

{
  "status": "success",
  "message": "build logs retrieved successfully",
  "data": {
    "logs": [
      {
        "sequence": 1,
        "timestamp": "2026-06-03T14:10:01.000Z",
        "level": "info",
        "step": "build",
        "message": "npm ci",
        "final": false
      }
    ],
    "next_cursor": 1,
    "status": "building",
    "finished": false,
    "truncated": false
  }
}

Use next_cursor in the next request to fetch only new lines.

How to interpret it

FieldDescription
logsIncremental list of public build lines
next_cursorLast returned sequence
statusCurrent build state
finishedtrue when the build ended with success or failed
truncatedtrue when the public log was truncated to protect platform stability

Retention

GitHub build history is retained for up to:

  • 30 builds per project
  • 30 days of age

Whichever limit comes first removes the oldest records, together with their log chunks.

Polling example

curl -X GET "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/github/builds/665f1f77bcf86cd799439011/logs?cursor=0&limit=200" \
  -H "x-api-key: your-api-key" \
  -H "x-organization-id: your-organization-id"

Next steps