> ## Documentation Index
> Fetch the complete documentation index at: https://docs.instapods.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Services

> Install and manage database services inside pods.

On-demand database services that run inside your pod. Available services: MySQL, PostgreSQL, and Redis.

<Note>
  Services require the **Build** plan or higher. Pods on the Launch plan will receive a `403` error.
</Note>

## List Services

```
GET /api/pods/{name}/services
```

**Response: `200 OK`**

```json theme={null}
[
  {
    "id": "svc_abc123",
    "pod_name": "my-app",
    "service_type": "mysql",
    "status": "running",
    "version": "8.0",
    "port": 3306,
    "host": "localhost",
    "created_at": "2026-02-20T10:00:00Z",
    "updated_at": "2026-02-20T10:05:00Z"
  }
]
```

Returns `[]` when no services are installed. Failed services include an `error_msg` field.

**Service statuses:** `installing`, `running`, `stopped`, `error`

## Install a Service

```
POST /api/pods/{name}/services
```

**Request Body:**

```json theme={null}
{
  "service_type": "mysql"
}
```

Valid types: `mysql`, `postgresql`, `redis`

**Response: `202 Accepted`**

Returns the service object with `status: "installing"`. Installation runs in the background — poll the list endpoint until status changes to `running`.

| Defaults     | MySQL    | PostgreSQL | Redis |
| ------------ | -------- | ---------- | ----- |
| **Port**     | 3306     | 5432       | 6379  |
| **Version**  | 8.0      | 14         | 7     |
| **Username** | instapod | instapod   | —     |
| **Database** | instapod | instapod   | —     |

**Errors:**

| Code  | Reason                                |
| ----- | ------------------------------------- |
| `400` | Invalid service type, pod not running |
| `403` | Launch plan — upgrade required        |
| `409` | Service already installed             |

## Remove a Service

```
DELETE /api/pods/{name}/services/{serviceType}
```

**Response: `200 OK`**

```json theme={null}
{
  "status": "deleted"
}
```

## Get Credentials

```
GET /api/pods/{name}/services/{serviceType}/credentials
```

**Response: `200 OK`**

```json theme={null}
{
  "service_type": "mysql",
  "status": "running",
  "host": "localhost",
  "port": 3306,
  "username": "instapod",
  "password": "auto-generated-password",
  "database": "instapod"
}
```

Credentials are auto-generated during installation. The password is randomly generated and stored in the database.

### Connection Examples

**MySQL:**

```bash theme={null}
mysql -u instapod -p'PASSWORD' -h localhost instapod
```

**PostgreSQL:**

```bash theme={null}
psql -U instapod -h localhost instapod
```

**Redis:**

```bash theme={null}
redis-cli -h localhost -p 6379
```
