> For the complete documentation index, see [llms.txt](https://docs.virtualstagingai.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.virtualstagingai.app/snippets.md).

# Snippets

Find more in the [Postman Workspace](/getting-started.md#postman-example-calls)

### Python - Create Render (from Image URL)

```python
import requests
import json

url = "https://api.virtualstagingai.app/v1/render/create"
VSAI_API_KEY = "..."

payload = json.dumps({
  "image_url": "https://firebasestorage.googleapis.com/v0/b/furniture-ai.appspot.com/o/users%2FX5AvCT5OUcaflJkXefQofEkDcW42%2Ffootage%2F6aec0ecf-8a52-4b49-a81d-031e91ce33e5-0001-022_181_HDR_4143.jpg?alt=media&token=28136001-ad8e-4c97-afe7-5f5b68054a1c",
  "room_type": "bed",
  "style": "modern",
  "wait_for_completion": False
})
headers = {
  'Authorization': 'Api-key ' + VSAI_API_KEY,
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```

### Python - Create Render (from file, using multipart form-data)

```python

import requests
import json
from urllib.parse import urlencode, urljoin

url = "https://api.virtualstagingai.app/v1/render/create"
VSAI_API_KEY = "..."

def add_url_params(url, params):
    return url + '?' + urlencode(params).lower() if params else url

image_path = "/path/to/your/image.jpg"  # replace with your image's path

payload = {
  "room_type": "bed",
  "style": "modern",
  "wait_for_completion": False
}

headers = {
  'Authorization': 'Api-key ' + VSAI_API_KEY,
}

# we need to add payload as url params if we're using request body for the image
url = add_url_params(url, payload)

with open(image_path, 'rb') as image_file:
    files = {
        # important: 'file' has to be the key
        'file': (image_path, image_file),
    }
    response = requests.post(url, headers=headers, data=payload, files=files)

print(response.text)

```

### Node JS w/ Axios - Create Render

```javascript
const axios = require('axios');
const VSAI_API_KEY = "...";

const image_url = "...";
let data = JSON.stringify({
  "image_url": image_url,
  "room_type": "bed",
  "style": "modern",
  "wait_for_completion": false
});

const url = 'https://api.virtualstagingai.app/v1/render/create';
let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url,
  headers: { 
    'Authorization': 'Api-key ' + VSAI_API_KEY, 
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.virtualstagingai.app/snippets.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.
