Media
此内容尚不支持你的语言。
GET /v1/accounts/{a}/jobs/{id}
Show the state of a media or send job.
Scope: any valid token
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Job ID. |
POST /v1/accounts/{a}/jobs/{id}/cancel
Ask a media or send job to stop.
Scope: any valid token
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Job ID. |
POST /v1/accounts/{a}/jobs/{id}/retry
Retry a failed job from the start. The body is optional and cannot ask to reuse a finished upload.
Scope: any valid token
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Job ID. |
Request body: NativeMediaJobRetryRequest
POST /v1/accounts/{a}/jobs/{id}/retry-completed-upload
Retry a send job but reuse the upload that already finished. The body must set reuseCompletedUpload to true.
Scope: send
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Job ID. |
Request body: NativeMediaJobRetryRequest
POST /v1/accounts/{a}/media-writeback/repair
Start repairing saved media records from bytes the daemon already holds. It never resends or downloads.
Scope: media
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
Request body: NativeMediaWritebackRequest
POST /v1/accounts/{a}/media/lookup
List the media of up to 40 messages in one request, without downloading anything.
Scope: media
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
Request body: NativeMediaBatchRequest
GET /v1/accounts/{a}/media/{id}
Show one media asset and whether its bytes are available.
Scope: media
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Media asset ID. |
GET /v1/accounts/{a}/media/{id}/content
Get the cached bytes of a media asset. It supports Range and If-None-Match, and never starts a download.
Scope: media
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Media asset ID. |
representation | query | ContentRepresentation | The file itself or its preview. Defaults to the original. |
GET /v1/accounts/{a}/messages/{id}/card-avatar
Get the avatar picture for a saved contact-card message, proxying and caching the advertised avatar URL when not stored locally.
Scope: media
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Message ID. |
GET /v1/accounts/{a}/messages/{id}/image
Get a saved image message at the requested quality.
Scope: media
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Message ID. |
quality | query | string, nullable | best (the default), original, standard or thumbnail. |
GET /v1/accounts/{a}/messages/{id}/media
List the media attached to a message and whether each file is available.
Scope: media
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Message ID. |
POST /v1/accounts/{a}/messages/{id}/media-transfers
Start downloading one media file of a message. Poll the returned job.
Scope: media
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Message ID. |
Request body: MediaTransferRequest
POST /v1/accounts/{a}/uploads
Stage the bytes of one file as a media source that a later send can use.
Scope: send
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
Request body: multipart/form-data
| Field | Type | Description |
|---|---|---|
file (required) | string | The file to stage. Send exactly one part named file. |
DELETE /v1/accounts/{a}/uploads/{id}
Delete an upload you have finished with, such as the source of an added sticker. Returns released: false when it is already gone; an upload a pending send or preparation needs is kept (409 upload_in_use).
Scope: send
| Parameter | In | Type | Description |
|---|---|---|---|
a (required) | path | string | Account ID or alias. |
id (required) | path | string | Upload source ID. |
Response: NativeUploadRelease
Types
ContentRepresentation
Which bytes of a media asset to return.
| Value | Description |
|---|---|
| ”original” | The file itself. |
| ”preview” | The saved preview of the file. |
MediaTransferRequest
Request to download an attachment of a message.
| Field | Type | Description |
|---|---|---|
assetId | string, nullable | ID of the specific attachment to download. When null, the daemon picks the attachment that matches quality. |
messageId (required) | string | ID of the message to download from. It must match the message ID in the URL. |
quality | MediaVariant | Which copy to download. The default is best. |
MediaVariant
Which copy of an attachment, or which quality to request. For a request, best picks the best copy available.
| Value | Description |
|---|---|
| ”best” | The best copy available. It downloads one when none is cached. Only valid in a request. |
| ”thumbnail” | A small preview copy. |
| ”standard” | The standard-size copy of an image. |
| ”original” | The original copy as offered by the sender, which can be smaller than the sender’s own source. |
| ”normal” | The ordinary playback copy of a video, or the playable audio of a voice note. |
| ”encoded” | A voice note in its original encoded form. |
NativeMediaBatchRequest
Messages whose attachments to list without downloading anything.
| Field | Type | Description |
|---|---|---|
messageIds (required) | array of string | IDs of the messages to look up, from 1 to 40 per request. |
NativeMediaJobRetryRequest
Options for retrying a media job.
| Field | Type | Description |
|---|---|---|
reuseCompletedUpload | boolean, nullable | True to reuse the upload a send job already finished instead of uploading again. The retry-completed-upload route requires true here. |
NativeMediaWritebackRequest
Request to repair saved media records from bytes the daemon already holds. It never downloads or sends anything.
| Field | Type | Description |
|---|---|---|
limit (required) | integer | How many saved media records to repair in this request, from 1 to 100. |
NativeUploadRelease
Result of deleting an upload.
| Field | Type | Description |
|---|---|---|
released (required) | boolean | True when this request deleted the upload; false when it was already gone. |