## POST /api/v2/support/attachments

**Upload support attachment**

Upload one support attachment using `multipart/form-data`. Send `file` as the binary part. Include `ticketId` only when pinning the upload to an existing ticket; use the public `tkt_...` value from `GET /api/v2/support/tickets` or `GET /api/v2/support/tickets/{id}`. The returned `attachmentId` is a temporary `satt_...` upload ID, not the finalized `tatt_...` ticket-attachment ID that appears on ticket detail responses after a message is stored.

### Related Endpoints

- `GET /api/v2/support/attachments/{id}`: Download support attachment
- `GET /api/v2/support/tickets`: List support tickets
- `POST /api/v2/support/tickets`: Create support ticket

### Headers

- `Accept`: application/json
- `Authorization`: Bearer YOUR_API_KEY
- Required API scope: `write:support`

### Request Example

```bash
curl -X POST "https://cloud.hostup.se/api/v2/support/attachments" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: application/json"
```

### Response Schema

- `attachmentId` (string, required): Temporary support attachment upload ID with the `satt_...` prefix. Example: `satt_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `url` (string, required): Temporary upload URL stored for the support workflow. Do not use this as a ticket attachment download URL. Example: `https://files.example.com/support/satt_01hxa3b4c5d6e7f8g9h0j1k2m3/error-log.txt`
- `filename` (string, required): Sanitized file name. Example: `error-log.txt`
- `byteLength` (number, required): Uploaded file size in bytes. Example: `18342`
- `contentType` (string, required): Detected MIME type after upload validation. Example: `text/plain`
- `uploadedAt` (string, required) Example: `2026-04-27T12:00:00.000Z`
- `ticketId` (string,null, required): Public ticket ID the upload was pinned to, or null when uploaded without a ticket target. Example: `tkt_01hxa3b4c5d6e7f8g9h0j1k2m3`

### Responses

#### 201 - Uploaded support attachment.
```json
{
  "attachmentId": "satt_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "url": "https://files.example.com/support/satt_01hxa3b4c5d6e7f8g9h0j1k2m3/error-log.txt",
  "filename": "error-log.txt",
  "byteLength": 18342,
  "contentType": "text/plain",
  "uploadedAt": "2026-04-27T12:00:00.000Z",
  "ticketId": "tkt_01hxa3b4c5d6e7f8g9h0j1k2m3"
}
```

#### 400 - Invalid multipart request or rejected file.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Invalid request",
  "status": 400,
  "detail": "`file` field is required.",
  "instance": "/api/v2/support/attachments",
  "code": "invalid_request",
  "errors": [
    {
      "pointer": "/file",
      "detail": "`file` field is required.",
      "code": "invalid_request"
    }
  ]
}
```

#### 401 - Unauthorized. Authentication is required.
```json
{
  "type": "https://developer.hostup.se/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authentication is required.",
  "code": "unauthorized",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 403 - Forbidden. The caller lacks a required scope or does not own the resource.
```json
{
  "type": "https://developer.hostup.se/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "The caller lacks a required scope or does not own the resource.",
  "code": "forbidden",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 404 - Referenced ticket was not found or is not visible to the caller.
```json
{
  "type": "https://developer.hostup.se/errors/ticket_not_found",
  "title": "Ticket not found",
  "status": 404,
  "detail": "The referenced ticket could not be found.",
  "instance": "/api/v2/support/attachments",
  "code": "ticket_not_found"
}
```

#### 429 - Rate limited. Retry after the limit resets. 429 responses include `Retry-After` seconds plus `X-RateLimit-*` headers.
```json
{
  "type": "https://developer.hostup.se/errors/rate_limit_exceeded",
  "title": "Too many requests",
  "status": 429,
  "detail": "Too many requests. Retry after the limit resets.",
  "code": "rate_limit_exceeded",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 500 - Internal error. Retry later or contact support if the issue persists.
```json
{
  "type": "https://developer.hostup.se/errors/internal_error",
  "title": "Internal server error",
  "status": 500,
  "detail": "An unexpected error occurred. Retry later or contact support if the issue persists.",
  "code": "internal_error",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```
