> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shipstream.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Packing Instructions

## Methods

* [order\_instruction.create](#order-instruction-create)
* [order\_instruction.edit](#order-instruction-edit)
* [order\_instruction.list](#order-instruction-list)
* [order\_instruction.delete](#order-instruction-delete)

***

## Entity Properties

* [Packing instruction](#order-instruction-properties)
* [Packing instruction Confirmation](#order-instruction-confirmation-properties)

***

## `order_instruction.create`

`order_instruction.create (string $orderUniqueId, string $note, object|null $options)`

Create a new Packing Instruction.

### Parameters

<ParamField path="orderUniqueId" type="string">
  Order unique ID
</ParamField>

<ParamField path="note" type="string">
  Note
</ParamField>

<ParamField path="options" type="object | null">
  Additional Options (see [Packing Instruction](#order-instruction-properties))
</ParamField>

### Return Value

An object with the new [Packing Instruction](#order-instruction-properties). The "file\_content" property is not returned. Use the [order\_instruction.list](#order-instruction-list) method to retrieve it.

### Example Request

No file to print

```json title="Request" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "method" : "call",
    "params" : [
        "be1c13ed4e03f0ed7f1e4053dfff9658",
        "order_instruction.create",
        [
            "100000309",
            "Sign gift card with 'Happy Birthday, Susan!'",
            {
                "presentation" : "once_per_order"
            }
        ]
    ]
}
```

Upload a file using Base64 encoding

```json title="Request" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "method" : "call",
    "params" : [
        "be1c13ed4e03f0ed7f1e4053dfff9658",
        "order_instruction.create",
        [
            "100000309",
            "Place Amazon FBA Label in a pouch",
            {
                "file_name" : "amazon_fba_3425232.pdf",
                "file_content" : "base64-encoded file contents",
                "presentation" : "once_per_shipment",
                "print_target" : "LASER"
            }
        ]
    ]
}
```

Upload a file using an HTTP request

```json title="Request" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "method" : "call",
    "params" : [
        "be1c13ed4e03f0ed7f1e4053dfff9658",
        "order_instruction.create",
        [
            "100000309",
            "Place Amazon FBA Label in a pouch",
            {
                "file_name" : "amazon_fba_3425232.pdf",
                "file_request" : {
                    "url": "https://....",
                    "auth": ["username...","password..."],
                    "headers": {
                        "X-Custom-Header": "header value..."
                    }
                },
                "presentation" : "once_per_shipment",
                "print_target" : "LASER"
            }
        ]
    ]
}
```

### Example Response

```json title="Response" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "error" : null,
    "result" : {
        "instruction_id" : 1,
        "order_id" : 118,
        "unique_id" : "100000309",
        "note" : "Place Amazon FBA Label in a pouch",
        "file_name" : "amazon_fba_3425232.pdf",
        "presentation" : "once_per_shipment",
        "print_target" : "LASER",
        "copies_printed" : "0",
        "confirmations" : []
    }
}
```

### Error Codes

| code | message                                       |
| ---- | --------------------------------------------- |
| 100  | Invalid data given. Details in error message. |
| 102  | Requested order does not exist.               |

***

## `order_instruction.edit`

`order_instruction.edit (string $instructionId, string|null $note, object|null $options)`

Modify the packing instruction.

### Parameters

<ParamField path="instructionId" type="string | integer">
  Instruction ID
</ParamField>

<ParamField path="note" type="string | null">
  Note
</ParamField>

<ParamField path="options" type="object | null">
  Additional Options (see [Packing Instruction](#order-instruction-properties))
</ParamField>

### Return Value

An object with the updated [Packing Instruction](#order-instruction-properties). The "file\_content" property is not returned.

### Example Request

```json title="Request" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "method" : "call",
    "params" : [
        "be1c13ed4e03f0ed7f1e4053dfff9658",
        "order_instruction.edit",
        [
            123,
            null,
            {
                "presentation" : "once_per_order"
            }
        ]
    ]
}
```

### Example Response

```json title="Response" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "error" : null,
    "result" : {
        "instruction_id" : 1,
        "order_id" : 118,
        "unique_id" : "100000309",
        "note" : "Place Amazon FBA Label in a pouch",
        "file_name" : "amazon_fba_3425232.pdf",
        "presentation" : "once_per_order",
        "print_target" : "LASER",
        "copies_printed" : "0",
        "confirmations" : []
    }
}
```

### Error Codes

| code | message                                       |
| ---- | --------------------------------------------- |
| 100  | Invalid data given. Details in error message. |
| 101  | Requested packing instruction does not exist. |

***

## `order_instruction.list`

`order_instruction.list (string $orderUniqueId, array|null $fields = [])`

Retrieve list of packing instructions.

### Parameters

<ParamField path="orderUniqueId" type="string">
  Order unique ID
</ParamField>

<ParamField path="fields" type="array | null">
  Fields
</ParamField>

### Return Value

An array of objects. Each object will contain [Packing Instruction](#order-instruction-properties) properties. Include "file\_content" to the list of the fields to return the "file\_content" property.

### Example Request

```json title="Request" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "method" : "call",
    "params" : [
        "be1c13ed4e03f0ed7f1e4053dfff9658",
        "order_instruction.list",
        [
            "100000309"
        ]
    ]
}
```

### Example Response

```json title="Response" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "error" : null,
    "result" : [
        {
            "instruction_id" : 1,
            "order_id" : 118,
            "unique_id" : "100000309",
            "note" : "Place Amazon FBA Label in a pouch",
            "file_name" : "amazon_fba_3425232.pdf",
            "presentation" : "once_per_shipment",
            "print_target" : "LASER",
            "copies_printed" : "1",
            "confirmations" : [
                {
                    "confirmed_id" : "1",
                    "confirmed_at": "2022-02-08T14:59:38+00:00"
                }
            ]
        }
    ]
}
```

### Error Codes

| code | message                                       |
| ---- | --------------------------------------------- |
| 100  | Invalid data given. Details in error message. |
| 102  | Requested order does not exist.               |

***

## `order_instruction.delete`

`order_instruction.delete (string $instructionId)`

Delete packing instruction.

### Parameters

<ParamField path="instructionId" type="string | integer">
  Instruction ID
</ParamField>

### Return Value

`true` if the packing instruction was deleted.

### Example Request

```json title="Request" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "method" : "call",
    "params" : [
        "be1c13ed4e03f0ed7f1e4053dfff9658",
        "order_instruction.delete",
        [
            123
        ]
    ]
}
```

### Example Response

```json title="Response" theme={null}
{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "error" : null,
    "result" : true
}
```

## Entity Properties

### Packing Instruction Properties

<Expandable title="Packing Instruction Properties">
  <ParamField path="note" type="string">
    Instruction to the packer. The note is required.
  </ParamField>

  <ParamField path="file_name" type="string">
    The name to be given to the file attached using the "file\_content" or "file\_request" properties.
  </ParamField>

  <ParamField path="file_content" type="string">
    The base64-encoded contents of the file. If specified you must also provide a "file\_name".
  </ParamField>

  <ParamField path="file_request" type="object">
    Attach a file using a url instead of `file_content`. The file will be downloaded using the optional `auth` and `headers` if specified. The `file_name` will be used if specified, but is optional and will otherwise be set using the `Content-Disposition` header value or the last part of the url.
  </ParamField>

  <ParamField path="presentation" type="string">
    The "presentation" property. Allowed values: "once\_per\_order", "once\_per\_shipment", "once\_per\_package".
  </ParamField>

  <ParamField path="print_target" type="string">
    The "print\_target" property. Allowed values: "LABEL", "SMALL\_LABEL", "LASER".
  </ParamField>

  <ParamField path="copies_printed" type="string">
    The "copies\_printed" property.
  </ParamField>

  <ParamField path="confirmations" type="array">
    The instruction confirmations. See [Packing instruction Confirmation Properties](#order-instruction-confirmation-properties).
  </ParamField>
</Expandable>

### Packing instruction Confirmation Properties

<Expandable title="Packing instruction Confirmation Properties">
  <ParamField path="confirmed_id" type="string">
    The ID of the instruction confirmation.
  </ParamField>

  <ParamField path="confirmed_at" type="string">
    Date and time when the instruction was confirmed in ISO 8601 format.
  </ParamField>
</Expandable>
