> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.partnerpage.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.partnerpage.io/_mcp/server.

# Create a contact request attachment

POST https://v1.api.partnerpage.io/api/directory/private/v1alpha/contact-requests/{contactId}/attachments/
Content-Type: application/json

Create a new attachment for a contact request. Send the file either as a base64 data URI in `file` or as the URL returned by `POST /api/core/private/v1alpha/files/` with `private=true` in `fileUrl`; one of the two is required and `file` wins when both are sent. A public staging URL is refused. The staged file must be one of the supported attachment types and at most 25 MB. `originalFilename` is the name shown to users.

Reference: https://docs.partnerpage.io/api-reference/contact-request/attachment/create-a-contact-request-attachment

## Authentication

- `Authorization` header (required) (prefixed with ` Token   `) — Your API key, sent as `Authorization: Token <your API key>`

## Request

### Path parameters

- `contactId` (string, required) — ID of the contact request

### Body (application/json)

This endpoint expects a ContactRequestAttachmentWriteRequest.

- `originalFilename` (string, required)
- `file` (string, optional)
- `fileUrl` (string, optional)

## Response

### 201

Successful operation

- `id` (string, required)
- `contactRequestId` (string, required)
- `file` (string, required)
- `originalFilename` (string, required)
- `uploadedByUserId` (string, required, nullable)
- `uploadedByRole` (string, required)
- `canDelete` (boolean, required)
- `created` (datetime, required)

## Errors

### 400 Bad Request Error

Bad Request - Validation Error or attachment limit reached

- `any`

### 403 Forbidden Error

Forbidden

- `any`

### 404 Not Found Error

Contact request not found

- `any`

## Examples

**Request**

```json
{
  "originalFilename": "string"
}
```

**Response**

```json
{
  "id": "string",
  "contactRequestId": "string",
  "file": "string",
  "originalFilename": "string",
  "uploadedByUserId": "string",
  "uploadedByRole": "string",
  "canDelete": true,
  "created": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://v1.api.partnerpage.io/api/directory/private/v1alpha/contact-requests/contactId/attachments/"

payload = { "originalFilename": "string" }
headers = {
    "Authorization": "Token  <apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://v1.api.partnerpage.io/api/directory/private/v1alpha/contact-requests/contactId/attachments/';
const options = {
  method: 'POST',
  headers: {Authorization: 'Token  <apiKey>', 'Content-Type': 'application/json'},
  body: '{"originalFilename":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```