# Custom Envelopes

## Create Custom Envelope

**post** `/print-mail/v1/custom_envelopes`

Creates a new custom envelope. The artwork is reviewed after it is
uploaded: the custom envelope is returned with a `status` of `pending`
and moves to `approved` or `rejected` once the review finishes. Create a custom envelope via a multipart/form-data request. Accepts the
same fields as the JSON create body; use this content type to upload the
PDF file directly.

### Header Parameters

- `"idempotency-key": optional string`

### Body Parameters

- `envelopeType: "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

  The type of a custom envelope. This determines the envelope's size and the
  windows that your artwork must leave clear.

  - `"standard_double_window"`

  - `"standard_single_window"`

  - `"standard_large_window"`

  - `"6x9_large_window"`

  - `"9x12_single_window"`

- `pdf: string or string`

  A URL pointing to the PDF of the custom envelope's artwork, or the PDF
  file itself. The PDF must have exactly two pages (front and back) at the
  dimensions of the chosen `envelopeType`.

  - `string`

  - `BinaryFile = string`

    Represents a raw file upload. Sending the actual file requires a
    `multipart/form-data` request; in `application/json` request bodies,
    supply a URL instead.

- `description: optional string`

  An optional string describing this resource. Will be visible in the API and the dashboard.

- `metadata: optional map[unknown]`

  See the section on Metadata.

### Returns

- `CustomEnvelope object { id, available, createdAt, 10 more }`

  - `id: string`

    A unique ID prefixed with custom_envelope_

  - `available: number`

    The quantity of custom envelopes available to use in your orders
    immediately. This increases when a custom envelope order is filled and
    decreases as you send orders which include this custom envelope.

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "custom_envelope"`

    Always `custom_envelope`.

    - `"custom_envelope"`

  - `status: "pending" or "approved" or "rejected"`

    The review status of a custom envelope's artwork.

    - `"pending"`

    - `"approved"`

    - `"rejected"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `envelopeType: optional "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

    The type of a custom envelope. This determines the envelope's size and the
    windows that your artwork must leave clear.

    - `"standard_double_window"`

    - `"standard_single_window"`

    - `"standard_large_window"`

    - `"6x9_large_window"`

    - `"9x12_single_window"`

  - `lowInventoryThreshold: optional CustomEnvelopeLowInventoryThreshold`

    A low-inventory threshold. When the available quantity of a custom envelope
    drops to or below the threshold, we send a low-inventory alert email to the
    Admins of your organization.

    An alert can only be sent once at least one order for the custom envelope
    has been filled. Once an alert is sent, we don't send another until a new
    order is filled or you change the threshold.

    - `type: "fixed" or "percentage"`

      How the value of a low-inventory threshold is interpreted.

      - `"fixed"`

      - `"percentage"`

    - `value: number`

      A whole number. For `fixed` this is an available quantity and must be 1
      or greater. For `percentage` this is a percentage of the quantity of the
      last filled order and must be between 1 and 100.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `rejectionReason: optional "content_overlapping_restricted_region" or "incomplete_image" or "internal_error"`

    Why the artwork of a custom envelope was rejected.

    - `"content_overlapping_restricted_region"`

    - `"incomplete_image"`

    - `"internal_error"`

  - `url: optional string`

    A signed URL to the PDF of the custom envelope's artwork.

### Example

```http
curl https://api.postgrid.com/print-mail/v1/custom_envelopes \
    -H 'Content-Type: application/json' \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY" \
    -F envelopeType=standard_single_window \
    -F pdf=https://postgrid-public.s3.amazonaws.com/custom-envelope-artwork.pdf
```

#### Response

```json
{
  "id": "custom_envelope_sqF12lZ1VlBb",
  "available": 0,
  "createdAt": "2019-12-27T18:11:19.117Z",
  "live": true,
  "object": "custom_envelope",
  "status": "pending",
  "updatedAt": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "envelopeType": "standard_double_window",
  "lowInventoryThreshold": {
    "type": "fixed",
    "value": 1
  },
  "metadata": {
    "foo": "bar"
  },
  "rejectionReason": "content_overlapping_restricted_region",
  "url": "https://example.com"
}
```

## List Custom Envelopes

**get** `/print-mail/v1/custom_envelopes`

Gets a list of custom envelopes for the user.

### Query Parameters

- `limit: optional number`

- `search: optional string`

  You can supply any string to help narrow down the list of resources. For example, if you pass `"New York"` (quoted), it will return resources that have that string present somewhere in their response. Alternatively, you can supply a structured search query. See the documentation on `StructuredSearchQuery` for more details.

- `skip: optional number`

### Returns

- `data: array of CustomEnvelope`

  - `id: string`

    A unique ID prefixed with custom_envelope_

  - `available: number`

    The quantity of custom envelopes available to use in your orders
    immediately. This increases when a custom envelope order is filled and
    decreases as you send orders which include this custom envelope.

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "custom_envelope"`

    Always `custom_envelope`.

    - `"custom_envelope"`

  - `status: "pending" or "approved" or "rejected"`

    The review status of a custom envelope's artwork.

    - `"pending"`

    - `"approved"`

    - `"rejected"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `envelopeType: optional "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

    The type of a custom envelope. This determines the envelope's size and the
    windows that your artwork must leave clear.

    - `"standard_double_window"`

    - `"standard_single_window"`

    - `"standard_large_window"`

    - `"6x9_large_window"`

    - `"9x12_single_window"`

  - `lowInventoryThreshold: optional CustomEnvelopeLowInventoryThreshold`

    A low-inventory threshold. When the available quantity of a custom envelope
    drops to or below the threshold, we send a low-inventory alert email to the
    Admins of your organization.

    An alert can only be sent once at least one order for the custom envelope
    has been filled. Once an alert is sent, we don't send another until a new
    order is filled or you change the threshold.

    - `type: "fixed" or "percentage"`

      How the value of a low-inventory threshold is interpreted.

      - `"fixed"`

      - `"percentage"`

    - `value: number`

      A whole number. For `fixed` this is an available quantity and must be 1
      or greater. For `percentage` this is a percentage of the quantity of the
      last filled order and must be between 1 and 100.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `rejectionReason: optional "content_overlapping_restricted_region" or "incomplete_image" or "internal_error"`

    Why the artwork of a custom envelope was rejected.

    - `"content_overlapping_restricted_region"`

    - `"incomplete_image"`

    - `"internal_error"`

  - `url: optional string`

    A signed URL to the PDF of the custom envelope's artwork.

- `limit: number`

- `object: "list"`

  - `"list"`

- `skip: number`

- `totalCount: number`

### Example

```http
curl https://api.postgrid.com/print-mail/v1/custom_envelopes \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY"
```

#### Response

```json
{
  "object": "list",
  "limit": 10,
  "skip": 0,
  "totalCount": 1,
  "data": [
    {
      "id": "custom_envelope_iPu6EaCbSUjZN7bEW8Qhee",
      "object": "custom_envelope",
      "live": false,
      "description": "Spring campaign envelope",
      "envelopeType": "standard_single_window",
      "available": 5000,
      "status": "approved",
      "url": "https://pg-prod-bucket-1.s3.amazonaws.com/test/custom_envelope_iPu6EaCbSUjZN7bEW8Qhee.pdf?AWSAccessKeyId=AKIA&Expires=1736870000&Signature=abc",
      "createdAt": "2021-12-16T03:06:17.419Z",
      "updatedAt": "2021-12-16T03:06:17.419Z"
    }
  ]
}
```

## Get Custom Envelope

**get** `/print-mail/v1/custom_envelopes/{id}`

Gets the information for a custom envelope by `id`. This should be a
unique identifying string starting with `custom_envelope_`.

### Path Parameters

- `id: string`

### Returns

- `CustomEnvelope object { id, available, createdAt, 10 more }`

  - `id: string`

    A unique ID prefixed with custom_envelope_

  - `available: number`

    The quantity of custom envelopes available to use in your orders
    immediately. This increases when a custom envelope order is filled and
    decreases as you send orders which include this custom envelope.

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "custom_envelope"`

    Always `custom_envelope`.

    - `"custom_envelope"`

  - `status: "pending" or "approved" or "rejected"`

    The review status of a custom envelope's artwork.

    - `"pending"`

    - `"approved"`

    - `"rejected"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `envelopeType: optional "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

    The type of a custom envelope. This determines the envelope's size and the
    windows that your artwork must leave clear.

    - `"standard_double_window"`

    - `"standard_single_window"`

    - `"standard_large_window"`

    - `"6x9_large_window"`

    - `"9x12_single_window"`

  - `lowInventoryThreshold: optional CustomEnvelopeLowInventoryThreshold`

    A low-inventory threshold. When the available quantity of a custom envelope
    drops to or below the threshold, we send a low-inventory alert email to the
    Admins of your organization.

    An alert can only be sent once at least one order for the custom envelope
    has been filled. Once an alert is sent, we don't send another until a new
    order is filled or you change the threshold.

    - `type: "fixed" or "percentage"`

      How the value of a low-inventory threshold is interpreted.

      - `"fixed"`

      - `"percentage"`

    - `value: number`

      A whole number. For `fixed` this is an available quantity and must be 1
      or greater. For `percentage` this is a percentage of the quantity of the
      last filled order and must be between 1 and 100.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `rejectionReason: optional "content_overlapping_restricted_region" or "incomplete_image" or "internal_error"`

    Why the artwork of a custom envelope was rejected.

    - `"content_overlapping_restricted_region"`

    - `"incomplete_image"`

    - `"internal_error"`

  - `url: optional string`

    A signed URL to the PDF of the custom envelope's artwork.

### Example

```http
curl https://api.postgrid.com/print-mail/v1/custom_envelopes/$ID \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY"
```

#### Response

```json
{
  "id": "custom_envelope_iPu6EaCbSUjZN7bEW8Qhee",
  "object": "custom_envelope",
  "live": false,
  "description": "Spring campaign envelope",
  "envelopeType": "standard_single_window",
  "available": 5000,
  "status": "approved",
  "url": "https://pg-prod-bucket-1.s3.amazonaws.com/test/custom_envelope_iPu6EaCbSUjZN7bEW8Qhee.pdf?AWSAccessKeyId=AKIA&Expires=1736870000&Signature=abc",
  "createdAt": "2021-12-16T03:06:17.419Z",
  "updatedAt": "2021-12-16T03:06:17.419Z"
}
```

## Set Custom Envelope Low-Inventory Threshold

**post** `/print-mail/v1/custom_envelopes/{id}/threshold`

Sets the low-inventory threshold for the custom envelope by `id`,
replacing any threshold that was set before. When the available quantity
drops to or below the threshold, we send a low-inventory alert email to
the Admins of your organization.

### Path Parameters

- `id: string`

### Header Parameters

- `"idempotency-key": optional string`

### Body Parameters

- `type: "fixed" or "percentage"`

  How the value of a low-inventory threshold is interpreted.

  - `"fixed"`

  - `"percentage"`

- `value: number`

  A whole number. For `fixed` this is an available quantity and must be 1
  or greater. For `percentage` this is a percentage of the quantity of the
  last filled order and must be between 1 and 100.

### Returns

- `CustomEnvelope object { id, available, createdAt, 10 more }`

  - `id: string`

    A unique ID prefixed with custom_envelope_

  - `available: number`

    The quantity of custom envelopes available to use in your orders
    immediately. This increases when a custom envelope order is filled and
    decreases as you send orders which include this custom envelope.

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "custom_envelope"`

    Always `custom_envelope`.

    - `"custom_envelope"`

  - `status: "pending" or "approved" or "rejected"`

    The review status of a custom envelope's artwork.

    - `"pending"`

    - `"approved"`

    - `"rejected"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `envelopeType: optional "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

    The type of a custom envelope. This determines the envelope's size and the
    windows that your artwork must leave clear.

    - `"standard_double_window"`

    - `"standard_single_window"`

    - `"standard_large_window"`

    - `"6x9_large_window"`

    - `"9x12_single_window"`

  - `lowInventoryThreshold: optional CustomEnvelopeLowInventoryThreshold`

    A low-inventory threshold. When the available quantity of a custom envelope
    drops to or below the threshold, we send a low-inventory alert email to the
    Admins of your organization.

    An alert can only be sent once at least one order for the custom envelope
    has been filled. Once an alert is sent, we don't send another until a new
    order is filled or you change the threshold.

    - `type: "fixed" or "percentage"`

      How the value of a low-inventory threshold is interpreted.

      - `"fixed"`

      - `"percentage"`

    - `value: number`

      A whole number. For `fixed` this is an available quantity and must be 1
      or greater. For `percentage` this is a percentage of the quantity of the
      last filled order and must be between 1 and 100.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `rejectionReason: optional "content_overlapping_restricted_region" or "incomplete_image" or "internal_error"`

    Why the artwork of a custom envelope was rejected.

    - `"content_overlapping_restricted_region"`

    - `"incomplete_image"`

    - `"internal_error"`

  - `url: optional string`

    A signed URL to the PDF of the custom envelope's artwork.

### Example

```http
curl https://api.postgrid.com/print-mail/v1/custom_envelopes/$ID/threshold \
    -H 'Content-Type: application/json' \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY" \
    -d '{
          "type": "fixed",
          "value": 1000
        }'
```

#### Response

```json
{
  "id": "custom_envelope_iPu6EaCbSUjZN7bEW8Qhee",
  "object": "custom_envelope",
  "live": false,
  "description": "Spring campaign envelope",
  "envelopeType": "standard_single_window",
  "available": 5000,
  "status": "approved",
  "url": "https://pg-prod-bucket-1.s3.amazonaws.com/test/custom_envelope_iPu6EaCbSUjZN7bEW8Qhee.pdf?AWSAccessKeyId=AKIA&Expires=1736870000&Signature=abc",
  "createdAt": "2021-12-16T03:06:17.419Z",
  "updatedAt": "2021-12-16T03:06:17.419Z",
  "lowInventoryThreshold": {
    "type": "fixed",
    "value": 1000
  }
}
```

## Clear Custom Envelope Low-Inventory Threshold

**delete** `/print-mail/v1/custom_envelopes/{id}/threshold`

Clears the low-inventory threshold for the custom envelope by `id`. We
stop sending low-inventory alerts for the custom envelope.

### Path Parameters

- `id: string`

### Header Parameters

- `"idempotency-key": optional string`

### Returns

- `CustomEnvelope object { id, available, createdAt, 10 more }`

  - `id: string`

    A unique ID prefixed with custom_envelope_

  - `available: number`

    The quantity of custom envelopes available to use in your orders
    immediately. This increases when a custom envelope order is filled and
    decreases as you send orders which include this custom envelope.

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "custom_envelope"`

    Always `custom_envelope`.

    - `"custom_envelope"`

  - `status: "pending" or "approved" or "rejected"`

    The review status of a custom envelope's artwork.

    - `"pending"`

    - `"approved"`

    - `"rejected"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `envelopeType: optional "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

    The type of a custom envelope. This determines the envelope's size and the
    windows that your artwork must leave clear.

    - `"standard_double_window"`

    - `"standard_single_window"`

    - `"standard_large_window"`

    - `"6x9_large_window"`

    - `"9x12_single_window"`

  - `lowInventoryThreshold: optional CustomEnvelopeLowInventoryThreshold`

    A low-inventory threshold. When the available quantity of a custom envelope
    drops to or below the threshold, we send a low-inventory alert email to the
    Admins of your organization.

    An alert can only be sent once at least one order for the custom envelope
    has been filled. Once an alert is sent, we don't send another until a new
    order is filled or you change the threshold.

    - `type: "fixed" or "percentage"`

      How the value of a low-inventory threshold is interpreted.

      - `"fixed"`

      - `"percentage"`

    - `value: number`

      A whole number. For `fixed` this is an available quantity and must be 1
      or greater. For `percentage` this is a percentage of the quantity of the
      last filled order and must be between 1 and 100.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `rejectionReason: optional "content_overlapping_restricted_region" or "incomplete_image" or "internal_error"`

    Why the artwork of a custom envelope was rejected.

    - `"content_overlapping_restricted_region"`

    - `"incomplete_image"`

    - `"internal_error"`

  - `url: optional string`

    A signed URL to the PDF of the custom envelope's artwork.

### Example

```http
curl https://api.postgrid.com/print-mail/v1/custom_envelopes/$ID/threshold \
    -X DELETE \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY"
```

#### Response

```json
{
  "id": "custom_envelope_iPu6EaCbSUjZN7bEW8Qhee",
  "object": "custom_envelope",
  "live": false,
  "description": "Spring campaign envelope",
  "envelopeType": "standard_single_window",
  "available": 5000,
  "status": "approved",
  "url": "https://pg-prod-bucket-1.s3.amazonaws.com/test/custom_envelope_iPu6EaCbSUjZN7bEW8Qhee.pdf?AWSAccessKeyId=AKIA&Expires=1736870000&Signature=abc",
  "createdAt": "2021-12-16T03:06:17.419Z",
  "updatedAt": "2021-12-16T03:06:17.419Z"
}
```

## Domain Types

### Custom Envelope

- `CustomEnvelope object { id, available, createdAt, 10 more }`

  - `id: string`

    A unique ID prefixed with custom_envelope_

  - `available: number`

    The quantity of custom envelopes available to use in your orders
    immediately. This increases when a custom envelope order is filled and
    decreases as you send orders which include this custom envelope.

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "custom_envelope"`

    Always `custom_envelope`.

    - `"custom_envelope"`

  - `status: "pending" or "approved" or "rejected"`

    The review status of a custom envelope's artwork.

    - `"pending"`

    - `"approved"`

    - `"rejected"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `envelopeType: optional "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

    The type of a custom envelope. This determines the envelope's size and the
    windows that your artwork must leave clear.

    - `"standard_double_window"`

    - `"standard_single_window"`

    - `"standard_large_window"`

    - `"6x9_large_window"`

    - `"9x12_single_window"`

  - `lowInventoryThreshold: optional CustomEnvelopeLowInventoryThreshold`

    A low-inventory threshold. When the available quantity of a custom envelope
    drops to or below the threshold, we send a low-inventory alert email to the
    Admins of your organization.

    An alert can only be sent once at least one order for the custom envelope
    has been filled. Once an alert is sent, we don't send another until a new
    order is filled or you change the threshold.

    - `type: "fixed" or "percentage"`

      How the value of a low-inventory threshold is interpreted.

      - `"fixed"`

      - `"percentage"`

    - `value: number`

      A whole number. For `fixed` this is an available quantity and must be 1
      or greater. For `percentage` this is a percentage of the quantity of the
      last filled order and must be between 1 and 100.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `rejectionReason: optional "content_overlapping_restricted_region" or "incomplete_image" or "internal_error"`

    Why the artwork of a custom envelope was rejected.

    - `"content_overlapping_restricted_region"`

    - `"incomplete_image"`

    - `"internal_error"`

  - `url: optional string`

    A signed URL to the PDF of the custom envelope's artwork.

### Custom Envelope Low Inventory Threshold

- `CustomEnvelopeLowInventoryThreshold object { type, value }`

  A low-inventory threshold. When the available quantity of a custom envelope
  drops to or below the threshold, we send a low-inventory alert email to the
  Admins of your organization.

  An alert can only be sent once at least one order for the custom envelope
  has been filled. Once an alert is sent, we don't send another until a new
  order is filled or you change the threshold.

  - `type: "fixed" or "percentage"`

    How the value of a low-inventory threshold is interpreted.

    - `"fixed"`

    - `"percentage"`

  - `value: number`

    A whole number. For `fixed` this is an available quantity and must be 1
    or greater. For `percentage` this is a percentage of the quantity of the
    last filled order and must be between 1 and 100.

# Orders

## Create Custom Envelope Order

**post** `/print-mail/v1/custom_envelopes/{id}/orders`

Creates a batch order of custom envelopes. The minimum order quantity is
5000.

### Path Parameters

- `id: string`

### Header Parameters

- `"idempotency-key": optional string`

### Body Parameters

- `quantityOrdered: number`

  The quantity of custom envelopes ordered. Minimum 5000.

- `description: optional string`

  An optional string describing this resource. Will be visible in the API and the dashboard.

- `metadata: optional map[unknown]`

  See the section on Metadata.

### Returns

- `CustomEnvelopeOrder object { id, createdAt, customEnvelope, 8 more }`

  - `id: string`

    A unique ID prefixed with custom_envelope_order_

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `customEnvelope: string or CustomEnvelope`

    The ID of the custom envelope that this order replenishes. Expanded into
    the full custom envelope object on the individual order retrieval, fill
    and cancellation endpoints when `expand[]=customEnvelope` is supplied.

    - `string`

    - `CustomEnvelope object { id, available, createdAt, 10 more }`

      - `id: string`

        A unique ID prefixed with custom_envelope_

      - `available: number`

        The quantity of custom envelopes available to use in your orders
        immediately. This increases when a custom envelope order is filled and
        decreases as you send orders which include this custom envelope.

      - `createdAt: string`

        The UTC time at which this resource was created.

      - `live: boolean`

        `true` if this is a live mode resource else `false`.

      - `object: "custom_envelope"`

        Always `custom_envelope`.

        - `"custom_envelope"`

      - `status: "pending" or "approved" or "rejected"`

        The review status of a custom envelope's artwork.

        - `"pending"`

        - `"approved"`

        - `"rejected"`

      - `updatedAt: string`

        The UTC time at which this resource was last updated.

      - `description: optional string`

        An optional string describing this resource. Will be visible in the API and the dashboard.

      - `envelopeType: optional "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

        The type of a custom envelope. This determines the envelope's size and the
        windows that your artwork must leave clear.

        - `"standard_double_window"`

        - `"standard_single_window"`

        - `"standard_large_window"`

        - `"6x9_large_window"`

        - `"9x12_single_window"`

      - `lowInventoryThreshold: optional CustomEnvelopeLowInventoryThreshold`

        A low-inventory threshold. When the available quantity of a custom envelope
        drops to or below the threshold, we send a low-inventory alert email to the
        Admins of your organization.

        An alert can only be sent once at least one order for the custom envelope
        has been filled. Once an alert is sent, we don't send another until a new
        order is filled or you change the threshold.

        - `type: "fixed" or "percentage"`

          How the value of a low-inventory threshold is interpreted.

          - `"fixed"`

          - `"percentage"`

        - `value: number`

          A whole number. For `fixed` this is an available quantity and must be 1
          or greater. For `percentage` this is a percentage of the quantity of the
          last filled order and must be between 1 and 100.

      - `metadata: optional map[unknown]`

        See the section on Metadata.

      - `rejectionReason: optional "content_overlapping_restricted_region" or "incomplete_image" or "internal_error"`

        Why the artwork of a custom envelope was rejected.

        - `"content_overlapping_restricted_region"`

        - `"incomplete_image"`

        - `"internal_error"`

      - `url: optional string`

        A signed URL to the PDF of the custom envelope's artwork.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "custom_envelope_order"`

    Always `custom_envelope_order`.

    - `"custom_envelope_order"`

  - `quantityOrdered: number`

    The quantity of custom envelopes ordered. Minimum 5000.

  - `status: "placed" or "in_progress" or "filled" or "cancelled"`

    The status of a custom envelope order.

    - `"placed"`

    - `"in_progress"`

    - `"filled"`

    - `"cancelled"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `quantityFilled: optional number`

    The quantity of custom envelopes that were filled for this order. Only
    returned once the order's status is `filled`.

### Example

```http
curl https://api.postgrid.com/print-mail/v1/custom_envelopes/$ID/orders \
    -H 'Content-Type: application/json' \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY" \
    -d '{
          "quantityOrdered": 5000
        }'
```

#### Response

```json
{
  "id": "custom_envelope_order_6qZ2LHGvyYh4h6Ud1uUctT",
  "object": "custom_envelope_order",
  "live": false,
  "customEnvelope": "custom_envelope_iPu6EaCbSUjZN7bEW8Qhee",
  "quantityOrdered": 5000,
  "status": "placed",
  "createdAt": "2021-12-16T03:23:22.617Z",
  "updatedAt": "2021-12-16T03:23:22.617Z"
}
```

## List Custom Envelope Orders

**get** `/print-mail/v1/custom_envelopes/{id}/orders`

Gets a list of orders for the custom envelope by `id`.

### Path Parameters

- `id: string`

### Query Parameters

- `limit: optional number`

- `search: optional string`

  You can supply any string to help narrow down the list of resources. For example, if you pass `"New York"` (quoted), it will return resources that have that string present somewhere in their response. Alternatively, you can supply a structured search query. See the documentation on `StructuredSearchQuery` for more details.

- `skip: optional number`

### Returns

- `data: array of CustomEnvelopeOrder`

  - `id: string`

    A unique ID prefixed with custom_envelope_order_

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `customEnvelope: string or CustomEnvelope`

    The ID of the custom envelope that this order replenishes. Expanded into
    the full custom envelope object on the individual order retrieval, fill
    and cancellation endpoints when `expand[]=customEnvelope` is supplied.

    - `string`

    - `CustomEnvelope object { id, available, createdAt, 10 more }`

      - `id: string`

        A unique ID prefixed with custom_envelope_

      - `available: number`

        The quantity of custom envelopes available to use in your orders
        immediately. This increases when a custom envelope order is filled and
        decreases as you send orders which include this custom envelope.

      - `createdAt: string`

        The UTC time at which this resource was created.

      - `live: boolean`

        `true` if this is a live mode resource else `false`.

      - `object: "custom_envelope"`

        Always `custom_envelope`.

        - `"custom_envelope"`

      - `status: "pending" or "approved" or "rejected"`

        The review status of a custom envelope's artwork.

        - `"pending"`

        - `"approved"`

        - `"rejected"`

      - `updatedAt: string`

        The UTC time at which this resource was last updated.

      - `description: optional string`

        An optional string describing this resource. Will be visible in the API and the dashboard.

      - `envelopeType: optional "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

        The type of a custom envelope. This determines the envelope's size and the
        windows that your artwork must leave clear.

        - `"standard_double_window"`

        - `"standard_single_window"`

        - `"standard_large_window"`

        - `"6x9_large_window"`

        - `"9x12_single_window"`

      - `lowInventoryThreshold: optional CustomEnvelopeLowInventoryThreshold`

        A low-inventory threshold. When the available quantity of a custom envelope
        drops to or below the threshold, we send a low-inventory alert email to the
        Admins of your organization.

        An alert can only be sent once at least one order for the custom envelope
        has been filled. Once an alert is sent, we don't send another until a new
        order is filled or you change the threshold.

        - `type: "fixed" or "percentage"`

          How the value of a low-inventory threshold is interpreted.

          - `"fixed"`

          - `"percentage"`

        - `value: number`

          A whole number. For `fixed` this is an available quantity and must be 1
          or greater. For `percentage` this is a percentage of the quantity of the
          last filled order and must be between 1 and 100.

      - `metadata: optional map[unknown]`

        See the section on Metadata.

      - `rejectionReason: optional "content_overlapping_restricted_region" or "incomplete_image" or "internal_error"`

        Why the artwork of a custom envelope was rejected.

        - `"content_overlapping_restricted_region"`

        - `"incomplete_image"`

        - `"internal_error"`

      - `url: optional string`

        A signed URL to the PDF of the custom envelope's artwork.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "custom_envelope_order"`

    Always `custom_envelope_order`.

    - `"custom_envelope_order"`

  - `quantityOrdered: number`

    The quantity of custom envelopes ordered. Minimum 5000.

  - `status: "placed" or "in_progress" or "filled" or "cancelled"`

    The status of a custom envelope order.

    - `"placed"`

    - `"in_progress"`

    - `"filled"`

    - `"cancelled"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `quantityFilled: optional number`

    The quantity of custom envelopes that were filled for this order. Only
    returned once the order's status is `filled`.

- `limit: number`

- `object: "list"`

  - `"list"`

- `skip: number`

- `totalCount: number`

### Example

```http
curl https://api.postgrid.com/print-mail/v1/custom_envelopes/$ID/orders \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY"
```

#### Response

```json
{
  "object": "list",
  "limit": 10,
  "skip": 0,
  "totalCount": 1,
  "data": [
    {
      "id": "custom_envelope_order_6qZ2LHGvyYh4h6Ud1uUctT",
      "object": "custom_envelope_order",
      "live": false,
      "customEnvelope": "custom_envelope_iPu6EaCbSUjZN7bEW8Qhee",
      "quantityOrdered": 5000,
      "status": "placed",
      "createdAt": "2021-12-16T03:23:22.617Z",
      "updatedAt": "2021-12-16T03:23:22.617Z"
    }
  ]
}
```

## Get Custom Envelope Order

**get** `/print-mail/v1/custom_envelopes/{id}/orders/{orderID}`

Gets a specific custom envelope order by custom envelope ID as `id` and
custom envelope order ID as `orderID`.

### Path Parameters

- `id: string`

- `orderID: string`

### Query Parameters

- `expand: optional array of "customEnvelope"`

  Pass `expand[]=customEnvelope` to expand the order's
  `customEnvelope` field into the full custom envelope object.

  - `"customEnvelope"`

### Returns

- `CustomEnvelopeOrder object { id, createdAt, customEnvelope, 8 more }`

  - `id: string`

    A unique ID prefixed with custom_envelope_order_

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `customEnvelope: string or CustomEnvelope`

    The ID of the custom envelope that this order replenishes. Expanded into
    the full custom envelope object on the individual order retrieval, fill
    and cancellation endpoints when `expand[]=customEnvelope` is supplied.

    - `string`

    - `CustomEnvelope object { id, available, createdAt, 10 more }`

      - `id: string`

        A unique ID prefixed with custom_envelope_

      - `available: number`

        The quantity of custom envelopes available to use in your orders
        immediately. This increases when a custom envelope order is filled and
        decreases as you send orders which include this custom envelope.

      - `createdAt: string`

        The UTC time at which this resource was created.

      - `live: boolean`

        `true` if this is a live mode resource else `false`.

      - `object: "custom_envelope"`

        Always `custom_envelope`.

        - `"custom_envelope"`

      - `status: "pending" or "approved" or "rejected"`

        The review status of a custom envelope's artwork.

        - `"pending"`

        - `"approved"`

        - `"rejected"`

      - `updatedAt: string`

        The UTC time at which this resource was last updated.

      - `description: optional string`

        An optional string describing this resource. Will be visible in the API and the dashboard.

      - `envelopeType: optional "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

        The type of a custom envelope. This determines the envelope's size and the
        windows that your artwork must leave clear.

        - `"standard_double_window"`

        - `"standard_single_window"`

        - `"standard_large_window"`

        - `"6x9_large_window"`

        - `"9x12_single_window"`

      - `lowInventoryThreshold: optional CustomEnvelopeLowInventoryThreshold`

        A low-inventory threshold. When the available quantity of a custom envelope
        drops to or below the threshold, we send a low-inventory alert email to the
        Admins of your organization.

        An alert can only be sent once at least one order for the custom envelope
        has been filled. Once an alert is sent, we don't send another until a new
        order is filled or you change the threshold.

        - `type: "fixed" or "percentage"`

          How the value of a low-inventory threshold is interpreted.

          - `"fixed"`

          - `"percentage"`

        - `value: number`

          A whole number. For `fixed` this is an available quantity and must be 1
          or greater. For `percentage` this is a percentage of the quantity of the
          last filled order and must be between 1 and 100.

      - `metadata: optional map[unknown]`

        See the section on Metadata.

      - `rejectionReason: optional "content_overlapping_restricted_region" or "incomplete_image" or "internal_error"`

        Why the artwork of a custom envelope was rejected.

        - `"content_overlapping_restricted_region"`

        - `"incomplete_image"`

        - `"internal_error"`

      - `url: optional string`

        A signed URL to the PDF of the custom envelope's artwork.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "custom_envelope_order"`

    Always `custom_envelope_order`.

    - `"custom_envelope_order"`

  - `quantityOrdered: number`

    The quantity of custom envelopes ordered. Minimum 5000.

  - `status: "placed" or "in_progress" or "filled" or "cancelled"`

    The status of a custom envelope order.

    - `"placed"`

    - `"in_progress"`

    - `"filled"`

    - `"cancelled"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `quantityFilled: optional number`

    The quantity of custom envelopes that were filled for this order. Only
    returned once the order's status is `filled`.

### Example

```http
curl https://api.postgrid.com/print-mail/v1/custom_envelopes/$ID/orders/$ORDER_ID \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY"
```

#### Response

```json
{
  "id": "custom_envelope_order_6qZ2LHGvyYh4h6Ud1uUctT",
  "object": "custom_envelope_order",
  "live": false,
  "customEnvelope": "custom_envelope_iPu6EaCbSUjZN7bEW8Qhee",
  "quantityOrdered": 5000,
  "status": "placed",
  "createdAt": "2021-12-16T03:23:22.617Z",
  "updatedAt": "2021-12-16T03:23:22.617Z"
}
```

## Progress Test Custom Envelope Order

**post** `/print-mail/v1/custom_envelopes/{id}/orders/{orderID}/progress`

Moves the custom envelope order by `orderID` for the custom envelope by
`id` from `placed` to `in_progress`. This is only available in test mode
and can be used to simulate how a live order would be produced.

Note: this will fail with a
`custom_envelope_order_progress_failed_error` if the order's status is
not `placed`.

### Path Parameters

- `id: string`

- `orderID: string`

### Returns

- `CustomEnvelopeOrder object { id, createdAt, customEnvelope, 8 more }`

  - `id: string`

    A unique ID prefixed with custom_envelope_order_

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `customEnvelope: string or CustomEnvelope`

    The ID of the custom envelope that this order replenishes. Expanded into
    the full custom envelope object on the individual order retrieval, fill
    and cancellation endpoints when `expand[]=customEnvelope` is supplied.

    - `string`

    - `CustomEnvelope object { id, available, createdAt, 10 more }`

      - `id: string`

        A unique ID prefixed with custom_envelope_

      - `available: number`

        The quantity of custom envelopes available to use in your orders
        immediately. This increases when a custom envelope order is filled and
        decreases as you send orders which include this custom envelope.

      - `createdAt: string`

        The UTC time at which this resource was created.

      - `live: boolean`

        `true` if this is a live mode resource else `false`.

      - `object: "custom_envelope"`

        Always `custom_envelope`.

        - `"custom_envelope"`

      - `status: "pending" or "approved" or "rejected"`

        The review status of a custom envelope's artwork.

        - `"pending"`

        - `"approved"`

        - `"rejected"`

      - `updatedAt: string`

        The UTC time at which this resource was last updated.

      - `description: optional string`

        An optional string describing this resource. Will be visible in the API and the dashboard.

      - `envelopeType: optional "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

        The type of a custom envelope. This determines the envelope's size and the
        windows that your artwork must leave clear.

        - `"standard_double_window"`

        - `"standard_single_window"`

        - `"standard_large_window"`

        - `"6x9_large_window"`

        - `"9x12_single_window"`

      - `lowInventoryThreshold: optional CustomEnvelopeLowInventoryThreshold`

        A low-inventory threshold. When the available quantity of a custom envelope
        drops to or below the threshold, we send a low-inventory alert email to the
        Admins of your organization.

        An alert can only be sent once at least one order for the custom envelope
        has been filled. Once an alert is sent, we don't send another until a new
        order is filled or you change the threshold.

        - `type: "fixed" or "percentage"`

          How the value of a low-inventory threshold is interpreted.

          - `"fixed"`

          - `"percentage"`

        - `value: number`

          A whole number. For `fixed` this is an available quantity and must be 1
          or greater. For `percentage` this is a percentage of the quantity of the
          last filled order and must be between 1 and 100.

      - `metadata: optional map[unknown]`

        See the section on Metadata.

      - `rejectionReason: optional "content_overlapping_restricted_region" or "incomplete_image" or "internal_error"`

        Why the artwork of a custom envelope was rejected.

        - `"content_overlapping_restricted_region"`

        - `"incomplete_image"`

        - `"internal_error"`

      - `url: optional string`

        A signed URL to the PDF of the custom envelope's artwork.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "custom_envelope_order"`

    Always `custom_envelope_order`.

    - `"custom_envelope_order"`

  - `quantityOrdered: number`

    The quantity of custom envelopes ordered. Minimum 5000.

  - `status: "placed" or "in_progress" or "filled" or "cancelled"`

    The status of a custom envelope order.

    - `"placed"`

    - `"in_progress"`

    - `"filled"`

    - `"cancelled"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `quantityFilled: optional number`

    The quantity of custom envelopes that were filled for this order. Only
    returned once the order's status is `filled`.

### Example

```http
curl https://api.postgrid.com/print-mail/v1/custom_envelopes/$ID/orders/$ORDER_ID/progress \
    -X POST \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY"
```

#### Response

```json
{
  "id": "custom_envelope_order_6qZ2LHGvyYh4h6Ud1uUctT",
  "object": "custom_envelope_order",
  "live": false,
  "customEnvelope": "custom_envelope_iPu6EaCbSUjZN7bEW8Qhee",
  "quantityOrdered": 5000,
  "status": "in_progress",
  "createdAt": "2021-12-16T03:23:22.617Z",
  "updatedAt": "2021-12-16T03:23:22.617Z"
}
```

## Fill Test Custom Envelope Order

**post** `/print-mail/v1/custom_envelopes/{id}/orders/{orderID}/fills`

Fills the custom envelope order by `orderID` for the custom envelope by
`id`. This is only available in test mode and can be used to simulate
how a live order would be filled.

Note: this will fail with a `custom_envelope_order_fill_failed_error` if
the order's status is not `in_progress`, and with a
`custom_envelope_order_fill_not_approved_error` if the custom envelope
has not been approved.

### Path Parameters

- `id: string`

- `orderID: string`

### Query Parameters

- `expand: optional array of "customEnvelope"`

  Pass `expand[]=customEnvelope` to expand the order's
  `customEnvelope` field into the full custom envelope object.

  - `"customEnvelope"`

### Returns

- `CustomEnvelopeOrder object { id, createdAt, customEnvelope, 8 more }`

  - `id: string`

    A unique ID prefixed with custom_envelope_order_

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `customEnvelope: string or CustomEnvelope`

    The ID of the custom envelope that this order replenishes. Expanded into
    the full custom envelope object on the individual order retrieval, fill
    and cancellation endpoints when `expand[]=customEnvelope` is supplied.

    - `string`

    - `CustomEnvelope object { id, available, createdAt, 10 more }`

      - `id: string`

        A unique ID prefixed with custom_envelope_

      - `available: number`

        The quantity of custom envelopes available to use in your orders
        immediately. This increases when a custom envelope order is filled and
        decreases as you send orders which include this custom envelope.

      - `createdAt: string`

        The UTC time at which this resource was created.

      - `live: boolean`

        `true` if this is a live mode resource else `false`.

      - `object: "custom_envelope"`

        Always `custom_envelope`.

        - `"custom_envelope"`

      - `status: "pending" or "approved" or "rejected"`

        The review status of a custom envelope's artwork.

        - `"pending"`

        - `"approved"`

        - `"rejected"`

      - `updatedAt: string`

        The UTC time at which this resource was last updated.

      - `description: optional string`

        An optional string describing this resource. Will be visible in the API and the dashboard.

      - `envelopeType: optional "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

        The type of a custom envelope. This determines the envelope's size and the
        windows that your artwork must leave clear.

        - `"standard_double_window"`

        - `"standard_single_window"`

        - `"standard_large_window"`

        - `"6x9_large_window"`

        - `"9x12_single_window"`

      - `lowInventoryThreshold: optional CustomEnvelopeLowInventoryThreshold`

        A low-inventory threshold. When the available quantity of a custom envelope
        drops to or below the threshold, we send a low-inventory alert email to the
        Admins of your organization.

        An alert can only be sent once at least one order for the custom envelope
        has been filled. Once an alert is sent, we don't send another until a new
        order is filled or you change the threshold.

        - `type: "fixed" or "percentage"`

          How the value of a low-inventory threshold is interpreted.

          - `"fixed"`

          - `"percentage"`

        - `value: number`

          A whole number. For `fixed` this is an available quantity and must be 1
          or greater. For `percentage` this is a percentage of the quantity of the
          last filled order and must be between 1 and 100.

      - `metadata: optional map[unknown]`

        See the section on Metadata.

      - `rejectionReason: optional "content_overlapping_restricted_region" or "incomplete_image" or "internal_error"`

        Why the artwork of a custom envelope was rejected.

        - `"content_overlapping_restricted_region"`

        - `"incomplete_image"`

        - `"internal_error"`

      - `url: optional string`

        A signed URL to the PDF of the custom envelope's artwork.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "custom_envelope_order"`

    Always `custom_envelope_order`.

    - `"custom_envelope_order"`

  - `quantityOrdered: number`

    The quantity of custom envelopes ordered. Minimum 5000.

  - `status: "placed" or "in_progress" or "filled" or "cancelled"`

    The status of a custom envelope order.

    - `"placed"`

    - `"in_progress"`

    - `"filled"`

    - `"cancelled"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `quantityFilled: optional number`

    The quantity of custom envelopes that were filled for this order. Only
    returned once the order's status is `filled`.

### Example

```http
curl https://api.postgrid.com/print-mail/v1/custom_envelopes/$ID/orders/$ORDER_ID/fills \
    -X POST \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY"
```

#### Response

```json
{
  "id": "custom_envelope_order_6qZ2LHGvyYh4h6Ud1uUctT",
  "object": "custom_envelope_order",
  "live": false,
  "customEnvelope": "custom_envelope_iPu6EaCbSUjZN7bEW8Qhee",
  "quantityOrdered": 5000,
  "status": "filled",
  "createdAt": "2021-12-16T03:23:22.617Z",
  "updatedAt": "2021-12-16T03:23:22.617Z",
  "quantityFilled": 5000
}
```

## Cancel Custom Envelope Order

**delete** `/print-mail/v1/custom_envelopes/{id}/orders/{orderID}`

Cancels the custom envelope order by `orderID` for the custom envelope
by `id`. Only orders whose status is `placed` can be cancelled. Note that
this operation cannot be undone.

### Path Parameters

- `id: string`

- `orderID: string`

### Query Parameters

- `expand: optional array of "customEnvelope"`

  Pass `expand[]=customEnvelope` to expand the order's
  `customEnvelope` field into the full custom envelope object.

  - `"customEnvelope"`

### Returns

- `CustomEnvelopeOrder object { id, createdAt, customEnvelope, 8 more }`

  - `id: string`

    A unique ID prefixed with custom_envelope_order_

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `customEnvelope: string or CustomEnvelope`

    The ID of the custom envelope that this order replenishes. Expanded into
    the full custom envelope object on the individual order retrieval, fill
    and cancellation endpoints when `expand[]=customEnvelope` is supplied.

    - `string`

    - `CustomEnvelope object { id, available, createdAt, 10 more }`

      - `id: string`

        A unique ID prefixed with custom_envelope_

      - `available: number`

        The quantity of custom envelopes available to use in your orders
        immediately. This increases when a custom envelope order is filled and
        decreases as you send orders which include this custom envelope.

      - `createdAt: string`

        The UTC time at which this resource was created.

      - `live: boolean`

        `true` if this is a live mode resource else `false`.

      - `object: "custom_envelope"`

        Always `custom_envelope`.

        - `"custom_envelope"`

      - `status: "pending" or "approved" or "rejected"`

        The review status of a custom envelope's artwork.

        - `"pending"`

        - `"approved"`

        - `"rejected"`

      - `updatedAt: string`

        The UTC time at which this resource was last updated.

      - `description: optional string`

        An optional string describing this resource. Will be visible in the API and the dashboard.

      - `envelopeType: optional "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

        The type of a custom envelope. This determines the envelope's size and the
        windows that your artwork must leave clear.

        - `"standard_double_window"`

        - `"standard_single_window"`

        - `"standard_large_window"`

        - `"6x9_large_window"`

        - `"9x12_single_window"`

      - `lowInventoryThreshold: optional CustomEnvelopeLowInventoryThreshold`

        A low-inventory threshold. When the available quantity of a custom envelope
        drops to or below the threshold, we send a low-inventory alert email to the
        Admins of your organization.

        An alert can only be sent once at least one order for the custom envelope
        has been filled. Once an alert is sent, we don't send another until a new
        order is filled or you change the threshold.

        - `type: "fixed" or "percentage"`

          How the value of a low-inventory threshold is interpreted.

          - `"fixed"`

          - `"percentage"`

        - `value: number`

          A whole number. For `fixed` this is an available quantity and must be 1
          or greater. For `percentage` this is a percentage of the quantity of the
          last filled order and must be between 1 and 100.

      - `metadata: optional map[unknown]`

        See the section on Metadata.

      - `rejectionReason: optional "content_overlapping_restricted_region" or "incomplete_image" or "internal_error"`

        Why the artwork of a custom envelope was rejected.

        - `"content_overlapping_restricted_region"`

        - `"incomplete_image"`

        - `"internal_error"`

      - `url: optional string`

        A signed URL to the PDF of the custom envelope's artwork.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "custom_envelope_order"`

    Always `custom_envelope_order`.

    - `"custom_envelope_order"`

  - `quantityOrdered: number`

    The quantity of custom envelopes ordered. Minimum 5000.

  - `status: "placed" or "in_progress" or "filled" or "cancelled"`

    The status of a custom envelope order.

    - `"placed"`

    - `"in_progress"`

    - `"filled"`

    - `"cancelled"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `quantityFilled: optional number`

    The quantity of custom envelopes that were filled for this order. Only
    returned once the order's status is `filled`.

### Example

```http
curl https://api.postgrid.com/print-mail/v1/custom_envelopes/$ID/orders/$ORDER_ID \
    -X DELETE \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY"
```

#### Response

```json
{
  "id": "custom_envelope_order_6qZ2LHGvyYh4h6Ud1uUctT",
  "object": "custom_envelope_order",
  "live": false,
  "customEnvelope": "custom_envelope_iPu6EaCbSUjZN7bEW8Qhee",
  "quantityOrdered": 5000,
  "status": "cancelled",
  "createdAt": "2021-12-16T03:23:22.617Z",
  "updatedAt": "2021-12-16T03:23:22.617Z"
}
```

## Domain Types

### Custom Envelope Order

- `CustomEnvelopeOrder object { id, createdAt, customEnvelope, 8 more }`

  - `id: string`

    A unique ID prefixed with custom_envelope_order_

  - `createdAt: string`

    The UTC time at which this resource was created.

  - `customEnvelope: string or CustomEnvelope`

    The ID of the custom envelope that this order replenishes. Expanded into
    the full custom envelope object on the individual order retrieval, fill
    and cancellation endpoints when `expand[]=customEnvelope` is supplied.

    - `string`

    - `CustomEnvelope object { id, available, createdAt, 10 more }`

      - `id: string`

        A unique ID prefixed with custom_envelope_

      - `available: number`

        The quantity of custom envelopes available to use in your orders
        immediately. This increases when a custom envelope order is filled and
        decreases as you send orders which include this custom envelope.

      - `createdAt: string`

        The UTC time at which this resource was created.

      - `live: boolean`

        `true` if this is a live mode resource else `false`.

      - `object: "custom_envelope"`

        Always `custom_envelope`.

        - `"custom_envelope"`

      - `status: "pending" or "approved" or "rejected"`

        The review status of a custom envelope's artwork.

        - `"pending"`

        - `"approved"`

        - `"rejected"`

      - `updatedAt: string`

        The UTC time at which this resource was last updated.

      - `description: optional string`

        An optional string describing this resource. Will be visible in the API and the dashboard.

      - `envelopeType: optional "standard_double_window" or "standard_single_window" or "standard_large_window" or 2 more`

        The type of a custom envelope. This determines the envelope's size and the
        windows that your artwork must leave clear.

        - `"standard_double_window"`

        - `"standard_single_window"`

        - `"standard_large_window"`

        - `"6x9_large_window"`

        - `"9x12_single_window"`

      - `lowInventoryThreshold: optional CustomEnvelopeLowInventoryThreshold`

        A low-inventory threshold. When the available quantity of a custom envelope
        drops to or below the threshold, we send a low-inventory alert email to the
        Admins of your organization.

        An alert can only be sent once at least one order for the custom envelope
        has been filled. Once an alert is sent, we don't send another until a new
        order is filled or you change the threshold.

        - `type: "fixed" or "percentage"`

          How the value of a low-inventory threshold is interpreted.

          - `"fixed"`

          - `"percentage"`

        - `value: number`

          A whole number. For `fixed` this is an available quantity and must be 1
          or greater. For `percentage` this is a percentage of the quantity of the
          last filled order and must be between 1 and 100.

      - `metadata: optional map[unknown]`

        See the section on Metadata.

      - `rejectionReason: optional "content_overlapping_restricted_region" or "incomplete_image" or "internal_error"`

        Why the artwork of a custom envelope was rejected.

        - `"content_overlapping_restricted_region"`

        - `"incomplete_image"`

        - `"internal_error"`

      - `url: optional string`

        A signed URL to the PDF of the custom envelope's artwork.

  - `live: boolean`

    `true` if this is a live mode resource else `false`.

  - `object: "custom_envelope_order"`

    Always `custom_envelope_order`.

    - `"custom_envelope_order"`

  - `quantityOrdered: number`

    The quantity of custom envelopes ordered. Minimum 5000.

  - `status: "placed" or "in_progress" or "filled" or "cancelled"`

    The status of a custom envelope order.

    - `"placed"`

    - `"in_progress"`

    - `"filled"`

    - `"cancelled"`

  - `updatedAt: string`

    The UTC time at which this resource was last updated.

  - `description: optional string`

    An optional string describing this resource. Will be visible in the API and the dashboard.

  - `metadata: optional map[unknown]`

    See the section on Metadata.

  - `quantityFilled: optional number`

    The quantity of custom envelopes that were filled for this order. Only
    returned once the order's status is `filled`.
