# Get a service

Source: https://openpanel.sh/docs/api/services/get-a-service

`GET https://openpanel.sh/api/v1/services/{serviceId}`

## Parameters

| Name | In | Required | Description |
|---|---|---|---|
| `serviceId` | path | yes | The service's id. |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 200 | Get a service | `application/json`, `Service` |
| 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

### HealthCheck

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "http"
        },
        "port": {
          "type": "integer"
        },
        "path": {
          "type": "string"
        },
        "intervalSeconds": {
          "type": "integer"
        },
        "timeoutSeconds": {
          "type": "integer"
        },
        "retries": {
          "type": "integer"
        }
      },
      "required": [
        "kind",
        "port",
        "path",
        "intervalSeconds",
        "timeoutSeconds",
        "retries"
      ]
    },
    {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "tcp"
        },
        "port": {
          "type": "integer"
        },
        "intervalSeconds": {
          "type": "integer"
        },
        "timeoutSeconds": {
          "type": "integer"
        },
        "retries": {
          "type": "integer"
        }
      },
      "required": [
        "kind",
        "port",
        "intervalSeconds",
        "timeoutSeconds",
        "retries"
      ]
    }
  ]
}
```

### Port

```json
{
  "type": "object",
  "properties": {
    "protocol": {
      "type": "string",
      "enum": [
        "http",
        "tcp",
        "udp"
      ]
    },
    "port": {
      "type": "integer",
      "description": "The container's port."
    },
    "edgePort": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "For a public TCP or UDP port: the port on the edge that reaches it."
    },
    "loopbackPort": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "For a private service: its port on the server's 127.0.0.1, which the private network reaches."
    }
  },
  "required": [
    "protocol",
    "port",
    "edgePort",
    "loopbackPort"
  ]
}
```

### 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"
  ]
}
```

### Service

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "organizationId": {
      "type": "string"
    },
    "projectId": {
      "type": "string",
      "format": "uuid"
    },
    "environmentId": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "source": {
      "$ref": "#/components/schemas/Source"
    },
    "build": {
      "anyOf": [
        {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "auto"
                }
              },
              "required": [
                "kind"
              ]
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "dockerfile"
                },
                "dockerfile": {
                  "type": "string"
                },
                "context": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "dockerfile",
                "context"
              ]
            }
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "startCommand": {
      "type": [
        "string",
        "null"
      ]
    },
    "exposure": {
      "type": "string",
      "enum": [
        "public",
        "private",
        "none"
      ]
    },
    "balancer": {
      "type": "boolean"
    },
    "replicas": {
      "type": "integer"
    },
    "ports": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Port"
      }
    },
    "healthCheck": {
      "anyOf": [
        {
          "$ref": "#/components/schemas/HealthCheck"
        },
        {
          "type": "null"
        }
      ]
    },
    "resources": {
      "type": "object",
      "properties": {
        "cpus": {
          "type": "number"
        },
        "memoryMb": {
          "type": "integer"
        }
      }
    },
    "serverIds": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uuid"
      }
    },
    "volumes": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Volume"
      }
    },
    "deploymentId": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "description": "The deployment that runs now."
    },
    "createdBy": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "organizationId",
    "projectId",
    "environmentId",
    "name",
    "source",
    "build",
    "startCommand",
    "exposure",
    "balancer",
    "replicas",
    "ports",
    "healthCheck",
    "resources",
    "serverIds",
    "volumes",
    "deploymentId",
    "createdBy",
    "createdAt",
    "updatedAt"
  ]
}
```

### Source

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "git"
        },
        "accountId": {
          "type": "string",
          "format": "uuid"
        },
        "repo": {
          "type": "string"
        },
        "branch": {
          "type": "string"
        },
        "path": {
          "type": "string"
        }
      },
      "required": [
        "kind",
        "accountId",
        "repo",
        "branch",
        "path"
      ]
    },
    {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "image"
        },
        "image": {
          "type": "string"
        },
        "tag": {
          "type": "string"
        }
      },
      "required": [
        "kind",
        "image",
        "tag"
      ]
    },
    {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "const": "template"
        },
        "template": {
          "type": "string"
        },
        "version": {
          "type": "string"
        }
      },
      "required": [
        "kind",
        "template"
      ]
    }
  ]
}
```

### Volume

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "mountPath": {
      "type": "string"
    },
    "sizeGb": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "serverId": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "description": "The server its data lives on, set at the first deploy."
    }
  },
  "required": [
    "id",
    "mountPath",
    "sizeGb",
    "serverId"
  ]
}
```