Skip to content

Query step-level logs of a workflow job

POST /api/v8/repos/{owner}/{repo}/actions/runs/{run_id}/jobs/{job_id}/logs

Call this endpoint to query the step-level logs of a workflow job.

Access token support

  • AtomGit user access tokens

Anonymous access

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes Address path of the namespace that owns the repository (organization or personal address path)
repo path string Yes Repository path (path)
run_id path string Yes Pipeline run ID
job_id path string Yes Job ID
access_token query string Yes User authorization code

Request Body:

The request body is in JSON format and contains the following fields:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "step_id": {
      "description": "Step run ID",
      "type": "string"
    },
    "offset": {
      "description": "Log start offset, used for incremental pagination. Pass 0 for the first page; for ascending order, pass the end_offset returned previously; for descending order, pass the start_offset returned previously",
      "type": "integer"
    },
    "limit": {
      "description": "Maximum number of log entries returned in this response",
      "type": "integer"
    },
    "sort": {
      "description": "Sort order (asc/desc)",
      "type": "string",
      "enum": ["asc", "desc"]
    }
  },
  "required": ["step_id", "offset", "limit", "sort"]
}

Response parameters

Field Type Always returned Nullable Description
has_more boolean Yes No Whether there are more logs
start_offset integer Yes No Start offset of the logs returned in this response
end_offset integer Yes No End offset of the logs returned in this response
log string Yes No Log content

Error responses

400 Invalid parameters

{
  "error": "invalid_request",
  "message": "Invalid request parameters"
}

401 Unauthenticated

{
  "error": "unauthorized",
  "message": "Missing or invalid access token"
}

The above are examples of generic error responses; the specific error field names returned by the backend take precedence.

HTTP response status codes

Status code Description
200 Success (OK)
401 Requires authentication
403 Forbidden
404 Not found

Request example

Parameter notes

<owner> is replaced with the address path of the namespace that owns the repository (enterprise, organization, or personal address path); <repo> is replaced with the repository path; <run_id> is replaced with the pipeline run ID; <job_id> is replaced with the job ID; <token> is replaced with your AtomGit user access token.

cURL

curl -X POST 'https://api.atomgit.com/api/v8/repos/<owner>/<repo>/actions/runs/<run_id>/jobs/<job_id>/logs?access_token=<token>' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{
    "step_id": "step_1",
    "offset": 0,
    "limit": 100,
    "sort": "asc"
  }'

JavaScript

// Native fetch (Node.js 18+ / browser)
const response = await fetch("https://api.atomgit.com/api/v8/repos/<owner>/<repo>/actions/runs/<run_id>/jobs/<job_id>/logs?access_token=<token>", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json",
  },
  body: JSON.stringify({
    step_id: "step_1",
    offset: 0,
    limit: 100,
    sort: "asc",
  }),
});

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.post(
    "https://api.atomgit.com/api/v8/repos/<owner>/<repo>/actions/runs/<run_id>/jobs/<job_id>/logs",
    params={"access_token": "<token>"},
    headers={
        "Content-Type": "application/json",
        "Accept": "application/json",
    },
    json={
        "step_id": "step_1",
        "offset": 0,
        "limit": 100,
        "sort": "asc",
    },
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "has_more": true,
  "start_offset": 0,
  "end_offset": 0,
  "log": "string"
}

Error codes

Error code Description
401 Unauthenticated or invalid credentials (missing or invalid access token)
403 Forbidden
404 The request path does not exist
429 Too many requests; rate limit triggered
500 Internal server error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc