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

# Add reference media

POST https://app.resemble.ai/api/v2/identity/{uuid}/attachments
Content-Type: multipart/form-data

Attach a reference media file (voice sample, face photo, or reference video) to an identity. The modality's embedding recomputes asynchronously; the media becomes searchable once its embedding status is ready.


Reference: https://docs.resemble.ai/api-reference/identity/create-identity-attachment

## Authentication

- `Authorization` header (bearer token, required) — API key from https://app.resemble.ai/hub/api

## Request

### Path parameters

- `uuid` (string, required)

### Body (multipart/form-data)

This endpoint expects a multipart form containing a file.

- `modality` (enum, required)
- `file` (file, required) — The media file to attach

## Response

### 201

Media attached; returns the updated identity

- `uuid` (string, optional)
- `name` (string, optional)
- `identity_type` (enum, optional)
  - Allowed values: `person`, `brand`
- `visibility` (enum, optional)
  - Allowed values: `team`, `global`
- `notes` (string, optional, nullable)
- `voice_profile_id` (string, optional, nullable)
- `created_at` (datetime, optional)
- `updated_at` (datetime, optional)
- `project_count` (integer, optional)
- `voice_samples` (list of IdentityAttachment, optional)
- `face_photos` (list of IdentityAttachment, optional)
- `reference_videos` (list of IdentityAttachment, optional)
- `embeddings` (list of IdentityEmbeddingsItems, optional) — Per-modality embedding processing status
- `projects` (list of IdentityProjectsItems, optional)

## Errors

### 400 Bad Request Error

Missing or invalid modality, or missing file

- `success` (boolean, optional)
- `error` (string, optional)
- `errors` (map from string to list of string, optional)
- `message` (string, optional)

### 404 Not Found Error

Identity not found

- `success` (boolean, optional)
- `error` (string, optional)
- `errors` (map from string to list of string, optional)
- `message` (string, optional)

### 422 Unprocessable Entity Error

Face photo limit reached (a person identity accepts at most 5 face photos)

- `success` (boolean, optional)
- `error` (string, optional)
- `errors` (map from string to list of string, optional)
- `message` (string, optional)

## Types

### IdentityAttachment

A reference media file attached to an identity

- `id` (integer, optional)
- `filename` (string, optional)
- `byte_size` (integer, optional)
- `content_type` (string, optional)

### IdentityEmbeddingsItems

- `modality` (enum, optional)
  - Allowed values: `voice`, `face`, `video`
- `status` (string, optional)
- `attachment_count` (integer, optional)
- `computed_at` (datetime, optional, nullable)

### IdentityProjectsItems

- `uuid` (string, optional)
- `name` (string, optional)

## Examples

**Request**

```json
{
  "modality": "voice",
  "file": "<file: string>"
}
```

**Response**

```json
{
  "uuid": "string",
  "name": "string",
  "identity_type": "person",
  "visibility": "team",
  "notes": "string",
  "voice_profile_id": "string",
  "created_at": "2024-01-15T09:30:00Z",
  "updated_at": "2024-01-15T09:30:00Z",
  "project_count": 1,
  "voice_samples": [
    {
      "id": 1,
      "filename": "string",
      "byte_size": 1,
      "content_type": "string"
    }
  ],
  "face_photos": [
    {
      "id": 1,
      "filename": "string",
      "byte_size": 1,
      "content_type": "string"
    }
  ],
  "reference_videos": [
    {
      "id": 1,
      "filename": "string",
      "byte_size": 1,
      "content_type": "string"
    }
  ],
  "embeddings": [
    {
      "modality": "voice",
      "status": "string",
      "attachment_count": 1,
      "computed_at": "2024-01-15T09:30:00Z"
    }
  ],
  "projects": [
    {
      "uuid": "string",
      "name": "string"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://app.resemble.ai/api/v2/identity/uuid/attachments"

files = { "file": "open('string', 'rb')" }
payload = { "modality": "voice" }
headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, data=payload, files=files, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.resemble.ai/api/v2/identity/uuid/attachments';
const form = new FormData();
form.append('modality', 'voice');
form.append('file', 'string');

const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

options.body = form;

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

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.resemble.ai/api/v2/identity/uuid/attachments"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"modality\"\r\n\r\nvoice\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.resemble.ai/api/v2/identity/uuid/attachments")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"modality\"\r\n\r\nvoice\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.resemble.ai/api/v2/identity/uuid/attachments")
  .header("Authorization", "Bearer <token>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"modality\"\r\n\r\nvoice\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.resemble.ai/api/v2/identity/uuid/attachments', [
  'multipart' => [
    [
        'name' => 'modality',
        'contents' => 'voice'
    ],
    [
        'name' => 'file',
        'filename' => 'string',
        'contents' => null
    ]
  ]
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.resemble.ai/api/v2/identity/uuid/attachments");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"modality\"\r\n\r\nvoice\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]
let parameters = [
  [
    "name": "modality",
    "value": "voice"
  ],
  [
    "name": "file",
    "fileName": "string"
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://app.resemble.ai/api/v2/identity/uuid/attachments")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```