# Update Application (PUT)

Update an existing application's details.

## Endpoint

```
PUT https://api.pocketalert.app/v1/applications/{tid}
```

## Authentication

> **Info: Required**
>
> Include one of these headers in your request:
> - `Token: <your-api-key>` — Get it from [API Keys](https://pocketalert.app/account/apikeys)
> - `Authorization: Bearer <jwt-token>` — From [Login](https://info.pocketalert.app/api/user/login.md)

## Request

### Path Parameters

| Parameter | Type | Required | Description |
|-----------|------|:--------:|-------------|
| `tid` | string | ✅ | Application unique identifier |

### Headers

| Header | Required | Description |
|--------|:--------:|-------------|
| `Content-Type` | ✅ | `application/json` |
| `Token` | ✅ | Your API key |
| `Authorization` | ✅ | `Bearer <jwt-token>` |

### Body Parameters

| Parameter | Type | Required | Description |
|-----------|------|:--------:|-------------|
| `name` | string | ✅ | New application name |

### Example Request

**cURL**

```bash
curl -X PUT "https://api.pocketalert.app/v1/applications/sozb3yswlwoqdd1l1msi1nnh" \
  -H "Token: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New Application Name"
  }'
```

**JavaScript**

```javascript
const tid = 'sozb3yswlwoqdd1l1msi1nnh';

const response = await fetch(`https://api.pocketalert.app/v1/applications/${tid}`, {
  method: 'PUT',
  headers: {
    'Token': 'your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'New Application Name'
  })
});

const result = await response.json();
```

**Python**

```python
import requests

tid = 'sozb3yswlwoqdd1l1msi1nnh'

response = requests.put(
    f'https://api.pocketalert.app/v1/applications/{tid}',
    headers={
        'Token': 'your-api-key',
        'Content-Type': 'application/json'
    },
    json={'name': 'New Application Name'}
)

print(response.json())
```

**PHP**

```php
$tid = 'iemkz2tlbakj4lgns961ohx0o';
$response = Http::withHeaders([
    'Token' => 'your-api-key',
])->put('https://api.pocketalert.app/v1/applications/'.$tid, [
    'name' => 'Updated Name',
]);

return $response->json();
```

## Response

### Success Response

> **Tip: 200 OK**
>
> Application updated successfully

```json
{
  "data": "success"
}
```

### Error Responses

| Status | Description |
|:------:|-------------|
| `401` | Unauthorized — Invalid or missing token |
| `404` | Not Found — Application does not exist |
| `422` | Validation Error — Name is required |
