> ## Documentation Index
> Fetch the complete documentation index at: https://scaleup-c34c4386.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# PATCH /api/v1/files/:id

> Atualiza os metadados de um arquivo existente

Atualiza os metadados de um arquivo existente, como o nome.

## Autenticação

> [!NOTE]
>
> Requer um token de acesso válido (`CHARGEFY_ACCESS_TOKEN`) no header `Authorization`.

## Parâmetros de Path

| Parâmetro | Tipo | Obrigatório | Descrição |
| - | - | - | - |
| `id` | `string` | Sim | ID do arquivo |

## Parâmetros do Body

| Parâmetro | Tipo | Obrigatório | Descrição |
| - | - | - | - |
| `name` | `string` | Não | Novo nome do arquivo |

## Campos da Resposta

Retorna o objeto completo do arquivo atualizado.

## Exemplo de Requisição

```bash cURL theme={null}
curl -X PATCH "https://api.chargefy.io/api/v1/files/file_abc123" \
  -H "Authorization: Bearer $CHARGEFY_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "guia-completo-v2.pdf"
  }'
```

```typescript SDK theme={null}
import { Chargefy } from '@chargefy/sdk';

const chargefy = new Chargefy({
  accessToken: process.env.CHARGEFY_ACCESS_TOKEN,
});

const file = await chargefy.files.update('file_abc123', {
  name: 'guia-completo-v2.pdf',
});
```

## Exemplo de Resposta

```json theme={null}
{
  "id": "file_abc123",
  "name": "guia-completo-v2.pdf",
  "mimeType": "application/pdf",
  "size": 2456789,
  "publicUrl": "https://cdn.chargefy.io/files/file_abc123/guia-completo-v2.pdf",
  "createdAt": "2026-02-15T10:00:00Z"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.