> For the complete documentation index, see [llms.txt](https://senar.gitbook.io/frameit-help/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://senar.gitbook.io/frameit-help/frameit-api-documentation.md).

# FrameIT API Documentation

FrameIT transforms any image into a 3D object to display it in Augmented Reality on mobile devices. FrameIT incorporates a variety of frame styles and colors, giving users the opportunity to ensure that not only the size and style of an artwork, but also its framing, harmonize with their interior.

<figure><img src="/files/X3emecpMDlWoHiCX4tHL" alt="" width="563"><figcaption></figcaption></figure>

### API DEMO

Explore two practical implementations on our Demo page:

* **Online Store**
* **Art Gallery**

You can access the [demonstrations here.](https://www.frameit.ar/demos)

### PARAMETERS OF THE FrameIT API

To get your API key, please contact us.

**Base URL of the API:** <https://www.frameit.ar/api/frameit>

**Endpoint : /**

**Description :** Adds a frame to an image.

**HTTP Method :** POST

**Request Parameters:**

| **PARAMETER**   | **DESCRIPTION**                                                                         | **VALUES (can be extended upon request)**                                                                                                 |
| --------------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **File**        | <p>Image file to be processed</p><p><em>Supported formats: JPG, PNG, BMP</em></p>       | `File`                                                                                                                                    |
| **ImageUrl**    | <p>URL of the image to be processed</p><p><em>Supported formats: JPG, PNG, BMP</em></p> | `ImageUrl`                                                                                                                                |
| **Unit**        | Unit of measurement for dimensions                                                      | `cm` (centimeters), `in` (inches)                                                                                                         |
| **ImageWidth**  | Desired Width excluding frame, in AR                                                    | <p><em>Any positive number.</em></p><p><em>Decimals are supported, but fractions are not.</em></p>                                        |
| **ImageHeight** | <p>Desired Height excluding frame, in AR</p><p>(Optional)</p>                           | <p><em>Any positive number.</em></p><p><em>Decimals are supported, but fractions are not.</em></p>                                        |
| **MatWidth**    | <p>Width of the mat</p><p>(Optional)</p>                                                | <p><code>0</code>: ignored (no mat)</p><p><em>Any positive number.</em></p><p><em>Decimals are supported, but fractions are not.</em></p> |
| **SupportType** | Type of support                                                                         | `Canvas`, `Dibond`, `Photo`, `Plexiglass`, `Poster`, `Transparent`                                                                        |
| **FrameType**   | Type of frame                                                                           | `None`, `Thin_Wood`, `Large_Wood`, `Thin_Floater`, `Floater`, `Aluminum`                                                                  |
| **FrameColor**  | Color of the frame (Optional)                                                           | `Black`, `White`, `Natural_Oak`, `Gold`, `Silver`, `Copper`                                                                               |

**Available associations (frame type & color)**

* **Thin\_Wood**: available with `Black`, `White`, `Natural_Oak`
* **Large\_Wood**: available with `Gold`
* **Thin\_Floater**: available with `Black`, `White`, `Natural_Oak`
* **Floater**: available with `Black`, `White`, `Natural_Oak`
* **Aluminum**: available with `Black`, `White`, `Gold`, `Silver`, `Copper`

### **REQUEST EXAMPLE**

| **REQUEST**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | **RESPONSE**                                                                                                        |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| <p><strong>POST</strong> <https://www.frameit.ar/api/frameit></p><p><strong>Content-Type:</strong> multipart/form-data</p><p><strong>Authorization:</strong> Basic api: your-API-key</p><p><strong>File</strong>: \[image file]</p><p><strong>Unit</strong>: <code>in</code></p><p><strong>ImageWidth</strong>: <code>24.5</code></p><p><strong>MatWidth</strong>: <code>2</code></p><p><strong>SupportType</strong>: <code>Photo</code></p><p><strong>FrameType:</strong> <code>Thin\_Wood</code></p><p><strong>FrameColor:</strong> <code>Natural\_Oak</code></p> | <p>{</p><p>    "PublicLink": "<https://public-link>",</p><p>    "QrCodeImage": "<https://qrcode-image>"</p><p>}</p> |

**Example of Javascript code**

```javascript
// Function to make the API request
async function uploadImage() {
    // API endpoint
    const url = 'https://www.frameit.ar/api/frameit';    // Prepare the form data
    const formData = new FormData();    // Replace this with the URL of the image you want to use
    const imageUrl = '';
    formData.append('ImageUrl', imageUrl);    // Append other parameters to the form data
    formData.append('Unit', 'in');
    formData.append('ImageWidth', '24.5');
    formData.append('MatWidth', '2');
    formData.append('SupportType', 'Photo');
    formData.append('FrameType', 'Thin_Wood');
    formData.append('FrameColor', 'Natural_Oak');    // Set up the request headers
    const headers = new Headers(); 
    headers.append('Authorization', 'Basic ' + btoa('api:your-API-key'));    // Make the request
    try {
    const response = await fetch(url, {
        method: 'POST',
        headers: headers,
        body: formData
    });    if (!response.ok) {
    throw new Error(HTTP error! status: ${response.status});
    }    // Get the response JSON
    const data = await response.json();
    console.log(data);
  } catch (error) {
   console.error('Error:', error);
  }
}// Call the function (e.g., on a button click)
uploadImage();
```

**Example of Python code**

```python
import requests
from requests.auth import HTTPBasicAuth
import base64# API endpoint
url = 'https://www.frameit.ar/api/frameit'# Your API key
api_key = 'Your-API-Key'def get_frameit_response():
    # Image file path
    file_path = 'images/sample1.jpg'
    files = {'file': open(file_path, 'rb')}    # Data payload
     data = {
        'Unit': 'in',
        'ImageWidth': 24.5,
        'MatWidth': 2,
        'SupportType': 'Photo',
        'FrameType': 'Thin_Wood',
        'FrameColor': 'Natural_Oak'
    }    # Basic authentication
    auth = HTTPBasicAuth('api', api_key)    # Make the POST request
    response = requests.post(url, files=files, data=data, auth=auth)    # Print the response
    print(response.json())
    return response.json()get_frameit_response()
```

**HTTP Response Codes**

* **200 OK**: The request has succeeded and the response contains the requested data.
* **400 Bad Request**: The request is malformed or contains incorrect parameters.
* **500 Internal Server Error**: An error occurred on the server side.
