# Asset uploading

The asset uploading flow is split into three separate API calls:

{% stepper %}
{% step %}

### Create a signed upload URL

For example, if you want to upload a `logo` image for a property, you first need to perform an API call to sign an asset, specifying the type of asset and its MIME type. The resulting object will contain an upload URL.

```bash
curl --request POST \
  --url 'https://partners.clym.io/api/portal/instance/property/sign-asset?merchant_id={yourMerchantId}' \
  --header 'Authorization: Bearer {YourAPIKey}' \
  --header 'Content-Type: application/json' \
  --data '{
	"type": "logo",
	"mime": "image/png"
}'
// Result should be
{
  "result": {
    "url": "https://eu1.clym.io/api/u/CPKWkh3HWt7hN....."
  }
}
```

{% endstep %}

{% step %}

### Upload the asset&#x20;

Once you've received the signed upload URL, you can now use it to upload your asset. The signed URL should look like: `https://{instance}.clym.io/api/u/{uploadSignature}`&#x20;

The HTTP request should be a `multipart/form-data` request with the asset under the `asset` field name. An example can be viewed below.

```bash
curl --request POST \
  --url https://eu1.clym.io/api/u/CPKWkh3HWt7hN..... \
  --header 'Content-Type: multipart/form-data' \
  --form asset=@/Users/clym/my-logo.png
// Result should be
{
  "result": {
    "id": "38f305efa9b447839...", // the asset id
    "url": "...."                // the URL of the asset
  }
}
```

{% endstep %}

{% step %}

### Use the uploaded asset id

Once you've received the asset id, you can then use it to attach it to the resource you want to use.

In the example above, we want to assign the uploaded asset to the `logo` field of a property. For that, we would need to perform the following API call:

```bash
curl --request PUT \
  --url 'https://partners.clym.io/api/portal/instance/property?merchant_id={yourMerchantId}' \
  --header 'Authorization: Bearer {YourAPIKey}' \
  --header 'Content-Type: application/json' \
  --data '{ "logo": "38f305efa9b447839.." }'
```

{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.clym.io/getting-started/asset-uploading.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
