# A deployment's build and deploy logs

Source: https://openpanel.sh/docs/api/deployments/a-deployment-s-build-and-deploy-logs

The build's output and the rollout's log, kept with the deployment, so they read even while its servers are offline. Each phase keeps its first 2 MiB; a longer build also keeps its last 200 lines.

`GET https://openpanel.sh/api/v1/deployments/{deploymentId}/logs`

## Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `deploymentId` | path | yes | The deployment's id. |
| `tail` | query | no | Only the last lines of each phase. |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 200 | A deployment's build and deploy logs | `application/json`, `DeploymentLogs` |
| 401 | No valid credential was sent. | `application/problem+json`, `Problem` |
| 403 | The credential may not do this. | `application/problem+json`, `Problem` |
| 404 | Not found, or not visible to this credential. | `application/problem+json`, `Problem` |
| 422 | The input was refused; detail says why. | `application/problem+json`, `Problem` |
| 429 | Too many requests; wait for Retry-After seconds. | `application/problem+json`, `Problem` |

## Schemas

### DeploymentLogs

```json
{
  "type": "object",
  "properties": {
    "deploymentId": {
      "type": "string",
      "format": "uuid"
    },
    "build": {
      "anyOf": [
        {
          "$ref": "#/components/schemas/LogPhase"
        },
        {
          "type": "null"
        }
      ],
      "description": "The build's output; null for an image deployment, or before the build starts."
    },
    "deploy": {
      "anyOf": [
        {
          "$ref": "#/components/schemas/LogPhase"
        },
        {
          "type": "null"
        }
      ],
      "description": "One line per event of the rollout on each server: image pulled, container started, healthy, …"
    }
  },
  "required": [
    "deploymentId",
    "build",
    "deploy"
  ]
}
```

### LogPhase

```json
{
  "type": "object",
  "properties": {
    "text": {
      "type": "string",
      "description": "The log as text, one line per line break."
    },
    "lines": {
      "type": "integer",
      "description": "Lines kept."
    },
    "bytes": {
      "type": "integer",
      "description": "Bytes kept, before compression."
    },
    "dropped": {
      "type": "integer",
      "description": "Lines of a long build left out after its first 2 MiB; its last 200 lines follow a line saying so."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "text",
    "lines",
    "bytes",
    "dropped",
    "updatedAt"
  ]
}
```

### Problem

```json
{
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "description": "A link to the error's explanation in the docs."
    },
    "title": {
      "type": "string"
    },
    "status": {
      "type": "integer"
    },
    "code": {
      "type": "string",
      "description": "Stable machine-readable code: not_found, forbidden, invalid, conflict, rate_limited, not_implemented, …"
    },
    "detail": {
      "type": "string",
      "description": "What went wrong, in a sentence written for a person."
    }
  },
  "required": [
    "type",
    "title",
    "status",
    "code",
    "detail"
  ]
}
```