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

# Add component

` POST /status-pages/{id}/components `

Add component

## Servers

- ` https://happyuptime.com/api/v1 `

## Authentication

The operation accepts these alternatives. Schemes within one alternative are required together.

### Alternative 1

- ` bearerAuth `: ` http `

  - HTTP scheme: ` bearer ` (hu_api_key)

  - API key with `hu_` prefix. Send exactly `Authorization: Bearer hu_...`. `X-API-Key` is not supported. Create keys in Dashboard → Settings → API Keys.

## Parameters

### ` id ` (path, required)

- ` value `: type ` string `

## Request body (required)

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` name `

  - ` name `: type ` string `

    - minLength: ` 1 `

    - maxLength: ` 100 `

  - ` description `: type ` unknown `

    - ` anyOf alternative 1 `: type ` string `

    - ` anyOf alternative 2 `: type ` null `

  - ` monitor_id `: type ` unknown `

    - ` anyOf alternative 1 `: type ` string `

    - ` anyOf alternative 2 `: type ` null `

## Responses

### ` 201 ` — Component added

## Request examples

### cURL

```curl
curl -X POST 'https://happyuptime.com/api/v1/status-pages/string/components' \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "description": "string",
  "monitor_id": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://happyuptime.com/api/v1/status-pages/string/components', {
  method: 'POST',
  headers: {
      "Authorization": "Bearer YOUR_API_TOKEN",
      "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "name": "string",
    "description": "string",
    "monitor_id": "string"
  })
});

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

### Python

```python
import requests

headers = {
    'Authorization': 'Bearer YOUR_API_TOKEN'
}

response = requests.post('https://happyuptime.com/api/v1/status-pages/string/components', headers=headers, json={
  "name": "string",
  "description": "string",
  "monitor_id": "string"
})
print(response.json())
```