---
title: Send CI job logs
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > CI Visibility Logs
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Send CI job logs{% #send-ci-job-logs %}

{% tab title="v2" %}

| Datadog site      | API endpoint                                                  |
| ----------------- | ------------------------------------------------------------- |
| ap1.datadoghq.com | POST https://http-intake.logs.ap1.datadoghq.com/api/v2/cilogs |
| ap2.datadoghq.com | POST https://http-intake.logs.ap2.datadoghq.com/api/v2/cilogs |
| app.datadoghq.eu  | POST https://http-intake.logs.datadoghq.eu/api/v2/cilogs      |
| uk1.datadoghq.com | POST https://http-intake.logs.uk1.datadoghq.com/api/v2/cilogs |
| app.datadoghq.com | POST https://http-intake.logs.datadoghq.com/api/v2/cilogs     |
| us3.datadoghq.com | POST https://http-intake.logs.us3.datadoghq.com/api/v2/cilogs |
| us5.datadoghq.com | POST https://http-intake.logs.us5.datadoghq.com/api/v2/cilogs |
| app.ddog-gov.com  | POST Not supported in the GOV region                          |
| us2.ddog-gov.com  | POST Not supported in the GOV2 region                         |

### Overview



Send log lines for a CI job over HTTP. See the [CI Visibility Pipelines API](https://docs.datadoghq.com/api/latest/ci-visibility-pipelines/send-pipeline-event.md) for submitting the associated pipeline and job events.

A request can contain one log object or an array of up to 1,000 log objects. The maximum uncompressed request body size is 5.1 MiB.

You can stream log lines while a CI job runs or send them after it finishes. After you submit the completed job event, 20 seconds without a new log line marks the job's logs as complete. Lines sent after that may not appear.

A job can have up to 128 additional attributes and 256 tags. Additional attributes are top-level fields with string, number, Boolean, or null values. Nested objects and arrays are rejected. Additional attributes and `ddtags` apply to all log lines in the job. If an additional attribute has different values on different lines, the first value received is used. Tags supplied on different lines are combined. A job can contain up to 2,000,000 log records or 1 GiB of message bytes in total.

To reduce request size, send gzip-compressed JSON with the `Content-Encoding: gzip` header. Retry requests after a 408, 429, 500, or 503 response.



### Arguments

#### Header Parameters

| Name             | Type   | Description                                         |
| ---------------- | ------ | --------------------------------------------------- |
| Content-Encoding | string | HTTP header used to compress the JSON request body. |

### Request

#### Body Data (required)

CI job log line or batch in JSON format.

{% tab title="Model" %}

| Field              | Type      | Description                                                                                                                                                                                                             |
| ------------------ | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ddtags             | string    | Comma-separated `key:value` tags. A job can have up to 256 tags, including repeated keys.                                                                                                                               |
| job_id             | string    | The job event's `resource.id`, sent through the CI Visibility pipeline API.                                                                                                                                             |
| line_number        | int64     | The line number in the job log. Use 0 or 1 for the first line.                                                                                                                                                          |
| message            | string    | The non-empty log line message.                                                                                                                                                                                         |
| pipeline_unique_id | string    | The `resource.unique_id` of the pipeline event, which must also match the job event's `resource.pipeline_unique_id`.                                                                                                    |
| provider_name      | string    | The provider name sent with the pipeline event. It defaults to `custom` when omitted and, when provided, must be non-empty and cannot contain a comma.                                                                  |
| section_name       | string    | The provider-defined section containing this log line, used to display collapsible groups of lines in the CI job log view.                                                                                              |
| status             | string    | The status of this log line. Any string is accepted. Datadog maps non-empty values to a standard log status. See [status mapping](https://docs.datadoghq.com/logs/log_configuration/processors/log_status_remapper.md). |
| timestamp          | date-time | The log line time in RFC 3339 format with an explicit timezone. If omitted, the intake time is used. It can be at most 18 hours in the past or 12 hours in the future.                                                  |

{% /tab %}

{% tab title="Example" %}
##### 

```json
[
  {
    "message": "Starting tests",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 1,
    "status": "notice",
    "section_name": "tests"
  },
  {
    "message": "Tests passed",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "line_number": 2
  }
]
```

##### 

```json
[
  {
    "message": "Running go test ./...",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "job_id": "job-456",
    "provider_name": "example-provider",
    "line_number": 1,
    "status": "warn",
    "section_name": "tests",
    "ddtags": "runner:linux,architecture:amd64"
  }
]
```

{% /tab %}

### Response

{% tab title="202" %}
Request accepted for processing
{% tab title="Model" %}

| Field | Type | Description |
| ----- | ---- | ----------- |

{% /tab %}

{% tab title="Example" %}

```json
{}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
Bad Request
{% tab title="Model" %}
Request errors returned by the CI logs intake API.

| Parent field | Field  | Type     | Description       |
| ------------ | ------ | -------- | ----------------- |
|              | errors | [object] | Request errors.   |
| errors       | detail | string   | Error details.    |
| errors       | status | string   | HTTP status code. |
| errors       | title  | string   | Error title.      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Malformed payload",
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="401" %}
Unauthorized
{% tab title="Model" %}
Authentication and authorization errors returned by the CI logs intake API.

| Field  | Type     | Description     |
| ------ | -------- | --------------- |
| errors | [string] | Error messages. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Forbidden",
    "API key is missing or invalid"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="403" %}
Forbidden
{% tab title="Model" %}
Authentication and authorization errors returned by the CI logs intake API.

| Field  | Type     | Description     |
| ------ | -------- | --------------- |
| errors | [string] | Error messages. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Forbidden",
    "API key is missing or invalid"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="408" %}
Request Timeout
{% tab title="Model" %}
Request errors returned by the CI logs intake API.

| Parent field | Field  | Type     | Description       |
| ------------ | ------ | -------- | ----------------- |
|              | errors | [object] | Request errors.   |
| errors       | detail | string   | Error details.    |
| errors       | status | string   | HTTP status code. |
| errors       | title  | string   | Error title.      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Malformed payload",
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="413" %}
Payload Too Large
{% tab title="Model" %}
Request errors returned by the CI logs intake API.

| Parent field | Field  | Type     | Description       |
| ------------ | ------ | -------- | ----------------- |
|              | errors | [object] | Request errors.   |
| errors       | detail | string   | Error details.    |
| errors       | status | string   | HTTP status code. |
| errors       | title  | string   | Error title.      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Malformed payload",
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="429" %}
Too Many Requests
{% tab title="Model" %}
Request errors returned by the CI logs intake API.

| Parent field | Field  | Type     | Description       |
| ------------ | ------ | -------- | ----------------- |
|              | errors | [object] | Request errors.   |
| errors       | detail | string   | Error details.    |
| errors       | status | string   | HTTP status code. |
| errors       | title  | string   | Error title.      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Malformed payload",
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```

{% /tab %}

{% /tab %}

### Code Example

##### 
                          \## Single CI job log line
# 
 \# Curl command curl -X POST "https://http-intake.logs.datadoghq.com/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "ddtags": "runner:linux,architecture:amd64",
    "job_id": "job-456",
    "line_number": 812,
    "message": "Running go test ./...",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "provider_name": "example-provider",
    "section_name": "tests",
    "status": "warn",
    "stream": "stdout"
  }
]
EOF \## Multiple CI job log lines
# 
 \# Curl command curl -X POST "https://http-intake.logs.datadoghq.com/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "job_id": "job-456",
    "line_number": 1,
    "message": "Running go test ./...",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a"
  },
  {
    "job_id": "job-456",
    "line_number": 2,
    "message": "Tests passed",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a"
  }
]
EOF 
                        
##### 
                          \## Single CI job log line
# 
 \# Curl command curl -X POST "https://http-intake.logs.datadoghq.com/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "ddtags": "runner:linux,architecture:amd64",
    "job_id": "job-456",
    "line_number": 812,
    "message": "Running go test ./...",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
    "provider_name": "example-provider",
    "section_name": "tests",
    "status": "warn",
    "stream": "stdout"
  }
]
EOF \## Multiple CI job log lines
# 
 \# Curl command curl -X POST "https://http-intake.logs.datadoghq.com/api/v2/cilogs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
[
  {
    "job_id": "job-456",
    "line_number": 1,
    "message": "Running go test ./...",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a"
  },
  {
    "job_id": "job-456",
    "line_number": 2,
    "message": "Tests passed",
    "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a"
  }
]
EOF 
                        
{% /tab %}
