> For the complete documentation index, see [llms.txt](https://developers.flipsnack.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.flipsnack.com/products/create.md).

# products.create

The products.create method allows external systems—such as PIMs, ERPs, or custom integrations—to send product data directly to Flipsnack. Each request must include an apiSecretKey for authentication, a sourceHash to group the products, and a list of product objects. Submitted products become visible in the Automation tab in the Design Studio, replacing the need for manual CSV imports.

**Note:** Requests must be made to **<https://api.flipsnack.com/v1>**

### Rules & Limitations

* Payloads must follow a predefined JSON schema
* Up to 500 products per request
* Maximum payload size: 200 MB
* sourceHash must be generated and persisted by the client and must be a maximum 64-character identifier used to group products under a specific source. Clients are responsible for generating and persisting this value for future updates or deletions
* Variants must be nested inside their parent product
* Duplicate SKUs within the same request or under the same sourceHash are not allowed

### Feed Organization

Clients can submit products under one or multiple sourceHash values, allowing them to manage separate product feeds. **The sourceHash is also required for future updates or deletions.**

## Request parameters <a href="#request_params" id="request_params"></a>

| Name                                | Type   | Description                                                                                                                                                                                                                                                                                                                                                                      |
| ----------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>apiKey (required)</p><p><br></p> | string | The API key provided for your user. If it is not specified, the request will return the error code "30 - Missing mandatory parameter". If the key is incorrect the request returns the error code "41 - Invalid credentials".                                                                                                                                                    |
| signature (required)                | string | The signature must be calculated by you and added to the request. See[ How to sign a request](https://developers.flipsnack.com/how-to-sign-a-request) for more information.If the parameter is missing the request will return the error code "30 - Missing mandatory parameter". If the signature is incorrect the request will return the error code "44 - Invalid signature". |
| action (required)                   | string | The API method that should be called. In this case the value should be products.create. If it is not specified, the request will return the error code "30 - Missing mandatory parameter".                                                                                                                                                                                       |
| sourceHash (required)               | string | This needs to be a unique identifier within flipsnack to be able to update based on it the products and also to have the possibility to create multiple feeds from the same API                                                                                                                                                                                                  |
| products (required)                 | JSON   | It’s a JSON containing all the products that are going to pe created                                                                                                                                                                                                                                                                                                             |
| feedName (required)                 | string | The name, how the feed will be listed in automation list in app                                                                                                                                                                                                                                                                                                                  |

### &#x20;Products example as JSON type

Below is an example of the expected JSON structure for products.

Notes:

* `variants` is optional. If included, it must be an array of objects.
* Custom field keys can be any key-value pair, but must not contain dots (`.`) (e.g., use `custom_field` instead of `custom.field`).

```json
[
    {
        "type": "string", // required
        "code": "string", // required
        "[your_custom_field_1]": "string | number | boolean",
        "[your_custom_field_2]": "string | number | boolean",
        "variants": [  // optional
            {
                "code": "string", // required
                "parent_code": "string", // required
                "[your_custom_field_1]": "string | number | boolean",
                "[your_custom_field_2]": "string | number | boolean"
            }
        ]
    }
]

```

## Response parameters

| Name                   | Type   | Description                                                                                                                                                                                                                                                              |
| ---------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p>code</p><p><br></p> | string | <p>Possible values:</p><ul><li>20: When all goes well and action is executed correctly</li><li>40: When data submitted has invalid data of wrong format</li><li>51: When the mac number of products sent is exceeded</li><li>30: Missing a mandatory parameter</li></ul> |
| status                 | string | Message related to code                                                                                                                                                                                                                                                  |
| data                   | JSON   | It's a JSON with more details about the response it has a more detailed message about the outcome, errors or data which is an array of exact messages                                                                                                                    |

## Error codes <a href="#error_codes" id="error_codes"></a>

For complete list of error codes and messages go to [API status codes](/api-status-codes.md) section.

## Examples <a href="#example" id="example"></a>

### Request

{% tabs %}
{% tab title="cURL" %}

```bash
# GET
curl -X POST https://api.flipsnack.com/v1/ \
-F action=products.create \
-F apiKey=<YOUR-API-KEY> \
-F signature=<YOUR-REQUEST-SIGNATURE> \
-F sourceHash=<YOUR-SOURCE-HASH> \
-F products="<YOUR-PRODUCTS>” 

```

{% endtab %}

{% tab title="HTML" %}

```html
<form method="get" action="https://api.flipsnack.com/v1/">
   <input type="hidden" name="action" value="products.create">
   <input type="hidden" name="apiKey" value="<YOUR-API-KEY>">
   <input type="hidden" name="sourceHash" value="<YOUR-SOURCE-HASH>">
   <input type="hidden" name="products" value="<YOUR-PRODUCTS>">
   <button type="submit">Submit</button>
</form>
```

{% endtab %}
{% endtabs %}

### Response

{% tabs %}
{% tab title="Success" %}

```
{
    "code": 20,
    "status":"",
    "data": {
        "message":"Products created successfully",
        "errors":[]
    }
}

```

{% endtab %}

{% tab title="Error" %}

<pre><code>{
<strong>    "code": 40,
</strong>    "status": "",
    "data": {
        "message": "Invalid or incomplete data sent!",
        "errors": [
            "Variable \"$products\" got invalid value \"\" at \"products[0].discount_price\"; Int cannot represent non-integer value: \"\""
        ]
    }
}



</code></pre>

{% endtab %}
{% endtabs %}
