Assets & images

An asset is a stored file (a photo, render, or floor plan) plus its metadata. Apartments don't hold image bytes directly. They reference assets by id through their assetsIds array. Attaching an image is therefore two steps: create the asset, then put its id on the apartment.

There are two ways to create an asset. Upload the file to us, or register a URL you already host. Both return an asset with an id.

For the rest of this page we assume your key is in an environment variable:

export YNH_API_KEY="ynh_live_xxxxxxxxxxxxxxxxxxxx"

Option A: upload a file

Send the file as multipart/form-data under the field name file. We store it on our CDN and register the asset in one call.

curl -X POST https://api.yournexthome.app/api/v1/asset/upload \
  -H "Authorization: Bearer $YNH_API_KEY" \
  -F "file=@./floorplan.png"

Response:

{
  "id": "9f1c2d3e-...",
  "name": "floorplan.png",
  "src": "https://cdn.yournexthome.app/uploads/...",
  "mimeType": "image/png",
  "sizeBytes": 20480
}

The maximum upload size is 20 MB per file.

Option B: register a hosted URL

If the file already lives on a public URL, register it directly instead of uploading. Provide a src (the URL) and a name.

curl -X POST https://api.yournexthome.app/api/v1/asset \
  -H "Authorization: Bearer $YNH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "src": "https://your-cdn.example.com/units/a12-floorplan.png",
    "name": "A12 floor plan"
  }'

The response has the same shape as above. What you need is the id.

Attach the asset to an apartment

assetsIds is the full list of asset ids on the apartment, so include the existing ones plus the new id (fetch the apartment first if you need the current list).

curl -X PATCH https://api.yournexthome.app/api/v1/apartment/$APARTMENT_ID \
  -H "Authorization: Bearer $YNH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "assetsIds": ["9f1c2d3e-..."] }'

Manage existing assets

List the assets in your organization (to find an id to reuse):

curl https://api.yournexthome.app/api/v1/asset \
  -H "Authorization: Bearer $YNH_API_KEY"

Delete one:

curl -X DELETE https://api.yournexthome.app/api/v1/asset/$ASSET_ID \
  -H "Authorization: Bearer $YNH_API_KEY"

Deleting an asset does not remove it from apartments that still list its id, so update those apartments' assetsIds too.

See the API Reference for the full request and response schemas.