Skip to content

Complete an upload

POST
/v1/photos/{id}/complete
curl --request POST \
--url https://app.mondochat.io/v1/photos/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/complete \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "caption": "Sunset", "once": false }'

Checks the uploaded file, prepares its renditions and posts it as a message. Takes a session token. A video needs video and a voice note needs voice, else 422, and a video or voice file that is not an MP4 answers 422. caption longer than chat.text_max_length answers 422, and once answers 403 policy_denied with reason view_once while chat.view_once is off. When the receiver has not answered the photo consent question the message is held, and the receiver sees a placeholder. See https://docs.mondochat.io/guides/media/.

id
required
Id
string format: uuid
Media typeapplication/json
Any of:
CompleteRequest

Finishes an upload and posts the media as a message.

object
caption
Any of:
string
<= 10000 characters
forwarded
Forwarded

Stored as you send it; marks the message as forwarded.

boolean
once
Once

Make it view once. Answers 403 policy_denied with reason view_once while chat.view_once is off.

boolean
reply_to_id
Any of:
string format: uuid
video
Any of:
VideoParts

What the browser measured and sampled from a video it converted.

object
duration_ms
required
Duration Ms

Length in milliseconds, at most chat.video_max_seconds plus one second.

integer
>= 1
frames
required
Frames

Base64 JPEG frames of the encoded video; the first is the poster.

Array<string>
>= 1 items <= 20 items
height
required
Height

Video height in pixels.

integer
>= 1 <= 16384
width
required
Width

Video width in pixels.

integer
>= 1 <= 16384
voice
Any of:
VoiceParts

What the browser measured from a voice note it recorded.

object
duration_ms
required
Duration Ms

Length in milliseconds, at most chat.voice_max_seconds plus one second.

integer
>= 1
wave
required
Wave

40 levels, base32 0 to v.

string
/^[0-9a-v]{40}$/

Successful Response

Media typeapplication/json
Photo

A photo, video, voice note or avatar and the links to read it.

object
full_url
required
Any of:
string
height
required
Any of:
integer
id
required
Id

The media’s id.

string format: uuid
kind
required
Kind

What the media is.

string
Allowed values: photo video voice avatar
status
required
Status

pending until the upload is completed, held while it waits for the receiver’s consent or for moderation, rejected or deleted once it is gone.

string
Allowed values: pending ready held rejected deleted
thumb_url
required
Any of:
string
uploader_id
required
Uploader Id

The id of the user who uploaded it.

string format: uuid
width
required
Any of:
integer

Example

{
"full_url": "https://media.example.test/p/0199d6a0-4000-7000-8000-000000000001/full.webp",
"height": 2048,
"id": "0199d6a0-4000-7000-8000-000000000001",
"kind": "photo",
"status": "ready",
"thumb_url": "https://media.example.test/p/0199d6a0-4000-7000-8000-000000000001/thumb.webp",
"uploader_id": "0199d6a0-1000-7000-8000-000000000001",
"width": 1536
}

Problem

Media typeapplication/problem+json

An RFC 9457 problem: the body of every error answer.

object
code
required

The stable error code to branch on, such as policy_denied.

string
detail

What went wrong this time, when there is more to say.

string | null
errors

For validation, one entry per invalid field.

Array<object>

One invalid field.

object
loc

The path to the field.

array
msg

What is wrong with it.

string
instance

The path of the request.

string
reason

For policy_denied and limit_reached, the rule or limit that refused the request; for forbidden, a short cause such as you_blocked; for banned, temporary when the ban expires.

string
status
required

The HTTP status code.

integer
title
required

A short summary of the problem.

string
type
required

A URL that names the problem, https://app.mondochat.io/problems/<code>.

string

Example

{
"code": "policy_denied",
"detail": null,
"instance": "/v1/conversations/0199d6a0-2000-7000-8000-000000000001",
"reason": "pins",
"status": 403,
"title": "Policy denied",
"type": "https://app.mondochat.io/problems/policy_denied"
}