Presigned PUT for a client avatar
const url = 'http://localhost:8000/api/clients/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/avatar-intent/';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"filename":"anna.jpg","content_type":"image/jpeg"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Request body for the presigned-avatar-upload intent.
object
Original filename. We keep only its extension (to align content-type and object key) and never store the name itself.
MIME type of the image. Must be an image/* type.
Examples
Avatar upload intent
{ "filename": "anna.jpg", "content_type": "image/jpeg"}Request body for the presigned-avatar-upload intent.
object
Original filename. We keep only its extension (to align content-type and object key) and never store the name itself.
MIME type of the image. Must be an image/* type.
Examplegenerated
filename=example&content_type=exampleRequest body for the presigned-avatar-upload intent.
object
Original filename. We keep only its extension (to align content-type and object key) and never store the name itself.
MIME type of the image. Must be an image/* type.
Responses
Section titled “Responses”object
Presigned URL to PUT the raw image bytes to.
Always PUT.
Headers to replay verbatim on the PUT (e.g. Content-Type).
object
Storage key the object lands at (team-scoped prefix).
Canonical public URL to read the avatar afterwards. Set this as the Client’s avatar_url via PATCH /api/clients/<id>/.
Examples
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"}object
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).
Examples
400 — Not an image
{ "content_type": "Must be an image/* type"}object
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).
Examplegenerated
{ "detail": "example"}object
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).
Examplegenerated
{ "detail": "example"}