Asset uploading
Uploading an asset (such as an account avatar or a property logo) is a three-step flow.
1. Sign the upload
Request a signed upload URL, specifying the asset type and its mime. The returned URL and key are short-lived.
curl --request POST \ --url https://{instance}.clym.io/api/admin/account/sign-asset \ --header 'Authorization: Bearer {YOUR_API_KEY}' \ --header 'Content-Type: application/json' \ --data '{ "type": "ACCOUNT_AVATAR", "mime": "image/png" }'
{ "result": { "url": "https://{instance}.clym.io/api/u/CPK.....", "key": "CPK....." } }2. Upload the file
Upload the file to that URL as multipart/form-data, with the file under the asset field.
curl --request POST \ --url https://{instance}.clym.io/api/u/CPK..... \ --header 'Content-Type: multipart/form-data' \ --form asset=@/path/to/avatar.png
{ "result": { "id": "{object_id}.{signature}", "url": "....." } }3. Attach the asset
Pass the claim id to the resource that uses it — for example the avatar_url field when updating your account.
curl --request PUT \ --url https://{instance}.clym.io/api/admin/account \ --header 'Authorization: Bearer {YOUR_API_KEY}' \ --header 'Content-Type: application/json' \ --data '{ "avatar_url": "{object_id}.{signature}" }'
