> ## 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.

# POST /api/v1/files/

> Faz upload de um novo arquivo via multipart form-data

Faz upload de um novo arquivo para a organização. O arquivo deve ser enviado como `multipart/form-data`.

## Autenticação

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

## Parâmetros do Body (multipart/form-data)

| Parâmetro | Tipo | Obrigatório | Descrição |
| - | - | - | - |
| `file` | `file` | Sim | Arquivo a ser enviado |
| `name` | `string` | Não | Nome personalizado para o arquivo |
| `organizationId` | `string` | Sim | ID da organização |

## Campos da Resposta

| Campo | Tipo | Descrição |
| - | - | - |
| `id` | `string` | ID do arquivo |
| `name` | `string` | Nome do arquivo |
| `mimeType` | `string` | Tipo MIME |
| `size` | `integer` | Tamanho em bytes |
| `publicUrl` | `string` | URL pública |
| `createdAt` | `datetime` | Data de criação |

## Exemplo de Requisição

```bash cURL theme={null}
curl -X POST "https://api.chargefy.io/api/v1/files/" \
  -H "Authorization: Bearer $CHARGEFY_ACCESS_TOKEN" \
  -F "file=@/caminho/para/ebook.pdf" \
  -F "name=ebook-guia-completo.pdf" \
  -F "organizationId=org_abc"
```

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

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

const file = await chargefy.files.create({
  file: fileBuffer,
  name: 'ebook-guia-completo.pdf',
  organizationId: 'org_abc',
});
```

## Exemplo de Resposta

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


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