# Photoshop Files API

## Upload a PSD file

> Uploads a PSD file and optionally creates a mockup template.

```json
{"openapi":"3.1.0","info":{"title":"Dynamic Mockups API","version":"1.0"},"servers":[{"url":"https://app.dynamicmockups.com/api/v1"}],"security":[{"apiKeyAuth":[]}],"components":{"securitySchemes":{"apiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key required for authentication."}}},"paths":{"/psd/upload":{"post":{"summary":"Upload a PSD file","description":"Uploads a PSD file and optionally creates a mockup template.","operationId":"uploadPsd","parameters":[{"in":"header","name":"Accept","required":true,"schema":{"type":"string","enum":["application/json"]},"description":"The request must accept JSON responses."},{"in":"header","name":"x-api-key","required":true,"schema":{"type":"string"},"description":"API key required for authentication."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"psd_file_url":{"type":"string","description":"The URL to the PSD file."},"psd_name":{"type":"string","description":"An optional name for the PSD file."},"psd_category_id":{"type":"integer","description":"An optional category ID for the PSD file."},"mockup_template":{"type":"object","description":"Optional settings for creating a mockup template after the PSD upload.","properties":{"create_after_upload":{"type":"boolean","description":"Whether to create a mockup template after the PSD upload."},"collections":{"type":"array","description":"Optional list of collection UUIDs to associate with the mockup template.","items":{"type":"string"}},"catalog_uuid":{"type":"string","description":"Optional catalog UUID to add the created mockup to. If not provided, the mockup will be added to the default catalog."}}}},"required":["psd_file_url"]}}}},"responses":{"200":{"description":"Successful PSD upload operation.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","description":"Contains the uploaded PSD file details or the created mockup resource.","properties":{"uuid":{"type":"string","description":"The UUID of the uploaded PSD file."},"name":{"type":"string","description":"The name of the uploaded PSD file."}}},"success":{"type":"boolean","description":"Indicates if the PSD upload operation was successful."},"message":{"type":"string","description":"A message about the PSD upload operation."}}}}}},"400":{"description":"Bad request due to invalid input parameters."},"401":{"description":"Unauthorized request, invalid or missing API key."}}}}}}
```

## Delete a PSD file

> Deletes a PSD file by UUID with optional deletion of related mockups.

```json
{"openapi":"3.1.0","info":{"title":"Dynamic Mockups API","version":"1.0"},"servers":[{"url":"https://app.dynamicmockups.com/api/v1"}],"security":[{"apiKeyAuth":[]}],"components":{"securitySchemes":{"apiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key required for authentication."}}},"paths":{"/psd/delete":{"post":{"summary":"Delete a PSD file","description":"Deletes a PSD file by UUID with optional deletion of related mockups.","operationId":"deletePsd","parameters":[{"in":"header","name":"Accept","required":true,"schema":{"type":"string","enum":["application/json"]},"description":"The request must accept JSON responses."},{"in":"header","name":"x-api-key","required":true,"schema":{"type":"string"},"description":"API key required for authentication."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"psd_uuid":{"type":"string","description":"The UUID of the PSD file to delete."},"delete_related_mockups":{"type":"boolean","description":"Whether to delete all mockups related to this PSD file."}},"required":["psd_uuid"]}}}},"responses":{"200":{"description":"Successful PSD deletion operation.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{}},"success":{"type":"boolean","description":"Indicates if the PSD deletion operation was successful."},"message":{"type":"string","description":"A message about the PSD deletion operation."}}}}}},"400":{"description":"Bad request due to invalid input parameters or PSD not found."},"401":{"description":"Unauthorized request, invalid or missing API key."},"403":{"description":"Forbidden, user does not have permission to delete this PSD file."}}}}}}
```

Export OpenAPI specification for PSD Upload API

{% file src="<https://1410134351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXeuL34FauPTZ6yb0wAep%2Fuploads%2FePsWdSN1dOBaNG9XddqB%2Fphotoshop_files_api.json?alt=media&token=67fdc574-c6ae-4381-83d6-07f7901b4dd1>" %}

{% hint style="info" %}
The rate limit for the **Upload a PSD file** action is **10 requests per minute**

Contact us if you need more
{% endhint %}

## psd\_category\_id

If you do not provide this optional parameter, your uploaded PSD file will automatically be assigned to the default "**Other**" category.

This is the list of available PSD Category IDs at this moment:

{% code fullWidth="false" %}

```json

        {
            "id": 1,
            "name": "T-shirts",
        },
        {
            "id": 2,
            "name": "Hoodies",    
        },
        {
            "id": 3,
            "name": "Wall Art",
        },
        {
            "id": 4,
            "name": "Mugs",
        },
        {
            "id": 5,
            "name": "Sweatshirts",
        },
        {
            "id": 6,
            "name": "Other", //default category if not provided as psd_category_id
        },
        {
            "id": 7,
            "name": "Pillows",
        },
        {
            "id": 8,
            "name": "Tote Bags",
        },
        {
            "id": 9,
            "name": "Phone Cases",
        },
        {
            "id": 10,
            "name": "Blankets",
        }
```

{% endcode %}

## mockup\_template.create\_after\_upload

If you are subscribed to our [PRO plans](https://dynamicmockups.com/pricing/) and have uploaded your own Photoshop files using our web application, you know that after uploading PSD files you need to create a Mockup first from the uploaded PSD file and then use **Mockup UUID** and all other Mockup components via [Render API](https://docs.dynamicmockups.com/api-reference/render-api).

**Now you can fully automate this flow!**

If you provide `mockup_template.create_after_upload: true` A mockup will be automatically created from the uploaded PSD file and our API will return in response a lot of useful data regarding the created mockup.

After mockup creation is successful, use the **Mockup** **UUID** and **Smart Object UUIDs** field to render images automatically using our [Render API](https://docs.dynamicmockups.com/api-reference/render-api).

### Response example

```json
{
    "data": {
        "uuid": "65c10d09-6724-4026-89a4-2cbf00f8670f", //Mockup UUID
        "name": "My mockup automatically created after PSD upload",
        "thumbnail": "https://app-design-copilot-localhost.s3.eu-central-1.amazonaws.com/mockup/251/thumbnail.webp",
        "smart_objects": [
            {
                "uuid": "c39de536-7255-40d4-9458-6215355a5e30",
                "name": "T-shirt"
            },
            {
                "uuid": "2574e3aa-74a3-4fee-b10d-aa3721f2ee26",
                "name": "Background"
            }
        ],
        "collections": [],
        "psd": {
            "uuid": "38607fc2-fa2d-4113-ba70-8bded3f44c23",
            "name": "My custom name"
        }
    },
    "success": true,
    "message": ""
}
```

This created Mockup will regularly show as any other created mockup in the web application. You can even fetch it using the [Get Mockups API](https://docs.dynamicmockups.com/api-reference/get-mockups-api) when you need it.

## mockup\_template.collections

You probably noticed the **collections** field that has an empty array from the previous example.

In the [Collections API](https://docs.dynamicmockups.com/api-reference/get-collections-api), you can create and retrieve collections.

You may provide a **collections** optional field to the PSD Upload API to automatically put the created mockup in the collections array of strings, which will be returned in the PSD Upload API response as well, instead of an empty array.

{% hint style="warning" %}
Please note that if you want to **add** the mockup to the **collections** automatically after the PSD Upload, **you must set** `mockup_template.create_after_upload` to `true`
{% endhint %}

## mockup\_template.catalog\_uuid

`catalog_uuid` optional parameter is used to add the mockup template directly to the selected catalog.

Use the [Catalog API](https://docs.dynamicmockups.com/api-reference/catalogs-api) to list all the available catalogs and use the UUID from them to set as `catalog_uuid`

If `catalog_uuid` is not provided or is `false`, the mockup will be added to the default catalog.
