> For the complete documentation index, see [llms.txt](https://painor.gitbook.io/gramjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://painor.gitbook.io/gramjs/working-with-user-profile-pictures/photos.uploadprofilephoto.md).

# photos.uploadProfilePhoto

Updates current user profile photo.

## Example

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

```javascript
const {Api, TelegramClient} = require('telegram');
const {StringSession} = require('telegram/sessions');

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result = await client.invoke(new Api.photos.uploadProfilePhoto({
        file: new Api.InputFile({...}),
        video: new Api.InputFile({...}),
        videoStartTs: 8374801,
        }));
    console.log(result); // prints the result
})();
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import {Api, TelegramClient} from 'telegram';
import {StringSession} from 'telegram/sessions';

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result: Api.photos.Photo = await client.invoke(new Api.photos.uploadProfilePhoto({
        file: new Api.InputFile({...}),
        video: new Api.InputFile({...}),
        videoStartTs: 8374801,
        }));
    console.log(result); // prints the result
})();
```

{% endtab %}
{% endtabs %}

## TL schema

```
photos.photo#20212ca8 photo:Photo users:Vector<User> = photos.Photo;
---functions---
photos.uploadProfilePhoto#89f30f69 flags:# file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double = photos.Photo;
```

## Parameters

|         Name         | Type                                                                                                                                 | Description                                                                                                        |
| :------------------: | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
|       **flags**      | [#](https://core.telegram.org/type/%23)                                                                                              | Flags, see [TL conditional fields](https://core.telegram.org/mtproto/TL-combinators#conditional-fields)            |
|       **file**       | [flags](https://core.telegram.org/mtproto/TL-combinators#conditional-fields).0?[InputFile](https://core.telegram.org/type/InputFile) | File saved in parts by means of [upload.saveFilePart](https://core.telegram.org/method/upload.saveFilePart) method |
|       **video**      | [flags](https://core.telegram.org/mtproto/TL-combinators#conditional-fields).1?[InputFile](https://core.telegram.org/type/InputFile) | [Animated profile picture](https://core.telegram.org/api/files#animated-profile-pictures) video                    |
| **video\_start\_ts** | [flags](https://core.telegram.org/mtproto/TL-combinators#conditional-fields).2?[double](https://core.telegram.org/type/double)       | Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. |

## Result

[photos.Photo](https://core.telegram.org/type/photos.Photo)

## Possible errors

| Code | Type                       | Description                           |
| :--: | -------------------------- | ------------------------------------- |
|  400 | FILE\_PARTS\_INVALID       | The number of file parts is invalid   |
|  400 | IMAGE\_PROCESS\_FAILED     | Failure while processing image        |
|  400 | PHOTO\_CROP\_FILE\_MISSING | Photo crop file missing               |
|  400 | PHOTO\_CROP\_SIZE\_SMALL   | Photo is too small                    |
|  400 | PHOTO\_EXT\_INVALID        | The extension of the photo is invalid |
|  400 | PHOTO\_FILE\_MISSING       | Profile photo file missing            |
|  400 | VIDEO\_FILE\_INVALID       | The specified video file is invalid   |

## Can bots use this methd ?

### yes

## Related pages

### [upload.saveFilePart](https://core.telegram.org/method/upload.saveFilePart)

Saves a part of file for futher sending to one of the methods.

### [Uploading and Downloading Files](https://core.telegram.org/api/files)

How to transfer large data batches correctly.
