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

# Ship by Loop Services API

## 📝 Overview

The **Ship by Loop Services API** enables external shipping providers (such as 3PLs, WMS partners, or cross-border shipping partners) to offer carrier and return method options directly to shoppers during the return flow. This integration promotes your label service from a passive label provider to a first-class, shopper-selectable shipping option.

> [!NOTE]
>
> **When to use which API?** The Ship by Loop Services API and the existing
> [Third Party Labels](https://docs.loopreturns.com/integration-guides/labels-integration.md) API serve
> different use cases. See [Choosing the right
> integration](#-choosing-the-right-integration) below to determine which one
> fits your needs.

### Key capabilities

* **Shopper carrier choice** — Let shoppers select from available carriers/return methods you provide, rather than receiving a carrier unilaterally assigned after the return is submitted.
* **Multilabel support** — Support multiple packages per return, each with their own label.
* **Full lifecycle control** — Respond to service requests, record orders and labels, and handle cancellations via webhooks.

### How it works

The integration follows a webhook-driven request/response model:

```mermaid theme={null}
sequenceDiagram
    participant Shopper
    participant Loop Portal
    participant Loop
    participant Partner as Your Integration

    Shopper->>Loop Portal: Starts return, needs carrier options
    Loop->>Partner: ship-by-loop.services.requested
    Partner->>Loop: POST /services (carrier options)
    Loop Portal->>Shopper: Shows carrier choices
    Shopper->>Loop Portal: Selects carrier, submits return
    Loop->>Partner: ship-by-loop.purchase.requested
    Partner->>Loop: POST /orders (label & tracking)
    Loop Portal->>Shopper: Shows label/QR code
    Note over Loop,Partner: If return is cancelled:
    Loop-->>Partner: ship-by-loop.cancellation.requested
    Partner-->>Partner: Void/refund label
```

***

## 🔄 Choosing the right integration

Loop offers two APIs for external label providers. Choose the one that matches your merchants' needs:

| Feature | Ship by Loop Services API | [Third Party Labels](https://docs.loopreturns.com/integration-guides/labels-integration.md) |
| :- | :- | :- |
| **Shopper carrier choice** | ✅ Shoppers choose from available carriers | ❌ Carrier assigned after return is submitted |
| **When carrier is selected** | Before return is submitted | After return is submitted |
| **Multilabel support** | ✅ Yes | ❌ One label per return |
| **Discovery method** | Webhooks only (no polling) | Webhooks (preferred) or polling |
| **Partner downtime impact** | Shoppers cannot submit returns | Loop can remediate after the fact |
| **Tracking** | Loop handles via carrier + tracking number | Loop auto-tracks supported carriers; partner pushes status for others |

**Use the Ship by Loop Services API when:**

* Your merchants need to offer shoppers a choice of carriers or return methods
* You need multilabel capabilities
* Your platform can reliably respond to webhooks in real time

**Use the Third Party Labels API when:**

* A single label per return is sufficient
* You prefer the flexibility of polling in addition to webhooks
* You need the ability to remediate label issues after return submission

Both APIs can coexist across different merchants — they are not mutually exclusive at the platform level.

***

## ⚙️ Prerequisites

Before integrating with the Ship by Loop Services API, complete the following setup:

### Accept the Label Provider Terms

Start by filling out [this form](https://form.pandadoc.com/form/YPLws6ZVxfn8f6YdV8HWKe), which sends a signable version of Loop's terms to your preferred signatory. Contact Kent Woodyard ([kent@loopreturns.com](mailto:kent@loopreturns.com)) with any questions about the terms.

### Register your integration and obtain OAuth credentials

The Ship by Loop Services API **requires OAuth 2.0** authentication. The `ship_by_loop:write` scope is restricted and cannot be granted to API keys — you must use OAuth 2.0 tokens.

Follow the steps in the [Authorize with OAuth](https://docs.loopreturns.com/api-reference/authentication.md#oauth-2-0-authentication) guide to register your integration.

When requesting OAuth credentials, include the following scopes:

| Scope | Description |
| :- | :- |
| `ship_by_loop:write` | Required. Submit services, orders, and errors for Ship by Loop shipments. |
| `returns` | Recommended. Access additional return data if needed. |
| `offline_access` | Required for refresh tokens. |

### Set up webhooks

After your integration completes the OAuth flow, subscribe to the Ship by Loop shipment webhooks. **Webhooks are the only way to receive notifications** — there is no polling API for this surface.

See the [Ship by Loop shipment webhook reference](https://docs.loopreturns.com/webhook-reference/topics/ship-by-loop-shipment-webhook.md) for the full webhook payload schema and trigger details. Work with your Loop representative to configure webhook subscriptions for the Ship by Loop triggers your integration needs.

| Trigger | When it fires | Your action |
| :- | :- | :- |
| `ship-by-loop.services.requested` | Shopper started a return, needs carrier options | Call [Add available services](https://docs.loopreturns.com/api-reference/latest/ship-by-loop/add-available-services-to-a-shipment.md) |
| `ship-by-loop.purchase.requested` | Shopper selected a carrier and submitted the return | Call [Record orders](https://docs.loopreturns.com/api-reference/latest/ship-by-loop/record-orders-on-a-shipment.md) |
| `ship-by-loop.cancellation.requested` | Return or label cancelled | Void/refund any purchased label |

> [!WARNING]
>
> **All shipment webhooks are sent to your endpoint** — not only those for
> return policies configured for external labels. Your integration must filter
> events appropriately based on your business logic.

***

## 🔁 Integration lifecycle

### Step 1: Receive service requests

When a shopper initiates a return through a policy using Ship by Loop with external labels, Loop sends a `ship-by-loop.services.requested` webhook to your endpoint.

The webhook payload includes full shipment details:

* **Origin address** — the shopper's address
* **Destination address** — the returns warehouse
* **Outbound order details** — original order number, carrier, tracking, total value
* **Packages** — each package with dimensions, weight, and item details

See the [Ship by Loop shipment webhook reference](https://docs.loopreturns.com/webhook-reference/topics/ship-by-loop-shipment-webhook.md) for the complete payload schema.

### Step 2: Submit available services

Respond to `ship-by-loop.services.requested` by calling [Add available services to a shipment](https://docs.loopreturns.com/api-reference/latest/ship-by-loop/add-available-services-to-a-shipment.md) with the carrier options you can offer:

```bash theme={null}
POST /api/v1/ship-by-loop/shipments/{shipmentId}/services
Authorization: Bearer {access_token}
Content-Type: application/json

{
  "services": [
    {
      "external_id": "svc_royal_mail_qr",
      "name": "Royal Mail Drop Off",
      "carrier": "royal-mail",
      "packages": ["900a8671-35ad-4743-9b6c-2540d3bb1faf"]
    },
    {
      "external_id": "svc_inpost_uk",
      "name": "InPost Locker",
      "carrier": "inpost-uk",
      "packages": ["900a8671-35ad-4743-9b6c-2540d3bb1faf"]
    }
  ]
}
```

> [!TIP]
>
> **Timing is critical.** The shopper portal waits approximately 15 seconds for
> carrier options before showing the return-method card. If your response
> doesn't arrive in that window, the shopper falls back to any standard return
> methods available — no error is shown. A late response still succeeds on the
> API side, but the portal has stopped waiting, so that shopper will not see
> your options. Respond as quickly as possible.

**Key points for submitting services:**

* Each service must include `external_id`, `name`, `carrier`, and `packages`
* The same package ID can appear under multiple services (for shopper carrier choice)
* A single service can cover multiple packages
* Services are presented to the shopper as carrier options

### Step 3: Record orders and labels

When the shopper selects a carrier, Loop sends a `ship-by-loop.purchase.requested` webhook. The `service` field on each package is now populated with the chosen service.

Respond by calling [Record orders on a shipment](https://docs.loopreturns.com/api-reference/latest/ship-by-loop/record-orders-on-a-shipment.md) with tracking and label information:

```bash theme={null}
POST /api/v1/ship-by-loop/shipments/{shipmentId}/orders
Authorization: Bearer {access_token}
Content-Type: application/json

{
  "orders": [
    {
      "package_id": "900a8671-35ad-4743-9b6c-2540d3bb1faf",
      "external_id": "ord_abc123",
      "tracking_number": "JD123456789GB",
      "tracking_url": "https://www.royalmail.com/track-your-item#/tracking/JD123456789GB",
      "label_url": "https://partner.example/labels/abc123.pdf",
      "qr_code_url": "https://partner.example/qr/abc123.png"
    }
  ]
}
```

> [!WARNING]
>
> At least one of `label_url` or `qr_code_url` is required for each order. If
> you omit both, the API returns a 422 error.

### Step 4: Handle cancellations

When a return or label is cancelled, Loop sends a `ship-by-loop.cancellation.requested` webhook. Your integration should:

1. Stop any in-progress work for this shipment
2. Void or refund any carrier label already purchased
3. Acknowledge with a `200` response

Loop does not expect any API call in response — just the webhook acknowledgement.

***

## 📍 Carrier names and portal display

If the carrier name you provide doesn't map to a known Ship by Loop carrier, the portal displays a default icon and generic treatment. To get the correct carrier icon, location finder link, and priority placement:

* **Map to Loop's carrier identifiers** — For example, InPost in the UK must be sent as carrier name `inpost-uk` (not `InPost` or `inpost`) to receive the proper icon, location link, and top-of-list pinning.
* **Consistent naming** — Use lowercase with hyphens for regional variants (e.g., `royal-mail`, `dpd-uk`, `evri`).

> [!TIP]
>
> Contact [partnersupport@loopreturns.com](mailto:partnersupport@loopreturns.com) if you need the full list of supported
> carrier identifiers for proper portal rendering.

***

## ⚠️ Error handling

### Reporting errors to Loop

If you encounter an error generating a label or providing services, report it using [Report errors on a shipment](https://docs.loopreturns.com/api-reference/latest/ship-by-loop/report-errors-on-a-shipment.md):

```bash theme={null}
POST /api/v1/ship-by-loop/shipments/{shipmentId}/errors
Authorization: Bearer {access_token}
Content-Type: application/json

{
  "errors": [
    {
      "message": "Carrier rejected the destination address",
      "package_id": "900a8671-35ad-4743-9b6c-2540d3bb1faf"
    }
  ]
}
```

> [!WARNING]
>
> **Reporting an error is purely informational.** It records the error for
> visibility but does not change the shipment's state, retry anything, or notify
> the shopper. You can still call `/services` or `/orders` afterward. Errors are
> not deduplicated — retrying the same call records duplicate entries.

### What the shopper sees

The shopper portal does not display terminal error states. If a label cannot be generated, the portal continues to show "your label is coming" messaging. This is a known limitation of the Ship by Loop surface.

***

## 🚨 Important limitations

### QR codes and printed labels

A carrier that offers both QR codes and printed labels must return both under the same service. If your platform treats these as separate services, you must choose one format (QR or printed label) when configuring the service — you cannot offer both as separate shopper choices.

### Partner downtime

Unlike the Third Party Labels API (where Loop can remediate after a return is submitted), **partner downtime on this API prevents shoppers from submitting returns**. Carrier selection happens before the return is submitted, so if your service is unavailable when Loop requests services, the shopper cannot complete their return through policies using your integration.

Ensure high availability of your webhook endpoint and services response.

### No polling — webhooks only

This API has no polling endpoint. Your integration must be capable of receiving and processing webhooks reliably. There is no way to ask Loop "what's pending for me?"

### Shop-level configuration

Currently, you cannot use both Ship by Loop's first-party carriers and external partner labels within the same shop. When using this integration, the merchant should not enable any first-party Ship by Loop carriers in Loop Admin — your external partner provides all carrier options instead.

### Tracking

Shipment tracking is handled by Loop using the `carrier` and `tracking_number` you provide when calling `/orders`. You do not push tracking events yourself.

This differs from the Third Party Labels API, where Loop auto-tracks supported carriers but partners must push status updates for carriers Loop doesn't track automatically.

If the merchant's return policy is configured to process returns on tracking events, verify that Loop supports tracking for your carriers before going live.

***

## 🛠️ Merchant setup

Merchants using your integration need to complete the following setup in Loop Admin:

1. **Authorize your integration** — Install and authorize your app via OAuth. This API requires the `ship_by_loop:write` scope, which is only available via OAuth 2.0 (not API keys).

2. **Configure Ship by Loop** — Navigate to the [Ship by Loop settings](https://admin.loopreturns.com/settings/shipping/service/ship-by-loop). The wallet does not need to be funded. **Do not enable any first-party Ship by Loop carriers** — your external partner provides the carrier options instead.

3. **Create a return policy** — Create or edit a return policy and select Ship by Loop as the label provider. Do not add a payment method to the policy.

4. **Enable shopper carrier choice** — If you're providing multiple carrier options, enable the "Allow shopper to choose carrier" setting on the return policy.

5. **Test the integration** — Submit a test return through the configured policy to verify carrier options appear and labels are generated correctly.

***

## 🧪 Testing your integration

Before going live, verify the complete flow:

1. **Webhook delivery** — Confirm your endpoint receives `ship-by-loop.services.requested` when a return is initiated.

2. **Service response timing** — Ensure your `/services` response arrives within the \~15 second wait window.

3. **Carrier display** — Verify carrier names render with correct icons and location links in the portal.

4. **Label generation** — Confirm labels/QR codes display correctly to the shopper after you call `/orders`.

5. **Tracking** — If the policy processes on tracking events, verify Loop can track your carriers using the `carrier` and `tracking_number` you provide.

6. **Cancellation handling** — Test that your integration properly voids labels when receiving cancellation webhooks.

> [!WARNING]
>
> Always use test or sandbox credentials when available to avoid affecting live
> return data or triggering real customer notifications.

***

## 📚 API and webhook reference

| Resource | Description |
| :- | :- |
| [Add available services to a shipment](https://docs.loopreturns.com/api-reference/latest/ship-by-loop/add-available-services-to-a-shipment.md) | Submit carrier options in response to `services.requested` |
| [Record orders on a shipment](https://docs.loopreturns.com/api-reference/latest/ship-by-loop/record-orders-on-a-shipment.md) | Submit label and tracking details after `purchase.requested` |
| [Report errors on a shipment](https://docs.loopreturns.com/api-reference/latest/ship-by-loop/report-errors-on-a-shipment.md) | Report problems your integration couldn't resolve |
| [Ship by Loop shipment webhook](https://docs.loopreturns.com/webhook-reference/topics/ship-by-loop-shipment-webhook.md) | Full webhook payload documentation |
| [Authentication](https://docs.loopreturns.com/api-reference/authentication.md#oauth-2-0-authentication) | OAuth 2.0 setup and scopes |

***

## ✅ Conclusion

The Ship by Loop Services API enables you to provide a first-class, shopper-facing carrier choice experience for merchants using your label services. By responding to webhooks with available services and recording orders when purchases are made, your integration participates directly in the return flow.

For questions about specific configurations or to begin the partner onboarding process, contact your Loop representative or reach out to [support@loopreturns.com](mailto:support@loopreturns.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.