SwagUp API: How to Send Swag from Inventory

Check inventory availability

You can check your inventory at any given moment using the SwagUp API. For this, you just need to make a GET request to:

 

https://api.swagup.com/api/v1/account-products/?visible_in_inventory=true

 

From this request, you will get all the products and their inventory. This helps you decide whether you need to reorder a product again, in case you are running out of stock; and you'll know which product you can send.

 

Example response*:
{
 "id": 22615,
"description": null,
 "image": "https://swagup-static.swagup.com/platform/media/accounts/account_3963/account-products/p22615-1627572695317.png",
"sort_order": 1,
 "record_type": "Pack",
"stock": [
  {
    "size": {
       "id": 3,
       "name": "M",
       "category": "Apparel",
       "modified_on": "2020-10-22T22:38:19.169442Z",
       "sort_order": 4
    },
     "quantity": 50,
     "minimum": 1,
     "modified_on": "2021-07-16T15:30:03.638223Z"
  },
  {
    "size": {
       "id": 4,
       "name": "L",
       "category": "Apparel",
       "modified_on": "2020-10-22T22:38:26.821228Z",
       "sort_order": 5
    },
     "quantity": 55,
     "minimum": 1,
     "modified_on": "2021-07-16T15:30:05.515597Z"
  }
],
 "status": "Approved",
 "created_at": "2021-07-16T11:29:51Z",
 "created_by": null,
 "modified_on": "2021-07-16T15:30:03.106336Z",
 "modified_by": null,
 "theme_color": null,
 "theme_color_hex": null,
"items": [
  {
    "product": {
       "id": 22610,
       "description": "High quality vinyl stickers from Stickermule. Weatherproof and tear-proof mean these stickers will last a lifetime. It's always worth it to throw 2 or 3 of these in a pack!",
       "name": "Die Cut Stickers - 6 square inches",
       "image": "https://swagup-static.swagup.com/platform/media/accounts/account_3963/account-products/p22610-1626449410139.png",
       "price": "0.00",
       "sort_order": 1,
       "record_type": "Product",
       "status": "Approved",
       "is_apparel": false,
       "created_at": "2021-07-16T11:29:43Z",
       "created_by": null,
       "modified_on": "2021-07-16T15:30:02.269078Z",
       "modified_by": null,
       "theme_color": "Full Color",
       "theme_color_hex": "FFFFFF",
       "primary_color_requirement": null,
       "secondary_color_requirement": null,
       "enabled": true,
       "can_ship_international": true,
       "base_product": 129,
      "available_colors": [
        {
           "id": 33489,
           "name": "Full Color",
           "product_code": "Die Cut Stickers",
           "group_color": "White",
           "hex_color": "FFFFFF"
        }
      ],
      "available_imprint_options": [
"Full Color"
      ],
      "decorations": [
        {
           "Artwork2": "",
           "Artwork1": "",
          "Colors": [
"black",
"darkcyan"
          ],
           "Notes": "",
           "Dimensions": "1.51x1.65",
           "Location": "Front",
           "Imprint_Type": "Full Color",
           "Artwork2_S3_Location": "",
           "Artwork1_S3_Location": "",
           "Name": "D-82590"
        }
      ]
    },
     "units_per_pack": 1
  }
],
 "is_apparel": true,
 "minimum_to_reorder": 50,
 "standard_turnaround_time": 45,
 "rush_turnaround_time": 24,
 "name": "Pack 7/16/2021",
 "visible_in_inventory": true,
 "enabled": true,
 "storage_category": 1,
 "can_ship_international": true,
 "decorations": null,
 "product_type": 1,
 "rush_production": true
}
* The response examples in this guide have been truncated to show less data.

You can check information about every product available. Under the stock key you'll find the stock quantities breakdown for each size available for each product.

 

Example:
{
    "size": {
       "id": 3,
       "name": "M",
       "category": "Apparel",
       "modified_on": "2020-10-22T22:38:19.169442Z",
       "sort_order": 4
    },
     "quantity": 50,
     "minimum": 1,
     "modified_on": "2021-07-16T15:30:03.638223Z"
}

 

In the previous example, we have 50 units available for the M size.

 

Send swag from inventory

One of the key features of the SwagUp API is to send swag on-demand from inventory. For this, you can make a POST request to:

 

https://api.swagup.com/api/v1/employee-orders/

 

You need to include shipping information, and the product to send with its quantities. For this, you need to create a payload like the following

 

Example payload:
[
{
  "employee": {
     "first_name": "John",
     "last_name": "Doe",
     "email": "john_doe@email.com",
     "title": "Engineer",
     "phone_number": "+11111111111",
     "shipping_country": "US",
     "shipping_state": "NJ",
     "shipping_city": "Union City",
     "shipping_zip": "07087",
     "shipping_address1": "2607 New York Ave"
  },
  "products": [
    {
       "product": 22691,
      "sizes": [
        {
           "size": 3,
           "quantity": 1
        }
      ]
    }
  ],
   "shipping_date": "2021-09-20",
   "express": false
]

This will create a shipment that will be sent on the specified shipping_date to the provided shipping address. The express key controls whether you want to use an express delivery method or not. You will get a response like the following:

 

Example response*:
[
{
   "id": 96228,
  "employee": {
     "id": 133807,
     "title": null,
     "first_name": "John",
     "last_name": "Doe",
     "birth_date": null,
     "shipping_address1": "2607 New York Ave",
     "shipping_address2": null,
     "shipping_city": "Union City",
     "shipping_state": "NJ",
     "shipping_zip": "07087",
     "shipping_country": "US",
     "size": null,
     "external_id": null,
     "photo": null,
     "email": "john_doe@email.com",
     "phone_number": "+17862547896",
     "created_at": "2021-08-31T21:18:17.268713Z",
     "modified_on": "2021-08-31T21:18:17.281330Z",
     "source": null,
     "redacted": false,
     "account": 3963
  },
   "date": "2021-08-31",
   "status": "Scheduled",
   "tracking": null,
  "products": [
    {
      "product": {
         "id": 22691,
         "description": null,
         "name": "Pack 7/19/2021",
         "image": "https://swagup-static.swagup.com/platform/media/accounts/account_3963/account-products/p22691-1626735771014.png",
         "price": "78.10",
         "sort_order": 1,
         "record_type": "Pack",
         "status": "Approved",
         "is_apparel": true,
         "created_at": "2021-07-19T18:15:44Z",
         "created_by": null,
         "modified_on": "2021-07-19T23:04:23.637354Z",
         "modified_by": null,
         "theme_color": null,
         "theme_color_hex": null,
         "primary_color_requirement": null,
         "secondary_color_requirement": null,
         "enabled": true,
         "can_ship_international": true,
         "base_product": null,
        "available_colors": [],
         "available_imprint_options": null,
         "standard_turnaround_time": 52,
         "rush_turnaround_time": 27,
         "decorations": null
      },
       "quantity": 1,
      "size": {
         "id": 3,
         "name": "M",
         "category": "Apparel",
         "modified_on": "2020-10-22T22:38:19.169442Z",
         "sort_order": 4
      },
       "price": "78.10",
       "total": 78.1,
       "production_time": "Standard"
    }
  ],
   "tracking_url": null,
   "order_no": null,
   "shipping_date": "2021-09-20",
   "shipping_notes": null,
   "modified_on": "2021-08-31T21:22:41.412345Z",
   "source": null,
   "total_shipping": "12.00",
   "shipping": "12.00",
   "tax": "0.00",
  "delivery_method": {
     "id": 1,
     "name": "Standard",
     "turnaround_time_min_days": 3,
     "turnaround_time_max_days": 5,
     "turnaround_time": "3-5 business days",
     "country": "US"
  },
   "shipping_first_name": "John",
   "shipping_last_name": "Doe",
   "shipping_address1": "2607 New York Ave",
   "shipping_address2": null,
   "shipping_city": "Union City",
   "shipping_state": "NJ",
   "shipping_zip": "07087",
   "shipping_country": "US",
   "status_detail": null,
   "status_updated_at": null,
   "external_id": null,
   "redacted": false,
   "invalid_address_error_message": null,
   "total_fulfillment": 0,
   "is_paid": true,
   "phone_number": "+17862547896"
}
]

* The response examples in this guide have been truncated to show less data.

 

The value of the shipment will be reflected on the total_shipping key. This amount will be subtracted from your credit balance. See here how to compute shipping prices beforehand.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.

Articles in this section

Ask a question
Not sure how something works or how to make changes? Don’t worry, we’ll answer all your questions.
Our help desk hours:
9:00am - 4:00pm EST Monday to Friday
Follow us on Twitter
Get the latest news and updates first