# Update the status of a topic

`PUT /t/{id}/status.json`

Authentication: no security requirement declared for this operation.

Parameters:

- `Api-Key` (header, string, required)
  Type: string

- `Api-Username` (header, string, required)
  Type: string

- `id` (path, string, required)
  Type: string

Request body: application/json

Type: object

- `status` (required)
  Type: string
  
  enum: ["closed","pinned","pinned_globally","archived","visible"]

- `enabled` (required)
  Type: string
  
  enum: ["true","false"]

- `until` (optional)
  Type: string
  
  Only required for `pinned` and `pinned_globally`
  
  Example:
  
  ```json
  "2030-12-31"
  ```

Responses:

- 200: topic updated

Content type: application/json

Type: object

- `success` (optional)
  Type: string
  
  Example:
  
  ```json
  "OK"
  ```

- `topic_status_update` (optional)
  Type: string; nullable

## Examples

### cURL

```bash
curl -X PUT 'https://discourse.example.com/t/string/status.json' \
  -H 'Api-Key: string' \
  -H 'Api-Username: string' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "status": "closed",
  "enabled": "true",
  "until": "2030-12-31"
}'
```

### JavaScript

```javascript
const body = `{
  "status": "closed",
  "enabled": "true",
  "until": "2030-12-31"
}`;

const response = await fetch('https://discourse.example.com/t/string/status.json', {
  method: 'PUT',
  headers: {
    'Api-Key': 'string',
    'Api-Username': 'string',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "status": "closed",
  "enabled": "true",
  "until": "2030-12-31"
}'''

response = requests.put(
    'https://discourse.example.com/t/string/status.json',
    data=body.encode('utf-8'),
    headers={
        'Api-Key': 'string',
        'Api-Username': 'string',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
