# Upload a live photo

### URL

<mark style="color:green;">**POST**</mark> `https://api.complycube.com/v1/livePhotos`

Uploads a new live photo.\
\
The live photo image must be either in **JPG** or **PNG** format. The size must be between **34 KB** and **4 MB**.

### Headers

<table><thead><tr><th width="281">Name</th><th width="96">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Type</code><mark style="color:red;">*</mark></td><td>string</td><td>The content-type must always be set to <code>application/json</code>.</td></tr><tr><td><code>Authorization</code><mark style="color:red;">*</mark></td><td>string</td><td>The API <strong><code>live</code></strong> or <strong><code>test</code></strong> key.</td></tr></tbody></table>

### Body

<table><thead><tr><th width="281">Name</th><th width="96">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>clientId</code><mark style="color:red;">*</mark></td><td>string</td><td>The ID of the client associated with this live photo.</td></tr><tr><td><code>data</code><mark style="color:red;">*</mark></td><td>string</td><td>The <code>BASE64</code> encoded data.</td></tr><tr><td><code>performLivenessCheck</code></td><td>boolean</td><td>Indicates if a liveness check should be performed on a live photo upload. When not provided, this defaults to <strong>true</strong>.</td></tr></tbody></table>

### Example request

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://api.complycube.com/v1/livePhotos \
     -H 'Authorization: <YOUR_API_KEY>' \
     -H 'Content-Type: application/json' \
     -d '{
               "clientId":"5eb1276d96be4a0008713af5",
               "data": "<BASE64_CONTENT>"
        }'
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const { ComplyCube } = require("@complycube/api");

const complycube = new ComplyCube({ apiKey: "<YOUR_API_KEY>" });

await complycube.livePhoto.upload("CLIENT_ID", {
    data: "<BASE64_CONTENT>"
});
```

{% endtab %}

{% tab title="Python" %}

```python
from complycube import ComplyCubeClient

cc_api = ComplyCubeClient(api_key='<YOUR_API_KEY>')

live_photo = cc_api.livephotos.upload('CLIENT_ID', {
    'data': '<BASE64_CONTENT>'
})
```

{% endtab %}

{% tab title="PHP" %}

```php
use ComplyCube\ComplyCubeClient;

$ccapi = new ComplyCubeClient('<YOUR_API_KEY>');

$livephoto = $ccapi->livephotos()->upload('CLIENT_ID', [
    'data' => '<BASE64_CONTENT>'
]);
```

{% endtab %}

{% tab title=".NET" %}

```csharp
using ComplyCube.Net;
using ComplyCube.Net.Resources.LivePhotos;

var livePhotoApi = new LivePhotoApi(new ComplyCubeClient("<YOUR_API_KEY>"));

var livePhotoRequest = new LivePhotoRequest {
  clientId = "CLIENT_ID",
  data = "<BASE64_CONTENT>"
};

var livePhoto = await livePhotoApi.UploadAsync(livePhotoRequest);
```

{% endtab %}
{% endtabs %}

### Example responses

{% tabs %}
{% tab title="Success (200)" %}

```json
{
    "id": "5eb1b5f231778a0008d1c3f6",
    "clientId": "5eb1276d96be4a0008713af5",
    "downloadLink": "/livePhotos/5eb1b5f231778a0008d1c3f6/download",
    "contentType": "image/jpeg",
    "performLivenessCheck": true,
    "size": 44896,
    "createdAt": "2020-01-01T14:06:44.756Z",
    "updatedAt": "2020-01-01T14:06:44.756Z"
}
```

{% endtab %}

{% tab title="Invalid Request (400)" %}

```json
{
    "type": "invalid_request",
    "message": "Image file size should be between 34KB and 4MB",
    "param": "data"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.complycube.com/documentation/api-reference/core-resources/live-photos/create-a-live-photo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
