> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developer-stage.shipbob.dev/experimental/api/returns/llms.txt.
> For full documentation content, see https://developer-stage.shipbob.dev/experimental/api/returns/llms-full.txt.

# Create Return Order


POST https://sandbox-api.shipbob.com/Experimental/return
Content-Type: application/json

Creates a return order. If purchase_label is true, also purchases a return shipping label using the original_shipment_id.


Reference: https://developer-stage.shipbob.dev/api/returns/create-return-order

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: api-experimental
  version: 1.0.0
paths:
  /Experimental/return:
    post:
      operationId: create-return-order
      summary: |
        Create Return Order
      description: >
        Creates a return order. If purchase_label is true, also purchases a
        return shipping label using the original_shipment_id.
      tags:
        - subpackage_returns
      parameters:
        - name: api-version
          in: query
          description: |
            The requested API version
          required: false
          schema:
            $ref: >-
              #/components/schemas/Returns.Post.Api.Experimental.Return.Api.Version.String
        - name: Authorization
          in: header
          description: Authentication using Personal Access Token (PAT) token
          required: true
          schema:
            type: string
        - name: shipbob_channel_id
          in: header
          description: The unique identifier of the channel to scope this request to
          required: true
          schema:
            $ref: >-
              #/components/schemas/Returns.Post.Api.Experimental.Return.Shipbob.Channel.Id.Integer
        - name: creationSourceId
          in: header
          description: Source of the return creation. Defaults to 3 (API)
          required: false
          schema:
            $ref: >-
              #/components/schemas/Returns.Post.Api.Experimental.Return.CreationSourceId.Integer
      responses:
        '201':
          description: Return order created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Returns_createReturnOrder_Response_201'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Returns.ProblemDetails'
        '401':
          description: Authorization missing or invalid
          content:
            application/json:
              schema:
                description: Any type
        '403':
          description: The provided credentials are not authorized to access this resource
          content:
            application/json:
              schema:
                description: Any type
        '422':
          description: Validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Returns.ProblemDetails'
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Returns.CreateReturnRequest'
servers:
  - url: https://sandbox-api.shipbob.com
components:
  schemas:
    Returns.Post.Api.Experimental.Return.Api.Version.String:
      type: string
      default: '1.0'
      title: Returns.Post.Api.Experimental.Return.Api.Version.String
    Returns.Post.Api.Experimental.Return.Shipbob.Channel.Id.Integer:
      type: integer
      description: The unique identifier of the channel to scope this request to
      title: Returns.Post.Api.Experimental.Return.Shipbob.Channel.Id.Integer
    Returns.Post.Api.Experimental.Return.CreationSourceId.Integer:
      type: integer
      default: 3
      description: Source of the return creation. Defaults to 3 (API)
      title: Returns.Post.Api.Experimental.Return.CreationSourceId.Integer
    Returns.Facility:
      type: object
      properties:
        id:
          type: integer
          description: Unique identifier of the facility
        name:
          type: string
          description: >-
            Name of the facility (It is optional because public API integrations
            do not pass this)
      description: A Facility to process Returns.
      title: Returns.Facility
    Returns.ReturnAction:
      type: string
      enum:
        - Default
        - Restock
        - Quarantine
        - Dispose
        - Donation
      title: Returns.ReturnAction
    Returns.ReturnInventory:
      type: object
      properties:
        id:
          type: integer
          description: ID of the inventory item to return.
        lot_date:
          type: string
          format: date-time
          description: Lot date associated with the inventory item, if applicable.
        lot_number:
          type: string
          description: Lot number associated with the inventory item, if applicable.
        quantity:
          type: integer
          description: Quantity of the returned inventory item in the return.
        requested_action:
          $ref: '#/components/schemas/Returns.ReturnAction'
      description: >-
        An inventory being returned, includes the quantity and an override for
        the return action.
      title: Returns.ReturnInventory
    ReturnsCreateReturnRequestLabelFormat:
      type: string
      enum:
        - PDF
        - PNG
      description: >-
        Optional label file format. Accepted values: PDF, PNG. If not provided,
        carrier default format is used. Only used when purchase_label is true
      title: ReturnsCreateReturnRequestLabelFormat
    Returns.CreateReturnRequest:
      type: object
      properties:
        fulfillment_center:
          $ref: '#/components/schemas/Returns.Facility'
        inventory:
          type: array
          items:
            $ref: '#/components/schemas/Returns.ReturnInventory'
          description: Array of inventory items being returned
        label_format:
          $ref: '#/components/schemas/ReturnsCreateReturnRequestLabelFormat'
          description: >-
            Optional label file format. Accepted values: PDF, PNG. If not
            provided, carrier default format is used. Only used when
            purchase_label is true
        original_shipment_id:
          type: integer
          description: >-
            Shipment from which the items in the return originated. Required
            when purchase_label is true
        purchase_label:
          type: boolean
          description: >-
            If true, purchases a return shipping label after creating the return
            order. Requires original_shipment_id
        reference_id:
          type: string
          description: >-
            Client-defined external unique identifier for the return order. If
            tracking id is not provided, this value must appear on the box label
            as RMA
        shipping_service:
          type: string
          description: >-
            Ship option name (e.g. "UPS Ground") for label purchase. Only used
            when purchase_label is true. Falls back to cheapest if not matched
        tracking_number:
          type: string
          description: Tracking number for the return shipment
      description: The request payload for creating a Return of inventory.
      title: Returns.CreateReturnRequest
    Returns_createReturnOrder_Response_201:
      type: object
      properties: {}
      description: Empty response body
      title: Returns_createReturnOrder_Response_201
    Returns.ProblemDetails:
      type: object
      properties:
        detail:
          type: string
        instance:
          type: string
        status:
          type: integer
        title:
          type: string
        type:
          type: string
      title: Returns.ProblemDetails
  securitySchemes:
    PAT:
      type: http
      scheme: bearer
      description: Authentication using Personal Access Token (PAT) token
    OAuth2:
      type: http
      scheme: bearer
      description: OAuth2 authentication using JWT tokens

```

## SDK Code Examples

```python
import requests

url = "https://sandbox-api.shipbob.com/Experimental/return"

querystring = {"api-version":"1"}

payload = {
    "fulfillment_center": {
        "id": 10,
        "name": "Cicero (CHI3)"
    },
    "inventory": [
        {
            "id": 1279396,
            "quantity": 2,
            "requested_action": "Restock"
        }
    ],
    "original_shipment_id": 98765,
    "purchase_label": True,
    "reference_id": "RMA-2026-00123",
    "shipping_service": "UPS Ground",
    "tracking_number": "1Z999AA10123456784"
}
headers = {
    "shipbob_channel_id": "1",
    "creationSourceId": "3",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://sandbox-api.shipbob.com/Experimental/return?api-version=1';
const options = {
  method: 'POST',
  headers: {
    shipbob_channel_id: '1',
    creationSourceId: '3',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"fulfillment_center":{"id":10,"name":"Cicero (CHI3)"},"inventory":[{"id":1279396,"quantity":2,"requested_action":"Restock"}],"original_shipment_id":98765,"purchase_label":true,"reference_id":"RMA-2026-00123","shipping_service":"UPS Ground","tracking_number":"1Z999AA10123456784"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sandbox-api.shipbob.com/Experimental/return?api-version=1"

	payload := strings.NewReader("{\n  \"fulfillment_center\": {\n    \"id\": 10,\n    \"name\": \"Cicero (CHI3)\"\n  },\n  \"inventory\": [\n    {\n      \"id\": 1279396,\n      \"quantity\": 2,\n      \"requested_action\": \"Restock\"\n    }\n  ],\n  \"original_shipment_id\": 98765,\n  \"purchase_label\": true,\n  \"reference_id\": \"RMA-2026-00123\",\n  \"shipping_service\": \"UPS Ground\",\n  \"tracking_number\": \"1Z999AA10123456784\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("shipbob_channel_id", "1")
	req.Header.Add("creationSourceId", "3")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://sandbox-api.shipbob.com/Experimental/return?api-version=1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["shipbob_channel_id"] = '1'
request["creationSourceId"] = '3'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"fulfillment_center\": {\n    \"id\": 10,\n    \"name\": \"Cicero (CHI3)\"\n  },\n  \"inventory\": [\n    {\n      \"id\": 1279396,\n      \"quantity\": 2,\n      \"requested_action\": \"Restock\"\n    }\n  ],\n  \"original_shipment_id\": 98765,\n  \"purchase_label\": true,\n  \"reference_id\": \"RMA-2026-00123\",\n  \"shipping_service\": \"UPS Ground\",\n  \"tracking_number\": \"1Z999AA10123456784\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sandbox-api.shipbob.com/Experimental/return?api-version=1")
  .header("shipbob_channel_id", "1")
  .header("creationSourceId", "3")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"fulfillment_center\": {\n    \"id\": 10,\n    \"name\": \"Cicero (CHI3)\"\n  },\n  \"inventory\": [\n    {\n      \"id\": 1279396,\n      \"quantity\": 2,\n      \"requested_action\": \"Restock\"\n    }\n  ],\n  \"original_shipment_id\": 98765,\n  \"purchase_label\": true,\n  \"reference_id\": \"RMA-2026-00123\",\n  \"shipping_service\": \"UPS Ground\",\n  \"tracking_number\": \"1Z999AA10123456784\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox-api.shipbob.com/Experimental/return?api-version=1', [
  'body' => '{
  "fulfillment_center": {
    "id": 10,
    "name": "Cicero (CHI3)"
  },
  "inventory": [
    {
      "id": 1279396,
      "quantity": 2,
      "requested_action": "Restock"
    }
  ],
  "original_shipment_id": 98765,
  "purchase_label": true,
  "reference_id": "RMA-2026-00123",
  "shipping_service": "UPS Ground",
  "tracking_number": "1Z999AA10123456784"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'creationSourceId' => '3',
    'shipbob_channel_id' => '1',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://sandbox-api.shipbob.com/Experimental/return?api-version=1");
var request = new RestRequest(Method.POST);
request.AddHeader("shipbob_channel_id", "1");
request.AddHeader("creationSourceId", "3");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"fulfillment_center\": {\n    \"id\": 10,\n    \"name\": \"Cicero (CHI3)\"\n  },\n  \"inventory\": [\n    {\n      \"id\": 1279396,\n      \"quantity\": 2,\n      \"requested_action\": \"Restock\"\n    }\n  ],\n  \"original_shipment_id\": 98765,\n  \"purchase_label\": true,\n  \"reference_id\": \"RMA-2026-00123\",\n  \"shipping_service\": \"UPS Ground\",\n  \"tracking_number\": \"1Z999AA10123456784\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "shipbob_channel_id": "1",
  "creationSourceId": "3",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "fulfillment_center": [
    "id": 10,
    "name": "Cicero (CHI3)"
  ],
  "inventory": [
    [
      "id": 1279396,
      "quantity": 2,
      "requested_action": "Restock"
    ]
  ],
  "original_shipment_id": 98765,
  "purchase_label": true,
  "reference_id": "RMA-2026-00123",
  "shipping_service": "UPS Ground",
  "tracking_number": "1Z999AA10123456784"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox-api.shipbob.com/Experimental/return?api-version=1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```