---
updatedAt: 2025-06-04T20:05:34.000Z
agentTools:
  projectIndex: https://developers.plugg.to/llms.txt
---

# Create/Update and Delete Stock Table

## Instructions

When creating a stock table, our API will create a unique "ID" for that table, so you can update or delete it whenever you want.

## Request object has the following properties:

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>
        Attribute
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        code
      </td>

      <td>
        string
      </td>

      <td>
        Price table name
      </td>
    </tr>

    <tr>
      <td>
        type
      </td>

      <td>
        string
      </td>

      <td>
        own or supplier
      </td>
    </tr>

    <tr>
      <td>
        priority
      </td>

      <td>
        string
      </td>

      <td>
        Table priority\
        0 is the high priority
      </td>
    </tr>

    <tr>
      <td>
        quantity
      </td>

      <td>
        integer
      </td>

      <td>
        quantity of stock available
      </td>
    </tr>

    <tr>
      <td>
        handling\_time
      </td>

      <td>
        string
      </td>

      <td>
        handling time
      </td>
    </tr>
  </tbody>
</Table>

## Example of Stock Table creation

```json Body raw
{
    "stock_table": [
        {
            "code": "YOUR_CODE",
            "type": "own",
            "priority": 0, 
            "quantity": 10,
            "price": 2.22,
            "special_price": 1.22,
            "handling_time": 10
        },
        {
            "code": "YOUR_CODE_2",
            "type": "supplier",
            "priority": 1,
            "quantity": 3,
            "price": 2.22,
            "special_price": 1.22,
            "handling_time": 10
        }
    ]
}
```

## Example of Stock Table return

Return example after creating the stock table, see that when creating it generated an "id".

```json Return - 200 OK
{
    "stock_table": [
        {
            "price_history": [],
            "specialprice_history": [],
            "stock_history": [],
            "code": "YOUR_CODE",
            "type": "own",
            "priority": 0,
            "reserved": 0,
            "quantity": 10,
            "price": 2.22,
            "special_price": 1.22,
            "handling_time": 10,
            "id": "60ca141bf2170c5e36d31f77"
        },
        {
            "price_history": [],
            "specialprice_history": [],
            "stock_history": [],
            "code": "YOUR_CODE_2",
            "type": "supplier",
            "priority": 1,
            "reserved": 0,
            "quantity": 3,
            "price": 2.22,
            "special_price": 1.22,
            "handling_time": 10,
            "id": "60ca141bf2170c5e36d31f7b"
        }
    ]
}
```

## Update Example

In this example update, change the inventory of the YOUR\_CODE table.

I will use the **"code"** to make this inventory change.

```json
{
    "stock_table": [
        {
            "code": "YOUR_CODE",
            "quantity": 20
        }
    ]
}
```

## Example of Stock Table return

```json Return - 200 OK
{
    "stock_table": [
        {
            "price_history": [],
            "specialprice_history": [],
            "stock_history": [],
            "code": "YOUR_CODE",
            "type": "own",
            "priority": 0,
            "reserved": 0,
            "quantity": 20,
            "price": 2.22,
            "special_price": 1.22,
            "handling_time": 10,
            "id": "60ca141bf2170c5e36d31f77"
        },
        {
            "price_history": [],
            "specialprice_history": [],
            "stock_history": [],
            "code": "YOUR_CODE_2",
            "type": "supplier",
            "priority": 1,
            "reserved": 0,
            "quantity": 3,
            "price": 2.22,
            "special_price": 1.22,
            "handling_time": 10,
            "id": "60ca141bf2170c5e36d31f7b"
        }
    ]
}
```

## Deleting Stock Table

To delete an stock table, just enter the corresponding "code" and send "remove" with "true" value.

```json Body raw
{
    "stock_table": [
        {
            "code": "YOUR_CODE",
            "remove": true
        }
    ]
}
```

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "api-pluggto",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.plugg.to"
    }
  ],
  "security": [
    {}
  ],
  "paths": {
    "/skus/{product_skus}": {
      "put": {
        "summary": "Create/Update and Delete Stock Table",
        "description": "",
        "operationId": "createupdate-and-delete-stock-table",
        "parameters": [
          {
            "name": "product_skus",
            "in": "path",
            "description": "Parent product SKU  or Variation SKU",
            "schema": {
              "type": "string",
              "default": "sku"
            },
            "required": true
          },
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer Token",
            "schema": {
              "type": "string",
              "default": "Bearer {ACESS_TOKEN}"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "schema": {
              "type": "string",
              "default": "application/json"
            }
          },
          {
            "name": "Accept",
            "in": "header",
            "schema": {
              "type": "string",
              "default": "application/json"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```