Returns API

You can create and retrieve returns in a Stitchex account using these API calls.

GET a single Return

Retrieve details for a return that already exists in Stitchex. The response will contain a list of all items included in the return.

$ curl https://api.stitchex.com/returns/RETURN_ID \
    -H "Authorization: ACCESS_TOKEN"

Example response:

{
    "returns": {
        "id": 2019,
        "created_at": "2018-12-03T12:16:17.000Z",
        "updated_at": "2018-12-03T12:16:26.000Z",
        "items_total": "45.0",
        "items_tax": "0.0",
        "subtotal": "45.0",
        "total_tax": "0.0",
        "grand_total": "45.0",
        "total_quantity": 5,
        "organisation_id": 9579,
        "return_number": 103,
        "order_number": 175,
        "tax_calc_method": "SUB_TOTAL",
        "line_items": [
            {
                "id": 10355,
                "product_id": 77635,
                "product_name": "Stitchex Cap",
                "variation_id": 163794,
                "color": "White",
                "unit_tax": "0.0",
                "tax_level": "0.0",
                "unit_price": "9.0",
                "original_price": "9.0",
                "percentage_discount": "0.0",
                "line_quantities": [
                    {
                        "id": 62162,
                        "size": "S",
                        "quantity": 5,
                        "sku_id": 867893
                    },
                    {
                        "id": 62163,
                        "size": "M",
                        "quantity": 0,
                        "sku_id": 867894
                    },
                    {
                        "id": 62164,
                        "size": "L",
                        "quantity": 0,
                        "sku_id": 867895
                    }
                ]
            },
            {
                "id": 10357,
                "product_id": 77635,
                "product_name": "Stitchex Cap",
                "variation_id": 163796,
                "color": "Blue",
                "unit_tax": "0.0",
                "tax_level": "0.0",
                "unit_price": "9.0",
                "original_price": "9.0",
                "percentage_discount": "0.0",
                "line_quantities": [
                    {
                        "id": 62168,
                        "size": "S",
                        "quantity": 0,
                        "sku_id": 867899
                    },
                    {
                        "id": 62169,
                        "size": "M",
                        "quantity": 0,
                        "sku_id": 867900
                    },
                    {
                        "id": 62170,
                        "size": "L",
                        "quantity": 0,
                        "sku_id": 867901
                    }
                ]
            }
        ]
    }
}

GET all Returns

Retrieve details for all returns. This endpoint will return 100 returns at most (see the Pagination section to learn how to access all pages).

$ curl https://api.stitchex.com/returns \
    -H "Authorization: ACCESS_TOKEN"

POST a Return

You can create a Return in Stitchex from an external system using a POST request to /stock_operations.

The caller should provide the following headers along with the request:

Content-Type : application/json
Authorization: Bearer ACCESS_TOKEN

The body of your request should be a JSON document formatted as below.

Example request:

{
    "saleId": 103390,
    "totalAmount": 10,
    "returnLineItems": [
        {
            "productId": 95996,
            "variationId": 211247,
            "skuId": 1115350,
            "quantity": 1
        }
    ]
}

Update the status of a Return

Mark the status of a Return to "checked-in".

PUT https://api.stitchex.com/returns/RETURN_ID/received

Reverse the check-in of a Return

PUT https://api.stitchex.com/returns/RETURN_ID/reverse

Next steps

Did this answer your question?