---
title: "Create SKU"
source_url: https://docs.rapyd.net/en/create-sku.html
lang: en
---

# Create SKU

Create an SKU and attach it to a product.

Relevant to products where `type` is **goods**. You can attach several SKUs to a single product.

This method triggers the **SKU Created** webhook. This webhook contains the same information as the response.

> **Note:**
>
> If the product defined an array of `attributes`, then you must include an `attributes` object that assigns values to those attributes, as in the example below.

### Parameters

### Request Header Parameters

- - access_key
  - Unique access key provided by Rapyd for each authorized user.

    See [Developers](https://docs.rapyd.net/en/developers.md "Developers").
- - Content-Type
  - Indicates that the data appears in JSON format. Set to **application/json**.
- - idempotency
  - A unique key that prevents the platform from creating the same object twice.

    See [Idempotency](https://docs.rapyd.net/en/idempotency.md "Idempotency").
- - salt
  - Random string. Recommended length: 8-16 characters.
- - signature
  - Signature calculated for each request individually.

    See [Request Signatures](https://docs.rapyd.net/en/request-signatures.md "Request Signatures").
- - timestamp
  - Timestamp for the request, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time") (seconds).

### Request Body Parameters

- - active
  - Indicates whether the product is currently available for purchase.

    false
- - attributes
  - Up to 5 alphanumeric key-value pairs defined by the merchant. For example:

    ```json
    {
        "size": 12,
        "color": "red",
        "arm_rest": true
    }
    ```

    Each key must match a string in the `attributes` list of the corresponding `product` object.
- - currency
  - Three-letter ISO 4217 code for the currency used in the `price` parameter.
- - id
  - ID of the `sku` object. Alphanumeric characters and underscores (_). If the client does not provide this value, Rapyd creates a string starting with **sku_**.
- - image
  - URL of image associated with the product.
- - inventory
  - Describes the items packaged together as a SKU item.

    - - quantity
      - The number of units available in inventory. Integer. Relevant when `type` is **finite**.
    - - type
      - One of the following values:

        - **finite** - Physical objects that can be counted.
        - **infinite** - Products such as downloadable software.
        - **bucket** - Products that are sold by measurable quantity.
    - - value
      - The status of the product on hand in inventory. Relevant when `type` is **bucket**. One of the following:

        - **in_stock** - A normal amount of product is available in inventory.
        - **limited** - There is enough product in inventory for small orders only.
        - **out_of_stock** - No product remains in inventory.
- - metadata
  - A JSON object defined by the client. See [Metadata](https://docs.rapyd.net/en/metadata.md "Metadata").
- - package_dimensions
  - Physical attributes of the SKU item. Object containing the following fields. These fields are represented as numbers, but it is the responsibility of the merchant to define and interpret the relevant units of length and weight.

    - - height
      - Height of the package, in units defined by the client.
    - - length
      - Length of the package, in units defined by the client.
    - - weight
      - Weight of the package, in units defined by the client.
    - - width
      - Width of the package, in units defined by the client.
- - price
  - The amount of the price. Decimal.
- - product
  - ID of the product that this SKU relates to. The `type` field of the product must be set to **goods**.

### Response Parameters

- - active
  - Indicates whether the product is currently being sold.
- - attributes
  - Up to 5 alphanumeric key-value pairs defined by the merchant. For example:

    ```json
    {
        "size": 12,
        "color": "red",
        "arm_rest": true
    }
    ```

    Each key must match a string in the `attributes` list of the corresponding `product` object.
- - created_at
  - Time of creation of this SKU, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").
- - currency
  - Three-letter ISO 4217 code for the currency used in the `price` field.
- - id
  - ID of the SKU object. Alphanumeric characters and underscores (_). Defined by the merchant, or a string starting with **sku_**.
- - image
  - URL of image associated with the product.
- - inventory
  - Contains the following fields:

    - - quantity
      - The number of units available in inventory. Integer. Relevant when `type` is **finite**.
    - - type
      - One of the following values:

        - **finite** - Physical objects that can be counted.
        - **infinite** - Products such as downloadable software.
        - **bucket** - Products that are sold by measurable quantity.
    - - value
      - The status of the product on hand in inventory. Relevant when `type` is **bucket**. One of the following:

        - **in_stock** - A normal amount of product is available in inventory.
        - **limited** - There is enough product in inventory for small orders only.
        - **out_of_stock** - No product remains in inventory.
- - metadata
  - A JSON object defined by the client. See [Metadata](https://docs.rapyd.net/en/metadata.md "Metadata").
- - package_dimensions
  - Physical attributes of the SKU item. Object containing the following fields. These fields are represented as numbers, but it is the responsibility of the merchant to define and interpret the relevant units of length and weight.

    - - height
      - Height of the package, in units defined by the client.
    - - length
      - Length of the package, in units defined by the client.
    - - weight
      - Weight of the package, in units defined by the client.
    - - width
      - Width of the package, in units defined by the client.
- - price
  - Price of one unit. Decimal.
- - product
  - ID of the product that this SKU relates to.
- - size
  - The size of the product.
- - updated_at
  - Time that this SKU was last updated, in [Unix time](https://docs.rapyd.net/en/glossary.md#UUID-945d98cf-adae-e1cf-2606-c7fae8b4a7e1_unix_time "Unix time").

### Code Samples

- - .NET

    - ```csharp
      using System;
      using System.Text.Json;

      namespace RapydApiRequestSample
      {
          class Program
          {
              static void Main(string[] args)
              {
                  try
                  {
                      var attributes = new 
                      {
                                color = "green"
                      };

                      var inventory = new 
                      {
                          quantity = 1,
                          type = "finite",
                          value = 600,
                      };

                      var metadata = new 
                      {
                          merchant_defined = true
                      };

                      var package_dimensions = new 
                      { 
                          length = 2,
                          height = 1,
                          weight = 3,
                          width = 4,
                      
                      };

                      var requestObj = new
                      {
                          id = "",
                          active = true,
                          attributes,
                          currency = "USD",
                          image = (string) null,
                          inventory,
                          metadata,
                          package_dimensions,
                          price = 600,
                          product = "product_f383d03c34fb499eb3ada4e3c574002a",
                      };

                      string request = JsonSerializer.Serialize(requestObj);

                      string result = RapydApiRequestSample.Utilities.MakeRequest("POST", "/v1/skus", request);

                      Console.WriteLine(result);
                  }
                  catch (Exception e)
                  {
                      Console.WriteLine("Error completing request: " + e.Message);
                  }
              }
          }
      }
      ```
- - JavaScript

    - ```javascript
      const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest;

      async function main() {
        try {
          const body = {
            id: '',
            active: true,
            attributes: {
              color: 'green'
            },
            currency: 'USD',
            image: null,
            inventory: {
              quantity: 1,
              type: 'finite',
              value: 600
            },
            metadata: {
              merchant_defined: 'true'
            },
            package_dimensions: {
              length: 2,
              height: 1,
              weight: 3,
              width: 4
            },
            price: 600,
            product: 'product_f383d03c34fb499eb3ada4e3c574002a'
          };
          const result = await makeRequest('POST', '/v1/skus', body);

          console.log(result);
        } catch (error) {
          console.error('Error completing request', error);
        }
      }
      ```
- - PHP

    - ```php
      <?php
      $path = $_SERVER['DOCUMENT_ROOT'];
      $path .= "/<path-to-your-utility-file>/utilities.php";
      include($path);
      // Message body:
      //{
      //    "product": "product_f383d03c34fb499eb3ada4e3c574002a",
      //    "price":600,
      //    "inventory": {
      //    "quantity": 1,
      //        "type": "finite",
      //        "value": 600
      //      }
      //}
      $body = [
          "product" => "product_f383d03c34fb499eb3ada4e3c574002a",
          "price" => 600,
          "inventory" => array(
              "quantity" => 1,
              "type" => "finite",
              "value" => 600
          )
      ];

      try {
          $object = make_request('post', '/v1/skus', $body);
          var_dump($object);
      } catch(Exception $e) {
          echo "Error: $e";
      }
      ?>
      ```
- - Python

    - ```python
      from pprint import pprint

      from utilities import make_request

      sku = {
          "active": True,
          "attributes": {
              "color": "green"
          },
          "currency": "USD",
          "inventory": {
              "quantity": 1,
              "type": "finite",
              "value": 600
          },
          "metadata": {
              "merchant_defined": True
          },
          "package_dimensions": {
              "length": 2,
              "height": 1,
              "weight": 3,
              "width": 4
          },
          "price": 600,
          "product": "product_f383d03c34fb499eb3ada4e3c574002a"
      }
      result = make_request(method='post', path='/v1/skus', body=sku)
      pprint(result)
      ```

- /v1/skus

- Create SKU
- ```curl
  curl -X post 'https://sandboxapi.rapyd.net/v1/skus' \
  -H 'access_key: your-access-key-here' \
  -H 'Content-Type: application/json' \
  -H 'idempotency: your-idempotency-parameter-here' \
  -H 'salt: your-random-string-here' \
  -H 'signature: your-calculated-signature-here' \
  -H 'timestamp: your-unix-timestamp-here' \
  --data-raw '{
      "id": "",
      "active": true,
      "attributes": {
          "color": "green",
          "arm_rest": true
      },
      "currency": "USD",
      "image": null,
      "inventory": {
          "quantity": 1,
          "type": "finite",
          "value": 600
      },
      "package_dimensions": {
          "length": 2,
          "height": 1,
          "weight": 3,
          "width": 4
      },
      "price": 600,
      "product": "product_1228f5334ea6cee9052137b85db1699b"
  }'
  ```
- ```json
  {
      "status": {
          "error_code": "",
          "status": "SUCCESS",
          "message": "",
          "response_code": "",
          "operation_id": "8369a615-249b-4cd0-a6f7-77a73beb5887"
      },
      "data": {
          "id": "sku_d11190572bf665f538ee7dcc60776df9",
          "active": true,
          "attributes": {
              "color": "green",
              "arm_rest": true
          },
          "created_at": 1761577337,
          "currency": "USD",
          "image": "",
          "inventory": {
              "type": "finite",
              "quantity": 1,
              "value": ""
          },
          "metadata": {},
          "price": 600,
          "product": "product_1228f5334ea6cee9052137b85db1699b",
          "package_dimensions": {
              "length": 2,
              "height": 1,
              "weight": 3,
              "width": 4
          },
          "updated_at": 1761577337
      }
  }
  ```
