### GET /api/v1/orders Source: https://merchantapi.fyndiq.com/ Retrieves a list of orders based on specified criteria. The example shows how to list orders that are not yet fulfilled. ```APIDOC ## GET /api/v1/orders ### Description Retrieves a list of orders. You can filter orders by their state, for example, to list orders that are 'NOT_FULFILLED'. ### Method GET ### Endpoint /api/v1/orders ### Query Parameters - **state** (string) - Optional - The state of the orders to filter by (e.g., 'NOT_FULFILLED'). ### Response #### Success Response (200) - **id** (string) - The unique identifier for the order. - **article_id** (string) - The unique identifier for the article associated with the order. - **title** (string) - The title of the article. - **article_sku** (string) - The Stock Keeping Unit for the article. - **price** (object) - Details about the price of the item. - **amount** (number) - The price amount. - **vat_amount** (number) - The VAT amount. - **vat_rate** (number) - The VAT rate. - **currency** (string) - The currency of the price. - **total_price** (object) - Details about the total price of the order item. - **amount** (number) - The total price amount. - **vat_amount** (number) - The total VAT amount. - **vat_rate** (number) - The total VAT rate. - **currency** (string) - The currency of the total price. - **quantity** (integer) - The number of items ordered. - **shipping_address** (object) - The shipping address for the order. - **first_name** (string) - The recipient's first name. - **last_name** (string) - The recipient's last name. - **street_address** (string) - The street address. - **city** (string) - The city. - **postal_code** (string) - The postal code. - **country** (string) - The country. - **phone_number** (string) - The recipient's phone number. - **market** (string) - The market the order belongs to. - **state** (string) - The current state of the order (e.g., 'NOT_FULFILLED'). - **created_at** (string) - The timestamp when the order was created. - **updated_at** (string) - The timestamp when the order was last updated. - **fulfillment_deadline** (string) - The deadline for fulfilling the order. - **tracking_information** (array) - An array of tracking information objects. ### Request Example ```bash curl --location 'https://merchants-api.fyndiq.se/api/v1/orders?state=NOT_FULFILLED' ``` ### Response Example ```json [ { "id": "{{order_id}}", "article_id": "{{article_id}}", "title": "Article title", "article_sku": "123", "price": { "amount": 23.2, "vat_amount": 5.8, "vat_rate": 0.25, "currency": "SEK" }, "total_price": { "amount": 23.2, "vat_amount": 5.8, "vat_rate": 0.25, "currency": "SEK" }, "quantity": 2, "shipping_address": { "first_name": "Test", "last_name": "Person", "street_address": "Test address 1", "city": "Test city", "postal_code": "234567", "country": "Test country", "phone_number": "+46 00 000 00 00" }, "market": "SE", "state": "NOT FULFILLED", "created_at": "2018-01-01 16:57:06", "updated_at": "2018-01-01 16:57:06", "fulfillment_deadline": "2018-01-06 16:57:06", "tracking_information": [] } ] ``` ``` -------------------------------- ### Order list response Source: https://merchantapi.fyndiq.com/ Example JSON response body containing a list of order objects. ```json [ { "id": "{{order_id}}", "article_id": "{{article_id}}", "title": "Article title", "article_sku": "123", "price": { "amount": 23.2, "vat_amount": 5.8, "vat_rate": 0.25, "currency": "SEK" }, "total_price": { "amount": 23.2, "vat_amount": 5.8, "vat_rate": 0.25, "currency": "SEK" }, "quantity": 2, "shipping_address": { "first_name": "Test", "last_name": "Person", "street_address": "Test address 1", "city": "Test city", "postal_code": "234567", "country": "Test country", "phone_number": "+46 00 000 00 00" }, "market": "SE", "state": "NOT FULFILLED", "created_at": "2018-01-01 16:57:06", "updated_at": "2018-01-01 16:57:06", "fulfillment_deadline": "2018-01-06 16:57:06", "tracking_information": [] }, { "id": "{{order_id}}", "article_id": "{{article_id}}", "title": "Article title", "article_sku": "123", "price": { "amount": 23.2, "vat_amount": 5.8, "vat_rate": 0.25, "currency": "SEK" }, "total_price": { "amount": 23.2, "vat_amount": 5.8, "vat_rate": 0.25, "currency": "SEK" }, "quantity": 2, "shipping_address": { "first_name": "Test2", "last_name": "Person2", "street_address": "Test address 2", "city": "Test city", "postal_code": "234567", "country": "Test country", "phone_number": "+46 00 000 00 00" }, "market": "SE", "state": "NOT_FULFILLED", "created_at": "2018-01-01 16:57:06", "updated_at": "2018-01-01 16:57:06", "fulfillment_deadline": "2018-01-06 16:57:06", "tracking_information": [] } ] ``` -------------------------------- ### Retrieve Order Request Source: https://merchantapi.fyndiq.com/ Example cURL request to fetch a specific order by ID using Basic Authentication. ```bash curl --location -g 'https://merchants-api.fyndiq.se/api/v1/orders/{{order_id}}' \ --header 'Authorization: Basic {base64_encode(merchantID:token)}' \ --header 'Content-Type: application/json' ``` -------------------------------- ### Fulfill an order request body Source: https://merchantapi.fyndiq.com/ Example request body for fulfilling an order, including optional tracking information. ```text { "tracking_information": [ { "carrier_name": "Postnord", "tracking_number": "abc123" } } ``` ```json { "tracking_information": [ { "carrier_name": "Postnord", "tracking_number": "abc123" } ] } ``` -------------------------------- ### GET /api/v1/orders Source: https://merchantapi.fyndiq.com/ Retrieves a list of orders with support for filtering and pagination. ```APIDOC ## GET /api/v1/orders ### Description Retrieves a list of orders. By default, returns orders in the 'CREATED' state. ### Method GET ### Endpoint https://merchants-api.fyndiq.se/api/v1/orders ### Parameters #### Query Parameters - **state** (string) - Optional - Filter by order state (CREATED, FULFILLED, NOT_FULFILLED). - **limit** (integer) - Optional - Number of orders to return (default 100, max 1000). - **page** (integer) - Optional - Page number (default 1). ``` -------------------------------- ### GET /orders/{order_id} Source: https://merchantapi.fyndiq.com/ Retrieves details for a specific order using its unique Fyndiq ID. ```APIDOC ## GET /orders/{order_id} ### Description This endpoint allows you to retrieve the details of a specific order. ### Method GET ### Endpoint https://merchants-api.fyndiq.se/api/v1/orders/{order_id} ### Parameters #### Path Parameters - **order_id** (string) - Required - Fyndiq unique ID for the order ``` -------------------------------- ### GET /api/v1/orders/{order_id} Source: https://merchantapi.fyndiq.com/ Retrieves the full order object for a specific order ID. ```APIDOC ## GET /api/v1/orders/{order_id} ### Description Retrieves the full order object for a specific order ID. ### Method GET ### Endpoint https://merchants-api.fyndiq.se/api/v1/orders/{order_id} ### Parameters #### Path Parameters - **order_id** (string) - Required - The unique identifier of the order. ### Response #### Success Response (200) - **id** (string) - Order ID - **article_id** (string) - Article ID - **title** (string) - Article title - **article_sku** (string) - Article SKU - **price** (object) - Price details - **total_price** (object) - Total price details - **quantity** (integer) - Quantity - **shipping_address** (object) - Shipping address details - **market** (string) - Market code - **state** (string) - Order state - **created_at** (string) - Creation timestamp - **updated_at** (string) - Update timestamp - **fulfillment_deadline** (string) - Fulfillment deadline - **tracking_information** (array) - Tracking information #### Response Example { "id": "{{order_id}}", "article_id": "{{article_id}}", "title": "Article title", "article_sku": "123", "price": { "amount": 23.2, "vat_amount": 5.8, "vat_rate": 0.25, "currency": "SEK" }, "total_price": { "amount": 23.2, "vat_amount": 5.8, "vat_rate": 0.25, "currency": "SEK" }, "quantity": 2, "shipping_address": { "first_name": "Test", "last_name": "Person", "street_address": "Test address 1", "city": "Test city", "postal_code": "234567", "country": "Test country", "phone_number": "+46 00 000 00 00" }, "market": "SE", "state": "CREATED", "created_at": "2018-01-01 16:57:06", "updated_at": "2018-01-01 16:57:06", "fulfillment_deadline": "2018-01-06 16:57:06", "tracking_information": [] } ``` -------------------------------- ### POST /api/v1/orders Source: https://merchantapi.fyndiq.com/ Creates a new test order in the sandbox environment. ```APIDOC ## POST /api/v1/orders ### Description Creates a test order. This endpoint is only available in the sandbox environment. ### Method POST ### Endpoint https://merchants-api.SANDBOX.fyndiq.se/api/v1/orders ### Parameters #### Request Body - **article_id** (string) - Required - Fyndiq unique ID for the article (1-64 characters). - **quantity** (integer) - Required - Quantity of article unit to be ordered (0-50). ### Request Example { "article_id": "123", "quantity": 499 } ### Response #### Success Response (200) - **id** (string) - The generated Order ID. - **description** (string) - Confirmation message: "Order was created." ``` -------------------------------- ### Create Test Order Request Source: https://merchantapi.fyndiq.com/ This cURL command demonstrates how to create a test order in the Fyndiq sandbox environment. It requires the article ID and quantity, and the Authorization header. ```curl curl --location 'https://merchants-api-sandbox.fyndiq.se/api/v1/orders' \ --header 'Authorization: Basic {base64_encode(merchantID:token)}' \ --header 'Content-Type: application/json' \ --data '{ "article_id":"123", "quantity":499 }' ``` -------------------------------- ### Fyndiq API Live URL Source: https://merchantapi.fyndiq.com/ The root URL for accessing the live Fyndiq API. ```plaintext https://merchants-api.fyndiq.se/api/v1/ ``` -------------------------------- ### Create Test Order Response Source: https://merchantapi.fyndiq.com/ This JSON response confirms the successful creation of a test order and returns the new order ID. ```json { "id": "{{order_id}}", "description": "Order was created." } ``` -------------------------------- ### Retrieve an Order (Sandbox) Source: https://merchantapi.fyndiq.com/ This endpoint allows you to retrieve a specific order using its unique ID in the sandbox environment. Ensure your system supports TLS 1.1 or higher. ```plaintext https://merchants-api.SANDBOX.fyndiq.se/api/v1/orders/{{order_id}} ``` -------------------------------- ### Fyndiq API Sandbox URL Source: https://merchantapi.fyndiq.com/ The base URL for the Fyndiq sandbox environment, used for testing integrations. ```plaintext https://merchants-api.sandbox.fyndiq.se/api/v1/ ``` -------------------------------- ### Order Object Structure Source: https://merchantapi.fyndiq.com/ The full order object returned by the API, containing article details, pricing, shipping information, and order state. ```json { "id": "{{order_id}}", "article_id": "{{article_id}}", "title": "Article title", "article_sku": "123", "price": { "amount": 23.2, "vat_amount": 5.8, "vat_rate": 0.25, "currency": "SEK" }, "total_price": { "amount": 23.2, "vat_amount": 5.8, "vat_rate": 0.25, "currency": "SEK" }, "quantity": 2, "shipping_address": { "first_name": "Test", "last_name": "Person", "street_address": "Test address 1", "city": "Test city", "postal_code": "234567", "country": "Test country", "phone_number": "+46 00 000 00 00" }, "market": "SE", "state": "CREATED", "created_at": "2018-01-01 16:57:06", "updated_at": "2018-01-01 16:57:06", "fulfillment_deadline": "2018-01-06 16:57:06", "tracking_information": [] } ``` -------------------------------- ### Fulfill an order via cURL Source: https://merchantapi.fyndiq.com/ Perform a PUT request to fulfill a specific order. ```curl curl --location -g --request PUT 'https://merchants-api.fyndiq.se/api/v1/orders/{{order_id}}/fulfill' \ --header 'Authorization: Basic {base64_encode(merchantID:token)}' \ --header 'Content-Type: application/json' \ --data '' ``` -------------------------------- ### Basic Authentication Header Source: https://merchantapi.fyndiq.com/ All API endpoints require Basic Authentication. Include this header with your Base64-encoded merchant ID and token. ```plaintext Basic {base64_encode(merchantID:token)} ``` -------------------------------- ### Fulfill an order response Source: https://merchantapi.fyndiq.com/ Successful fulfillment response body. ```text { "description": "Order row was fulfilled" } ``` ```json { "description": "Order row was fulfilled" } ``` -------------------------------- ### List cancelled orders Source: https://merchantapi.fyndiq.com/ Retrieve a list of orders with the state set to NOT_FULFILLED. ```curl curl --location 'https://merchants-api.fyndiq.se/api/v1/orders?state=NOT_FULFILLED' ``` -------------------------------- ### PUT /api/v1/orders/{order_id}/fulfill Source: https://merchantapi.fyndiq.com/ Allows you to fulfill an order, marking it as shipped and setting its state to 'fulfilled'. Tracking information can be included in the request body. ```APIDOC ## PUT /api/v1/orders/{order_id}/fulfill ### Description This endpoint allows you to fulfill an order. It marks the order as handled after shipping and updates the order's state to 'fulfilled'. Orders that have already been cancelled cannot be fulfilled. ### Method PUT ### Endpoint /api/v1/orders/{{order_id}}/fulfill ### Path Parameters - **order_id** (string) - Required - Fyndiq unique ID for the order you want to fulfill. ### Request Body - **tracking_information** (array) - Optional - An array of tracking information objects. - **carrier_name** (string) - The name of the shipping carrier. - **tracking_number** (string) - The tracking number for the shipment. ### Request Example ```bash curl --location -g --request PUT 'https://merchants-api.fyndiq.se/api/v1/orders/{{order_id}}/fulfill' \ --header 'Authorization: Basic {base64_encode(merchantID:token)}' \ --header 'Content-Type: application/json' \ --data '{ "tracking_information": [ { "carrier_name": "Postnord", "tracking_number": "abc123" } ] }' ``` ### Response #### Success Response (202) - **description** (string) - A message indicating the order was fulfilled. #### Response Example ```json { "description": "Order row was fulfilled" } ``` ``` -------------------------------- ### Cancel Order Request Source: https://merchantapi.fyndiq.com/ Use this cURL command to cancel an order. Ensure you replace {{order_id}} with the actual order ID and provide the correct Authorization header. ```curl curl --location -g --request PUT 'https://merchants-api.fyndiq.se/api/v1/orders/{{order_id}}/cancel' \ --header 'Authorization: Basic {base64_encode(merchantID:token)}' \ --header 'Content-Type: application/json' \ --data '' ``` -------------------------------- ### Order Cancellation Response Source: https://merchantapi.fyndiq.com/ This JSON indicates that an order row was cancelled. ```json { "description": "Order row was cancelled" } ``` -------------------------------- ### PUT /api/v1/orders/{order_id}/cancel Source: https://merchantapi.fyndiq.com/ Allows you to cancel an order, typically due to stock issues or inability to ship. This sets the order state to 'not_fulfilled'. ```APIDOC ## PUT /api/v1/orders/{order_id}/cancel ### Description This endpoint allows you to cancel an order. It should be used when you are unable to ship an item (e.g., due to stock issues). This call will set the order field `state` to **not_fulfilled**. Any order that has already been fulfilled cannot be cancelled. ### Method PUT ### Endpoint /api/v1/orders/{{order_id}}/cancel ### Path Parameters - **order_id** (string) - Required - Fyndiq unique ID for the order you want to cancel. ### Response #### Success Response (200) - **description** (string) - A message indicating the order was cancelled. #### Response Example ```json { "description": "Order was cancelled" } ``` ``` -------------------------------- ### Order Already Cancelled Response Source: https://merchantapi.fyndiq.com/ This JSON response indicates that the order is already cancelled, resulting in a 403 Forbidden status. ```json { "description": "Order row already has not_fulfilled as state" } ``` -------------------------------- ### PUT /api/v1/orders/{order_id}/cancel Source: https://merchantapi.fyndiq.com/ Cancels an existing order row. ```APIDOC ## PUT /api/v1/orders/{order_id}/cancel ### Description Cancels a specific order row identified by the order_id. ### Method PUT ### Endpoint https://merchants-api.fyndiq.se/api/v1/orders/{order_id}/cancel ### Parameters #### Path Parameters - **order_id** (string) - Required - The unique identifier of the order to cancel. ### Response #### Success Response (200) - **description** (string) - Confirmation message: "Order row was cancelled" #### Error Response (403) - **description** (string) - Error message: "Order row already has not_fulfilled as state" or "Order is already cancelled" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.