Skip to content

rmaOrderCreate ​

Creates a new RMA order. By default the order is created in NEW processing status. Pass accept: true to automatically accept the return on creation, skipping the submit and accept steps.

Required scope: create_rma_orders


Mutation ​

graphql
mutation RmaOrderCreate($input: RmaOrderInput!) {
  rmaOrderCreate(input: $input) {
    id
    returnNumber
    returnReference
    processingStatus
    deliveryStatus
    financialStatus
    fulfillmentStatus
    expectedResolution
    returnSlipUrl
    lines {
      label
      sku
      reference
      quantity
      reason
      productState
    }
    sender {
      fullname
      email
    }
    deliveryContact {
      fullname
      email
    }
  }
}

Input: RmaOrderInput ​

FieldTypeRequiredDescription
idID❌Optional UUID — if omitted, one is auto-generated
locationIdString❌Fulfillment location UUID where returns will be received
expectedResolutionRmaOrderExpectedResolution✅Expected resolution: NONE, VOUCHER, REPLACE, or REFUND
lines[RmaOrderLineInput!]✅Return lines — at least one required
senderRmaOrderContactInput✅Sender (customer) contact details
deliveryContactRmaOrderContactInput✅Delivery (warehouse) contact details
externalIdString❌External system ID for cross-referencing
externalReferenceString❌External reference string
commentString❌Free-text comment about the return
metaJSON❌Additional metadata as JSON
autoGenerateFinancialResolutionBoolean❌Auto-generate financial resolution on completion (default: false)
autoExecuteFinancialResolutionBoolean❌Auto-execute financial resolution without review (default: false)
retainedAmountForShippingFloat❌Amount to retain for return shipping costs (default: 0.0)
acceptBoolean❌Auto-accept the return on creation (default: false)
linkedOrders[RmaOrderLinkedOrderInput]❌Original orders linked to this return

RmaOrderLineInput ​

FieldTypeRequiredDescription
labelString✅Human-readable product name
productStateRmaOrderProductState✅Product condition: BRAND_NEW_WITH_LABEL, BRAND_NEW_WITHOUT_LABEL, WORE, DAMAGED, or DEFECTIVE
productVariantIdString❌Product variant UUID from the catalog
stockReferenceIdString❌Stock reference UUID
referenceString✅Product reference identifier
skuString✅Stock-Keeping Unit identifier
orderLineNumberString❌Line number from the original order
quantityInt✅Quantity being returned (must be > 0)
reasonRmaOrderReturnReason✅Return reason: WRONG_ITEM, NOT_RECEIVED, SIZE_PROBLEM, COLOR_PROBLEM, DEFECTIVE, DAMAGED_PRODUCT, UNSATISFIED, or ITEMS_NOT_SOLD
orderLineIdString❌Original order line UUID
orderIdString❌Original order UUID
metaJSON❌Additional line metadata

RmaOrderContactInput ​

FieldTypeRequiredDescription
fullnameString✅Full name of the contact
emailString✅Email address
addressString✅Street address line 1
addressComplementString❌Street address line 2 (apartment, suite, etc.)
zipcodeString✅Postal / ZIP code
cityString✅City
countryString✅ISO 3166-1 alpha-2 country code (e.g. FR, US)
stateString❌State or province
phoneString❌Phone number
mobileString❌Mobile phone number
commentsString❌Additional comments
metadataJSON❌Additional contact metadata
taxIdString❌Tax identification number
formString❌Legal form (e.g. SARL, SAS)
capitalString❌Share capital
companyIdString❌Company identifier (e.g. SIRET)
registrationString❌Registration number (e.g. RCS)

RmaOrderLinkedOrderInput ​

FieldTypeRequiredDescription
orderIdString✅UUID of the original order

Example Variables ​

json
{
  "input": {
    "locationId": "loc-uuid-001",
    "expectedResolution": "REFUND",
    "externalId": "RET-2024-001",
    "externalReference": "EXT-RET-001",
    "comment": "Customer reports wrong size received",
    "autoGenerateFinancialResolution": true,
    "autoExecuteFinancialResolution": false,
    "retainedAmountForShipping": 4.99,
    "accept": false,
    "lines": [
      {
        "label": "Classic T-Shirt - Small Blue",
        "productState": "BRAND_NEW_WITH_LABEL",
        "reference": "REF-TSHIRT-001",
        "sku": "TSHIRT-S-BLUE",
        "quantity": 1,
        "reason": "SIZE_PROBLEM",
        "orderId": "order-uuid-001",
        "orderLineId": "order-line-uuid-001"
      }
    ],
    "sender": {
      "fullname": "John Doe",
      "email": "john.doe@example.com",
      "address": "123 Main Street",
      "addressComplement": "Apt 4B",
      "zipcode": "75001",
      "city": "Paris",
      "country": "FR",
      "phone": "+33612345678"
    },
    "deliveryContact": {
      "fullname": "Warehouse Central",
      "email": "warehouse@example.com",
      "address": "456 Warehouse Ave",
      "zipcode": "69001",
      "city": "Lyon",
      "country": "FR",
      "phone": "+33698765432"
    },
    "linkedOrders": [
      {
        "orderId": "order-uuid-001"
      }
    ]
  }
}

Example Response ​

json
{
  "data": {
    "rmaOrderCreate": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "returnNumber": 1001,
      "returnReference": "RMA-2024-1001",
      "processingStatus": "NEW",
      "deliveryStatus": "PENDING",
      "financialStatus": "NONE",
      "fulfillmentStatus": "PENDING",
      "expectedResolution": "REFUND",
      "returnSlipUrl": null,
      "lines": [
        {
          "label": "Classic T-Shirt - Small Blue",
          "sku": "TSHIRT-S-BLUE",
          "reference": "REF-TSHIRT-001",
          "quantity": 1,
          "reason": "SIZE_PROBLEM",
          "productState": "BRAND_NEW_WITH_LABEL"
        }
      ],
      "sender": {
        "fullname": "John Doe",
        "email": "john.doe@example.com"
      },
      "deliveryContact": {
        "fullname": "Warehouse Central",
        "email": "warehouse@example.com"
      }
    }
  }
}

Code Examples ​

bash
curl -X POST https://api-v3.happycolis.com/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "query": "mutation RmaOrderCreate($input: RmaOrderInput!) { rmaOrderCreate(input: $input) { id returnNumber returnReference processingStatus expectedResolution lines { label sku quantity reason } } }",
    "variables": {
      "input": {
        "locationId": "loc-uuid-001",
        "expectedResolution": "REFUND",
        "externalId": "RET-2024-001",
        "comment": "Customer reports wrong size received",
        "autoGenerateFinancialResolution": true,
        "retainedAmountForShipping": 4.99,
        "lines": [
          {
            "label": "Classic T-Shirt - Small Blue",
            "productState": "BRAND_NEW_WITH_LABEL",
            "reference": "REF-TSHIRT-001",
            "sku": "TSHIRT-S-BLUE",
            "quantity": 1,
            "reason": "SIZE_PROBLEM",
            "orderId": "order-uuid-001"
          }
        ],
        "sender": {
          "fullname": "John Doe",
          "email": "john.doe@example.com",
          "address": "123 Main Street",
          "zipcode": "75001",
          "city": "Paris",
          "country": "FR",
          "phone": "+33612345678"
        },
        "deliveryContact": {
          "fullname": "Warehouse Central",
          "email": "warehouse@example.com",
          "address": "456 Warehouse Ave",
          "zipcode": "69001",
          "city": "Lyon",
          "country": "FR"
        },
        "linkedOrders": [
          { "orderId": "order-uuid-001" }
        ]
      }
    }
  }'
js
const mutation = `
  mutation RmaOrderCreate($input: RmaOrderInput!) {
    rmaOrderCreate(input: $input) {
      id
      returnNumber
      returnReference
      processingStatus
      expectedResolution
      lines {
        label
        sku
        quantity
        reason
      }
    }
  }
`;

const variables = {
  input: {
    locationId: 'loc-uuid-001',
    expectedResolution: 'REFUND',
    externalId: 'RET-2024-001',
    comment: 'Customer reports wrong size received',
    autoGenerateFinancialResolution: true,
    retainedAmountForShipping: 4.99,
    lines: [
      {
        label: 'Classic T-Shirt - Small Blue',
        productState: 'BRAND_NEW_WITH_LABEL',
        reference: 'REF-TSHIRT-001',
        sku: 'TSHIRT-S-BLUE',
        quantity: 1,
        reason: 'SIZE_PROBLEM',
        orderId: 'order-uuid-001',
      },
    ],
    sender: {
      fullname: 'John Doe',
      email: 'john.doe@example.com',
      address: '123 Main Street',
      zipcode: '75001',
      city: 'Paris',
      country: 'FR',
      phone: '+33612345678',
    },
    deliveryContact: {
      fullname: 'Warehouse Central',
      email: 'warehouse@example.com',
      address: '456 Warehouse Ave',
      zipcode: '69001',
      city: 'Lyon',
      country: 'FR',
    },
    linkedOrders: [
      { orderId: 'order-uuid-001' },
    ],
  },
};

const response = await fetch('https://api-v3.happycolis.com/graphql', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${process.env.ACCESS_TOKEN}`,
  },
  body: JSON.stringify({ query: mutation, variables }),
});

const { data } = await response.json();
console.log(data.rmaOrderCreate);
python
import os
import requests

mutation = """
mutation RmaOrderCreate($input: RmaOrderInput!) {
  rmaOrderCreate(input: $input) {
    id
    returnNumber
    returnReference
    processingStatus
    expectedResolution
    lines {
      label
      sku
      quantity
      reason
    }
  }
}
"""

variables = {
    "input": {
        "locationId": "loc-uuid-001",
        "expectedResolution": "REFUND",
        "externalId": "RET-2024-001",
        "comment": "Customer reports wrong size received",
        "autoGenerateFinancialResolution": True,
        "retainedAmountForShipping": 4.99,
        "lines": [
            {
                "label": "Classic T-Shirt - Small Blue",
                "productState": "BRAND_NEW_WITH_LABEL",
                "reference": "REF-TSHIRT-001",
                "sku": "TSHIRT-S-BLUE",
                "quantity": 1,
                "reason": "SIZE_PROBLEM",
                "orderId": "order-uuid-001",
            }
        ],
        "sender": {
            "fullname": "John Doe",
            "email": "john.doe@example.com",
            "address": "123 Main Street",
            "zipcode": "75001",
            "city": "Paris",
            "country": "FR",
            "phone": "+33612345678",
        },
        "deliveryContact": {
            "fullname": "Warehouse Central",
            "email": "warehouse@example.com",
            "address": "456 Warehouse Ave",
            "zipcode": "69001",
            "city": "Lyon",
            "country": "FR",
        },
        "linkedOrders": [
            {"orderId": "order-uuid-001"}
        ],
    }
}

response = requests.post(
    'https://api-v3.happycolis.com/graphql',
    headers={'Authorization': f'Bearer {os.environ["ACCESS_TOKEN"]}'},
    json={'query': mutation, 'variables': variables},
)

data = response.json()['data']
print(data['rmaOrderCreate'])
php
<?php
$mutation = <<<'GQL'
mutation RmaOrderCreate($input: RmaOrderInput!) {
  rmaOrderCreate(input: $input) {
    id
    returnNumber
    returnReference
    processingStatus
    expectedResolution
    lines {
      label
      sku
      quantity
      reason
    }
  }
}
GQL;

$variables = [
    'input' => [
        'locationId'                      => 'loc-uuid-001',
        'expectedResolution'              => 'REFUND',
        'externalId'                      => 'RET-2024-001',
        'comment'                         => 'Customer reports wrong size received',
        'autoGenerateFinancialResolution' => true,
        'retainedAmountForShipping'       => 4.99,
        'lines' => [
            [
                'label'        => 'Classic T-Shirt - Small Blue',
                'productState' => 'BRAND_NEW_WITH_LABEL',
                'reference'    => 'REF-TSHIRT-001',
                'sku'          => 'TSHIRT-S-BLUE',
                'quantity'     => 1,
                'reason'       => 'SIZE_PROBLEM',
                'orderId'      => 'order-uuid-001',
            ],
        ],
        'sender' => [
            'fullname' => 'John Doe',
            'email'    => 'john.doe@example.com',
            'address'  => '123 Main Street',
            'zipcode'  => '75001',
            'city'     => 'Paris',
            'country'  => 'FR',
            'phone'    => '+33612345678',
        ],
        'deliveryContact' => [
            'fullname' => 'Warehouse Central',
            'email'    => 'warehouse@example.com',
            'address'  => '456 Warehouse Ave',
            'zipcode'  => '69001',
            'city'     => 'Lyon',
            'country'  => 'FR',
        ],
        'linkedOrders' => [
            ['orderId' => 'order-uuid-001'],
        ],
    ],
];

$ch = curl_init('https://api-v3.happycolis.com/graphql');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => json_encode(['query' => $mutation, 'variables' => $variables]),
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
        'Authorization: Bearer ' . getenv('ACCESS_TOKEN'),
    ],
]);

$result = json_decode(curl_exec($ch), true);
curl_close($ch);

print_r($result['data']['rmaOrderCreate']);
go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
)

func main() {
	mutation := `
		mutation RmaOrderCreate($input: RmaOrderInput!) {
			rmaOrderCreate(input: $input) {
				id
				returnNumber
				returnReference
				processingStatus
				expectedResolution
				lines {
					label
					sku
					quantity
					reason
				}
			}
		}`

	variables := map[string]any{
		"input": map[string]any{
			"locationId":                      "loc-uuid-001",
			"expectedResolution":              "REFUND",
			"externalId":                      "RET-2024-001",
			"comment":                         "Customer reports wrong size received",
			"autoGenerateFinancialResolution": true,
			"retainedAmountForShipping":       4.99,
			"lines": []map[string]any{
				{
					"label":        "Classic T-Shirt - Small Blue",
					"productState": "BRAND_NEW_WITH_LABEL",
					"reference":    "REF-TSHIRT-001",
					"sku":          "TSHIRT-S-BLUE",
					"quantity":     1,
					"reason":       "SIZE_PROBLEM",
					"orderId":      "order-uuid-001",
				},
			},
			"sender": map[string]any{
				"fullname": "John Doe",
				"email":    "john.doe@example.com",
				"address":  "123 Main Street",
				"zipcode":  "75001",
				"city":     "Paris",
				"country":  "FR",
				"phone":    "+33612345678",
			},
			"deliveryContact": map[string]any{
				"fullname": "Warehouse Central",
				"email":    "warehouse@example.com",
				"address":  "456 Warehouse Ave",
				"zipcode":  "69001",
				"city":     "Lyon",
				"country":  "FR",
			},
			"linkedOrders": []map[string]any{
				{"orderId": "order-uuid-001"},
			},
		},
	}

	body, _ := json.Marshal(map[string]any{
		"query":     mutation,
		"variables": variables,
	})

	req, _ := http.NewRequest("POST", "https://api-v3.happycolis.com/graphql", bytes.NewBuffer(body))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", "Bearer "+os.Getenv("ACCESS_TOKEN"))

	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()

	var result map[string]any
	json.NewDecoder(resp.Body).Decode(&result)
	fmt.Println(result["data"])
}

HappyColis API Documentation