<commit_before>---
title: Shipments
description: Use the Spree Commerce storefront API to access Shipment data.
---

# Shipments API

## Mine

Retrieve a list of the current user's shipments by making this request:

```text
GET /api/v1/shipments/mine```

Shipments are paginated and can be iterated through by passing along a `page` parameter:

```text
GET /api/v1/shipments/mine?page=2```

### Parameters

page
: The page number of shipments to display.

per_page
: The number of shipments to return per page.

### Response

<%= headers 200 %>
<%= json(:shipment) do |h|
{
  shipments: [h],
  count: 25,
  current_page: 1,
  pages: 5
}
end %>

## Create

<%= admin_only %>

The following attributes are required when creating a shipment:

- order_id
- stock_location_id
- variant_id

To create a shipment, make a request like this:

```text
POST /api/v1/shipments?shipment[order_id]=R123456789```

The `order_id` is the number of the order to create a shipment for and is provided as part of the URL string as shown above. The shipment will be created at the selected stock location and include the variant selected.

Assuming in this instance that you want to create a shipment with a stock_location_id of `1` and a variant_id of `10` for order `R1234567`, send through the parameters like this:

<%= json \
  order_id: R1234567,
  stock_location_id: 1,
  variant_id: 10
%>

### Response
<commit_msg>[skip ci] fix nanoc compile error<commit_after>---
title: Shipments
description: Use the Spree Commerce storefront API to access Shipment data.
---

# Shipments API

## Mine

Retrieve a list of the current user's shipments by making this request:

```text
GET /api/v1/shipments/mine```

Shipments are paginated and can be iterated through by passing along a `page` parameter:

```text
GET /api/v1/shipments/mine?page=2```

### Parameters

page
: The page number of shipments to display.

per_page
: The number of shipments to return per page.

### Response

<%= headers 200 %>
<%= json(:shipment) do |h|
{
  shipments: [h],
  count: 25,
  current_page: 1,
  pages: 5
}
end %>

## Create

<%= admin_only %>

The following attributes are required when creating a shipment:

- order_id
- stock_location_id
- variant_id

To create a shipment, make a request like this:

```text
POST /api/v1/shipments?shipment[order_id]=R123456789```

The `order_id` is the number of the order to create a shipment for and is provided as part of the URL string as shown above. The shipment will be created at the selected stock location and include the variant selected.

Assuming in this instance that you want to create a shipment with a stock_location_id of `1` and a variant_id of `10` for order `R1234567`, send through the parameters like this:

<%= json \
  order_id: "R1234567",
  stock_location_id: 1,
  variant_id: 10
%>

### Response

{'fraction_non_alphanumeric': 0.09341825902335456, 'fraction_numerical': 0.028308563340410473, 'mean_word_length': 4.177655677655678, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2739280', 'n_tokens_mistral': 966, 'n_tokens_neox': 863, 'n_words': 377}