{
    "info": {
        "name": "Reytd API",
        "description": "The Reytd API (https://reytd.com/docs/api). Paste a token into the collection's Authorization tab: a sandbox token (rytd_test_...) uses the sandbox, a live token (rytd_live_...) your store's real data. Set the collection's `livemode` variable to match, `false` for the sandbox or `true` for live: every response is checked against it.",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "auth": {
        "type": "bearer",
        "bearer": [
            {
                "key": "token",
                "value": "",
                "type": "string"
            }
        ]
    },
    "event": [
        {
            "listen": "test",
            "script": {
                "type": "text/javascript",
                "exec": [
                    "// Every response says which environment answered: meta.livemode is true for a live token",
                    "// (rytd_live_...), false for a sandbox token (rytd_test_...) and null without a valid one.",
                    "// The collection's livemode variable says which one you expect.",
                    "const expected = pm.variables.get('livemode') === 'true';",
                    "const isJson = (pm.response.headers.get('Content-Type') || '').includes('json');",
                    "",
                    "if (isJson) {",
                    "    pm.test(`Answered by ${expected ? 'live' : 'the sandbox'}, as livemode expects`, () => {",
                    "        pm.expect(pm.response.json().meta?.livemode, 'meta.livemode').to.eql(expected);",
                    "    });",
                    "}"
                ]
            }
        }
    ],
    "variable": [
        {
            "key": "baseUrl",
            "value": "https://reytd.com/api",
            "type": "string"
        },
        {
            "key": "livemode",
            "value": "false",
            "type": "string",
            "description": "The environment you expect: \"false\" for the sandbox, \"true\" for live. Every response is checked against it."
        }
    ],
    "item": [
        {
            "name": "Store",
            "description": "The store a token belongs to.",
            "item": [
                {
                    "name": "Get the token's store",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{baseUrl}}/v1/store",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "store"
                            ],
                            "query": []
                        },
                        "description": "Returns the store the token belongs to and its organization, what the token may do, the\nwidget script to put on your site, and a link to the store in Reytd. Works with any token, whatever its abilities, so it's the call to check that a\ntoken works: a platform plugin calls it when a token is pasted in. `meta.livemode` says\nwhether it's a live or a sandbox token."
                    }
                }
            ]
        },
        {
            "name": "Products",
            "description": "Send your store's products to Reytd and read them back.",
            "item": [
                {
                    "name": "List products",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{baseUrl}}/v1/products",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "products"
                            ],
                            "query": [
                                {
                                    "key": "filter[name]",
                                    "value": "bottle",
                                    "description": "Products whose name contains this text.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[sku]",
                                    "value": "EGB-500",
                                    "description": "The product with exactly this SKU.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[external_id]",
                                    "value": "10001",
                                    "description": "The product with exactly this id from your system.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[search]",
                                    "value": "",
                                    "description": "Products whose name, SKU or id contains this text.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[updated_since]",
                                    "value": "2026-10-01T00:00:00+00:00",
                                    "description": "Products created or changed at or after this time (ISO 8601). A product counts as changed each time you send it, even unchanged; its rating changes with its reviews, not here.",
                                    "disabled": true
                                },
                                {
                                    "key": "sort",
                                    "value": "name",
                                    "description": "Sort by `name`, `created_at` or `updated_at`; prefix with `-` for descending.",
                                    "disabled": true
                                },
                                {
                                    "key": "cursor",
                                    "value": "",
                                    "description": "Where the page starts: leave it out for the first page, then follow `meta.pagination.next_page_url`, which carries it.",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "50",
                                    "description": "Products per page, at most 100.",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Returns the store's products a page at a time, most recently changed first, each with its\nrating from approved reviews and, for products in a group, the group and its rating."
                    }
                },
                {
                    "name": "Create or update products",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{baseUrl}}/v1/products",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "products"
                            ],
                            "query": []
                        },
                        "description": "Products are matched on `external_id`: a new id creates a product, a known id updates it.\nProducts that aren't in the request are never deleted, so you can send only what changed.\nGive products that are variants of one product (e.g. colours) the same `group_id` to share\ntheir reviews and rating, on plans with product groups. Each product says which group it's in: a product sent without\n`group_id` leaves its group. A group holds at most 50 products. Groups are for variants\nof one product, not for a range of different products.\nProducts that can't be saved don't fail the request; they're listed in\n`data.summary.failures` by their index in the `products` array, with a `code` saying why,\nand the rest are still saved.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"products\": [\n        {\n            \"external_id\": \"10001\",\n            \"name\": \"Everyday Glass Bottle\",\n            \"sku\": \"EGB-500\",\n            \"url\": \"https://example.com/products/glass-bottle\",\n            \"group_id\": \"EGB\",\n            \"group_name\": \"Everyday Glass Bottle\"\n        }\n    ]\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    }
                }
            ]
        },
        {
            "name": "Orders",
            "description": "Send your store's orders to Reytd, so customers can be asked for a review once their products ship.",
            "item": [
                {
                    "name": "List orders",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{baseUrl}}/v1/orders",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "orders"
                            ],
                            "query": [
                                {
                                    "key": "filter[external_id]",
                                    "value": "5001",
                                    "description": "The order with exactly this id from your system.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[number]",
                                    "value": "#1001",
                                    "description": "The order with exactly this order number.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[customer_email]",
                                    "value": "anna@example.com",
                                    "description": "Orders placed with exactly this email address.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[fulfillment_status]",
                                    "value": "fulfilled",
                                    "description": "Orders that are `unfulfilled`, `partially_fulfilled` or `fulfilled`.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[updated_since]",
                                    "value": "2026-10-01T00:00:00+00:00",
                                    "description": "Orders created or changed at or after this time (ISO 8601), including their line items, fulfillments and returns.",
                                    "disabled": true
                                },
                                {
                                    "key": "sort",
                                    "value": "placed_at",
                                    "description": "Sort by `placed_at`, `created_at` or `updated_at`; prefix with `-` for descending.",
                                    "disabled": true
                                },
                                {
                                    "key": "cursor",
                                    "value": "",
                                    "description": "Where the page starts: leave it out for the first page, then follow `meta.pagination.next_page_url`, which carries it.",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "50",
                                    "description": "Orders per page, at most 100.",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Returns the store's orders with their line items, fulfillments and returns, a page at a time,\nmost recently placed first."
                    }
                },
                {
                    "name": "Create or update orders",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{baseUrl}}/v1/orders",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "orders"
                            ],
                            "query": []
                        },
                        "description": "Orders are matched on `external_id`, and line items on `external_id` within their order: a new\nid creates one, a known id updates it, so send an order's current state whenever it changes.\nNothing is deleted: a line item left out is kept, so send a removed one with `quantity` 0. What has shipped is sent separately, to the fulfillments endpoint, and what came back to the returns endpoint. A line item's product is matched on its `external_id`; a product Reytd\ndoesn't know yet is created from the line item, and known products are left as they are.\nOrders that can't be saved don't fail the request; they're listed in `data.summary.failures`\nby their index in the `orders` array, with a `code` saying why, and the rest are still saved.\n\nNew orders must be placed in the last 30 days (or up to 24 hours ahead), and a store takes up to\n15,000 new orders in 30 days; orders outside either limit are listed in `failures` too\n(`order_too_old`, `placed_at_ahead`, or `order_limit_reached` with a `retry_after` time).\nOrders Reytd already has can always be updated.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"orders\": [\n        {\n            \"external_id\": \"5001\",\n            \"number\": \"#1001\",\n            \"placed_at\": \"{{$isoTimestamp}}\",\n            \"suppress_review_requests\": false,\n            \"customer\": {\n                \"email\": \"anna@example.com\",\n                \"first_name\": \"Anna\",\n                \"last_name\": \"Svensson\",\n                \"locale\": \"sv-SE\"\n            },\n            \"line_items\": [\n                {\n                    \"external_id\": \"9001\",\n                    \"quantity\": 1,\n                    \"suppress_review_requests\": false,\n                    \"product\": {\n                        \"external_id\": \"10001\",\n                        \"name\": \"Everyday Glass Bottle\",\n                        \"sku\": \"EGB-500\"\n                    }\n                }\n            ]\n        }\n    ]\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    }
                }
            ]
        },
        {
            "name": "Fulfillments",
            "description": "Tell Reytd which items of an order have shipped. Review requests are timed from fulfillments.",
            "item": [
                {
                    "name": "List fulfillments",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{baseUrl}}/v1/fulfillments",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "fulfillments"
                            ],
                            "query": [
                                {
                                    "key": "filter[external_id]",
                                    "value": "7001",
                                    "description": "The fulfillment with exactly this id from your system.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[order_external_id]",
                                    "value": "5001",
                                    "description": "The fulfillments of the order with exactly this id from your system.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[status]",
                                    "value": "delivered",
                                    "description": "Fulfillments that are `shipped`, `delivered` or `cancelled`.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[updated_since]",
                                    "value": "2026-10-01T00:00:00+00:00",
                                    "description": "Fulfillments created or changed at or after this time (ISO 8601).",
                                    "disabled": true
                                },
                                {
                                    "key": "sort",
                                    "value": "shipped_at",
                                    "description": "Sort by `shipped_at`, `created_at` or `updated_at`; prefix with `-` for descending.",
                                    "disabled": true
                                },
                                {
                                    "key": "cursor",
                                    "value": "",
                                    "description": "Where the page starts: leave it out for the first page, then follow `meta.pagination.next_page_url`, which carries it.",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "50",
                                    "description": "Fulfillments per page, at most 100.",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Returns the store's fulfillments with their line items, a page at a time, most recently\nshipped first. Each one names its order in `order_external_id`."
                    }
                },
                {
                    "name": "Create or update fulfillments",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{baseUrl}}/v1/fulfillments",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "fulfillments"
                            ],
                            "query": []
                        },
                        "description": "A fulfillment is one shipment of an order: the line items in it and how many of each. Send one\nwhen items have actually left, not when a label is printed, and send it again whenever it\nchanges, for example with a delivery date. Fulfillments are matched on `external_id`; sending\none again replaces its line items. The order must have been sent first, and its line items\ncan't ship more than was ordered. When every item has shipped, the order's\n`fulfillment_status` becomes `fulfilled`. Cancelling a fulfillment (`cancelled_at`) means its\nitems didn't ship. Fulfillments that can't be saved don't fail the request; they're\nlisted in `data.summary.failures` by their index in the `fulfillments` array, with a `code`\nsaying why (e.g. `order_not_found`: send the order first), and the rest are still saved.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"fulfillments\": [\n        {\n            \"external_id\": \"7001\",\n            \"order_external_id\": \"5001\",\n            \"shipped_at\": \"{{$isoTimestamp}}\",\n            \"delivered_at\": \"{{$isoTimestamp}}\",\n            \"tracking\": {\n                \"company\": \"PostNord\",\n                \"number\": \"00370712345678901234\",\n                \"url\": \"https://tracking.postnord.com/se/?id=00370712345678901234\"\n            },\n            \"line_items\": [\n                {\n                    \"external_id\": \"9001\",\n                    \"quantity\": 1\n                }\n            ]\n        }\n    ]\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    }
                }
            ]
        },
        {
            "name": "Returns",
            "description": "Tell Reytd which items of an order the customer sent back. A customer isn't asked to review a product they returned.",
            "item": [
                {
                    "name": "List returns",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{baseUrl}}/v1/returns",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "returns"
                            ],
                            "query": [
                                {
                                    "key": "filter[external_id]",
                                    "value": "6001",
                                    "description": "The return with exactly this id from your system.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[order_external_id]",
                                    "value": "5001",
                                    "description": "The returns of the order with exactly this id from your system.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[status]",
                                    "value": "returned",
                                    "description": "Returns that are `returned` or `cancelled`.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[updated_since]",
                                    "value": "2026-10-01T00:00:00+00:00",
                                    "description": "Returns created or changed at or after this time (ISO 8601).",
                                    "disabled": true
                                },
                                {
                                    "key": "sort",
                                    "value": "returned_at",
                                    "description": "Sort by `returned_at`, `created_at` or `updated_at`; prefix with `-` for descending.",
                                    "disabled": true
                                },
                                {
                                    "key": "cursor",
                                    "value": "",
                                    "description": "Where the page starts: leave it out for the first page, then follow `meta.pagination.next_page_url`, which carries it.",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "50",
                                    "description": "Returns per page, at most 100.",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Returns the store's returns with their line items, a page at a time, most recently returned\nfirst. Each one names its order in `order_external_id`."
                    }
                },
                {
                    "name": "Create or update returns",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{baseUrl}}/v1/returns",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "returns"
                            ],
                            "query": []
                        },
                        "description": "A return is the items of an order a customer sent back: the line items in it and how many of\neach. A customer who bought 10 and sent 2 back is a return of 2. Each return is its own,\nwith your id, so a second return later is a second one. When to send it is up to you: when\nthe customer asks to return, or when the items arrive back. Sending it when the customer\nasks keeps a review request from going out while the item is on its way back. Money back\nwhile the customer keeps the item isn't a return: don't send it.\n\nA customer isn't asked to review a product they returned, nor reminded about it; if they\nreturned everything, the review request stops. Reviews they already wrote stay. Shipping\nisn't undone: the order's `fulfillment_status` stays as it was. Returns are matched on\n`external_id`; sending one again replaces its line items. The order must have been sent\nfirst, and its line items can't come back more than was ordered. Cancelling a return\n(`cancelled_at`, for one you declined or the customer withdrew) means its items were kept: a\nreview request still waiting asks about them again, but one that stopped because everything\nwas returned doesn't start again. Returns that can't be saved don't fail the request;\nthey're listed in `data.summary.failures` by their index in the `returns` array, with a\n`code` saying why (e.g. `order_not_found`: send the order first), and the rest are still\nsaved.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"returns\": [\n        {\n            \"external_id\": \"6001\",\n            \"order_external_id\": \"5001\",\n            \"returned_at\": \"{{$isoTimestamp}}\",\n            \"line_items\": [\n                {\n                    \"external_id\": \"9001\",\n                    \"quantity\": 1\n                }\n            ]\n        }\n    ]\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    }
                }
            ]
        },
        {
            "name": "Reviews",
            "description": "Read your store's published reviews, for example to show them in your shop. On the Enterprise plan: ask us at hello@reytd.com.",
            "item": [
                {
                    "name": "List reviews",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{baseUrl}}/v1/reviews",
                            "host": [
                                "{{baseUrl}}"
                            ],
                            "path": [
                                "v1",
                                "reviews"
                            ],
                            "query": [
                                {
                                    "key": "filter[product_external_id]",
                                    "value": "10001",
                                    "description": "Reviews of the product with exactly this id from your system.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[group_external_id]",
                                    "value": "EGB",
                                    "description": "Reviews of any product in the group with exactly this `group_id` from your system.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[status]",
                                    "value": "approved,hidden",
                                    "description": "`approved` (published, the default), `hidden` (taken down by the store), or both: `approved,hidden`.",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[rating]",
                                    "value": "5",
                                    "description": "Reviews with exactly this many stars (1–5).",
                                    "disabled": true
                                },
                                {
                                    "key": "filter[updated_since]",
                                    "value": "2026-10-01T00:00:00+00:00",
                                    "description": "Reviews created or changed (e.g. replied to) at or after this time (ISO 8601).",
                                    "disabled": true
                                },
                                {
                                    "key": "sort",
                                    "value": "updated_at",
                                    "description": "Sort by `submitted_at` or `updated_at`; prefix with `-` for descending.",
                                    "disabled": true
                                },
                                {
                                    "key": "cursor",
                                    "value": "",
                                    "description": "Where the page starts: leave it out for the first page, then follow `meta.pagination.next_page_url`, which carries it.",
                                    "disabled": true
                                },
                                {
                                    "key": "per_page",
                                    "value": "50",
                                    "description": "Reviews per page, at most 100.",
                                    "disabled": true
                                }
                            ]
                        },
                        "description": "Returns the store's published (approved) reviews a page at a time, newest first. Reviews\nwaiting for approval are never included. To keep a copy in step, ask for the reviews changed\nsince your last sync with `filter[updated_since]` and `filter[status]=approved,hidden`, and\nremove the ones that come back `hidden`: the store has taken them down. It's on the\nEnterprise plan, which isn't open for sign-up yet: until then every store gets\n`plan_missing_feature` (403), so ask us at hello@reytd.com."
                    }
                }
            ]
        }
    ]
}