Skip to content

Presigned PUT for a client avatar

POST
/api/clients/{id}/avatar-intent/
curl --request POST \
--url http://localhost:8000/api/clients/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/avatar-intent/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "filename": "anna.jpg", "content_type": "image/jpeg" }'

Two-step avatar upload. POST here with {filename, content_type} to receive a presigned PUT URL + headers; issue the PUT directly from your client with the raw image bytes. The returned public_url is the canonical place to read the avatar from afterwards — set it as the Client’s avatar_url via PATCH /api/clients/<id>/. Object keys are scoped per team so deleting a team scrubs its avatars too. Only image/* content types are accepted (400 otherwise); 404 if the client isn’t on your team.

id
required
string format: uuid

Request body for the presigned-avatar-upload intent.

object
filename
required

Original filename. We keep only its extension (to align content-type and object key) and never store the name itself.

string
>= 1 characters <= 200 characters
content_type
required

MIME type of the image. Must be an image/* type.

string
>= 1 characters <= 120 characters
Examples
ExampleAvatarUploadIntent

Avatar upload intent

{
"filename": "anna.jpg",
"content_type": "image/jpeg"
}
Media typeapplication/json
object
url
required

Presigned URL to PUT the raw image bytes to.

string
method
required

Always PUT.

string
headers
required

Headers to replay verbatim on the PUT (e.g. Content-Type).

object
key
additional properties
string
object_key
required

Storage key the object lands at (team-scoped prefix).

string
public_url
required

Canonical public URL to read the avatar afterwards. Set this as the Client’s avatar_url via PATCH /api/clients/<id>/.

string
Examples
ExamplePresignedPUT

Presigned PUT

{
"url": "https://media.ai.aikynetix.app/teams/…/clients/…/avatar-a1b2c3d4.jpg?X-Amz-Signature=…",
"method": "PUT",
"headers": {
"Content-Type": "image/jpeg"
},
"object_key": "teams/…/clients/…/avatar-a1b2c3d4.jpg",
"public_url": "https://media.ai.aikynetix.app/teams/…/clients/…/avatar-a1b2c3d4.jpg"
}
Media typeapplication/json
object
detail
required

Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).

string
Examples
Example400—NotAnImage

400 — Not an image

{
"content_type": "Must be an image/* type"
}
Media typeapplication/json
object
detail
required

Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).

string
Examplegenerated
{
"detail": "example"
}
Media typeapplication/json
object
detail
required

Human-readable message, or a stable machine code for the cases a client branches on. The standard envelope for 400 (validation — a field-keyed object may appear instead), 401 (missing / invalid credentials), 403 (authenticated but not permitted), and 404 (absent — cross-team records are collapsed to 404 so the API never leaks the existence of another team’s data).

string
Examplegenerated
{
"detail": "example"
}