{
  "openapi" : "3.0.1",
  "info" : {
    "description" : "For an ERP that pulls Slflo's orders, invoices, payments and returns, answers them with acks, and pushes its customers, catalogue, prices and balances by its own keys. snake_case JSON, money as decimal strings, keyset paging by version. Guides and reference: https://docs.slflo.com/developers/",
    "title" : "Slflo Integration API",
    "version" : "v1"
  },
  "servers" : [ {
    "url" : "https://api.slflo.com",
    "description" : "Slflo"
  } ],
  "security" : [ {
    "bearer" : [ ]
  } ],
  "tags" : [ {
    "description" : "Who the token belongs to.",
    "name" : "Client"
  }, {
    "description" : "Orders to book in the ERP: pull by version, answer with an ack.",
    "name" : "Orders"
  }, {
    "description" : "Invoices, payments (with receipts and cheques) and returns (credit notes): pull by version or by seq, ack.",
    "name" : "Documents"
  }, {
    "description" : "Customers, branches, units, products, prices and balances, pushed by the ERP's own keys.",
    "name" : "Master data"
  }, {
    "description" : "Find a record by either side's key; the code lists to map.",
    "name" : "Lookup"
  } ],
  "paths" : {
    "/api/integration/v1/acks" : {
      "post" : {
        "tags" : [ "Orders" ],
        "summary" : "Answer many documents of one kind",
        "description" : "Up to 500 acks for one entity (order, invoice, payment, return); each item applied on its own, with its own result. Needs that kind's :write scope. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "ackMany",
        "parameters" : [ {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/AckBatchBodyDto"
              },
              "example" : {
                "entity" : "payment",
                "items" : [ {
                  "external_number" : "JRN-000881",
                  "external_ref" : "JRN-000881",
                  "id" : "pay_01J9",
                  "message" : null,
                  "outcome" : "ACCEPTED",
                  "reason_code" : null
                }, {
                  "external_number" : null,
                  "external_ref" : null,
                  "id" : "pay_01JA",
                  "message" : "Customer CUST-0042 is on hold",
                  "outcome" : "REJECTED",
                  "reason_code" : "CUSTOMER_ON_HOLD"
                } ]
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Answer many documents of one kind",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/AckBatchDto"
                },
                "example" : {
                  "data" : [ {
                    "ack" : {
                      "acked_at" : "2026-10-05T10:42:00Z",
                      "acked_version" : 9134,
                      "external_number" : "JRN-000881",
                      "external_ref" : "JRN-000881",
                      "message" : null,
                      "outcome" : "ACCEPTED",
                      "reason_code" : null
                    },
                    "error" : null,
                    "id" : "pay_01J9",
                    "result" : "applied",
                    "status" : "RECORDED",
                    "version" : 9134
                  }, {
                    "ack" : {
                      "acked_at" : "2026-10-05T10:42:00Z",
                      "acked_version" : 9135,
                      "external_number" : "SO-0012345",
                      "external_ref" : "SO-0012345",
                      "message" : null,
                      "outcome" : "REJECTED",
                      "reason_code" : "CUSTOMER_ON_HOLD"
                    },
                    "error" : null,
                    "id" : "pay_01JA",
                    "result" : "unchanged",
                    "status" : "RECORDED",
                    "version" : 9135
                  } ],
                  "meta" : {
                    "applied" : 1,
                    "failed" : 0,
                    "unchanged" : 1
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/batch/{entity}" : {
      "post" : {
        "tags" : [ "Master data" ],
        "summary" : "Push up to 500 records in one call",
        "description" : "entity is products, units or balances; each item is {ref, body} with the PUT's body and gets its own result. Counts as one request for the rate limit. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "batch",
        "parameters" : [ {
          "name" : "entity",
          "in" : "path",
          "description" : "What the batch holds: products, units or balances.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "products"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/BatchDto"
              },
              "example" : {
                "items" : [ {
                  "body" : {
                    "base_unit_ref" : "pcs",
                    "name" : {
                      "en" : "Cola 330ml"
                    }
                  },
                  "ref" : "ITEM-1001"
                }, {
                  "body" : {
                    "base_unit_ref" : "box",
                    "name" : {
                      "en" : "Water 1.5l"
                    }
                  },
                  "ref" : "ITEM-1002"
                } ]
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Push up to 500 records in one call",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/BatchResultDto"
                },
                "example" : {
                  "data" : [ {
                    "error" : null,
                    "ok" : true,
                    "ref" : "ITEM-1001",
                    "result" : {
                      "entity" : "product",
                      "external_ref" : "ITEM-1001",
                      "id" : "P0000001",
                      "result" : "unchanged"
                    }
                  }, {
                    "error" : {
                      "code" : "UNKNOWN_REFERENCE",
                      "details" : [ ],
                      "message" : "Unknown unit box: PUT /units/box first."
                    },
                    "ok" : false,
                    "ref" : "ITEM-1002",
                    "result" : null
                  } ],
                  "meta" : {
                    "applied" : 1,
                    "failed" : 1
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/customers/{ref}" : {
      "put" : {
        "tags" : [ "Master data" ],
        "summary" : "Push a customer by your key",
        "description" : "Find or create; the same body twice is unchanged, an older source_version is stale. salflo_id adopts a customer that started in Slflo. Needs customers:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "putCustomer",
        "parameters" : [ {
          "name" : "ref",
          "in" : "path",
          "description" : "Your key for the customer — the account number in your ERP.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "CUST-0042"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/CustomerPushDto"
              },
              "example" : {
                "address" : "12 Tahrir St, Giza",
                "blocked" : false,
                "credit_limit" : 50000.00,
                "latitude" : 30.0131,
                "longitude" : 31.2089,
                "name" : {
                  "ar" : "سوق الأمل",
                  "en" : "Al Amal Market"
                },
                "price_list_ref" : "RETAIL",
                "radius_metres" : 150,
                "salflo_id" : null,
                "source_version" : "2026-10-05T10:40:00Z"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Push a customer by your key",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataPushResultDto"
                },
                "example" : {
                  "data" : {
                    "entity" : "customer",
                    "external_ref" : "CUST-0042",
                    "id" : "C0000001",
                    "result" : "created"
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      },
      "delete" : {
        "tags" : [ "Master data" ],
        "summary" : "Remove a pushed customer",
        "description" : "A tombstone, never a hard delete. Needs customers:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "deleteCustomer",
        "parameters" : [ {
          "name" : "ref",
          "in" : "path",
          "description" : "Your key for the customer — the account number in your ERP.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "CUST-0042"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Remove a pushed customer",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataPushResultDto"
                },
                "example" : {
                  "data" : {
                    "entity" : "customer",
                    "external_ref" : "CUST-0042",
                    "id" : "C0000001",
                    "result" : "deleted"
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/customers/{ref}/balance" : {
      "put" : {
        "tags" : [ "Master data" ],
        "summary" : "Push a customer's balance",
        "description" : "Your figure as of a time, plus money in flight. Needs balances:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "putBalance",
        "parameters" : [ {
          "name" : "ref",
          "in" : "path",
          "description" : "Your key for the customer — the account number in your ERP.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "CUST-0042"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/BalancePushDto"
              },
              "example" : {
                "as_of" : "2026-10-06T00:00:00Z",
                "balance" : 12500.00,
                "credit_limit" : 50000.00
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Push a customer's balance",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataPushResultDto"
                },
                "example" : {
                  "data" : {
                    "entity" : "balance",
                    "external_ref" : "CUST-0042",
                    "id" : "C0000001",
                    "result" : "updated"
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/customers/{ref}/branches/{branchRef}" : {
      "put" : {
        "tags" : [ "Master data" ],
        "summary" : "Push a branch by your keys",
        "description" : "Null overrides read the account's. Needs customers:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "putBranch",
        "parameters" : [ {
          "name" : "ref",
          "in" : "path",
          "description" : "Your key for the customer the branch belongs to.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "CUST-0042"
        }, {
          "name" : "branchRef",
          "in" : "path",
          "description" : "Your key for the branch (delivery address) of that customer.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "CUST-0042-02"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/BranchPushDto"
              },
              "example" : {
                "address" : "4 Mosadak St, Dokki",
                "blocked" : false,
                "contact_name" : "Hassan",
                "credit_limit" : null,
                "latitude" : 30.0385,
                "longitude" : 31.2101,
                "name" : {
                  "ar" : "سوق الأمل، الدقي",
                  "en" : "Al Amal Market, Dokki"
                },
                "payment_terms_days" : 30,
                "phone" : "+201001234567",
                "price_list_ref" : null,
                "radius_metres" : 100,
                "source_version" : "2026-10-05T10:40:00Z"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Push a branch by your keys",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataPushResultDto"
                },
                "example" : {
                  "data" : {
                    "entity" : "branch",
                    "external_ref" : "CUST-0042/01",
                    "id" : "C0000001:B01",
                    "result" : "created"
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      },
      "delete" : {
        "tags" : [ "Master data" ],
        "summary" : "Remove a pushed branch",
        "description" : "Refused with BRANCH_ON_ROUTE while a route still visits it. Needs customers:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "deleteBranch",
        "parameters" : [ {
          "name" : "ref",
          "in" : "path",
          "description" : "Your key for the customer the branch belongs to.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "CUST-0042"
        }, {
          "name" : "branchRef",
          "in" : "path",
          "description" : "Your key for the branch (delivery address) of that customer.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "CUST-0042-02"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Remove a pushed branch",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataPushResultDto"
                },
                "example" : {
                  "data" : {
                    "entity" : "branch",
                    "external_ref" : "CUST-0042/01",
                    "id" : "C0000001:B01",
                    "result" : "deleted"
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/invoices" : {
      "get" : {
        "tags" : [ "Documents" ],
        "summary" : "Invoices, by version or by seq",
        "description" : "By version (every change, reversals included) or, with filter[seq_after], each invoice once as it is issued, with no gaps. Needs invoices:read.",
        "operationId" : "listInvoices",
        "parameters" : [ {
          "name" : "filter[version_after]",
          "in" : "query",
          "description" : "The cursor: the last version you staged, or meta.next_version_after. version_after is accepted too.",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          },
          "example" : "18000"
        }, {
          "name" : "filter[updated_after]",
          "in" : "query",
          "description" : "ISO-8601 time; starts a first load at the first change from then. Not beside a cursor.",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "2026-10-01T00:00:00Z"
        }, {
          "name" : "filter[ack]",
          "in" : "query",
          "description" : "pending (no ack at the current version), accepted, rejected or any (default).",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "pending"
        }, {
          "name" : "filter[id]",
          "in" : "query",
          "description" : "Comma list of our ids, at most 100.",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "ord_01J9X,ord_01J9Y"
        }, {
          "name" : "filter[external_ref]",
          "in" : "query",
          "description" : "Your key for the record, as you acked it.",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "SO-0012345"
        }, {
          "name" : "per_page",
          "in" : "query",
          "description" : "1 to 500, default 100.",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          },
          "example" : "100"
        }, {
          "name" : "filter[seq_after]",
          "in" : "query",
          "description" : "Follow newly issued documents in issue order instead: the last seq you took (meta.last_seq). On its own.",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          },
          "example" : "40"
        } ],
        "responses" : {
          "200" : {
            "description" : "Invoices, by version or by seq",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/InvoicePage"
                },
                "example" : {
                  "data" : [ {
                    "ack" : null,
                    "branch" : {
                      "code" : "MAIN",
                      "external_ref" : "CUST-0042/01",
                      "id" : "C0000001:main"
                    },
                    "currency" : "EGP",
                    "customer" : {
                      "code" : "CUST-1",
                      "external_ref" : "CUST-0042",
                      "id" : "C0000001"
                    },
                    "external_number" : null,
                    "external_ref" : null,
                    "handover_id" : "ord_01J9X",
                    "id" : "inv_01J9",
                    "issue_date" : "2026-10-05",
                    "issued_at" : "2026-10-05T10:42:00Z",
                    "lines" : [ {
                      "description" : "Cola 330ml",
                      "discount" : "0.00",
                      "is_free_goods" : false,
                      "line_number" : 1,
                      "line_total" : "1430.70",
                      "product" : {
                        "code" : "SKU-COLA",
                        "external_ref" : "ITEM-1001",
                        "id" : "P0000001"
                      },
                      "promotion_code" : null,
                      "quantity" : "10.000",
                      "tax" : [ {
                        "amount" : "175.70",
                        "code" : "VAT",
                        "rate" : "14.00"
                      } ],
                      "unit" : {
                        "code" : "CASE",
                        "external_ref" : "cs",
                        "id" : "CASE"
                      },
                      "unit_price" : "125.50"
                    } ],
                    "number" : "INV-000041",
                    "order" : {
                      "branch" : {
                        "code" : "MAIN",
                        "external_ref" : "CUST-0042/01",
                        "id" : "C0000001:main"
                      },
                      "customer" : {
                        "code" : "CUST-1",
                        "external_ref" : "CUST-0042",
                        "id" : "C0000001"
                      },
                      "external_number" : "SO-0012345",
                      "external_ref" : "SO-0012345",
                      "id" : "ord_01J9X",
                      "lines" : [ {
                        "discount" : "0.00",
                        "is_free_goods" : false,
                        "line_number" : 1,
                        "product" : {
                          "code" : "SKU-COLA",
                          "external_ref" : "ITEM-1001",
                          "id" : "P0000001"
                        },
                        "promotion_code" : null,
                        "quantity" : "10.000",
                        "unit" : {
                          "code" : "CASE",
                          "external_ref" : "cs",
                          "id" : "CASE"
                        },
                        "unit_price" : "125.50"
                      } ],
                      "number" : "SO-000123",
                      "sales_rep" : {
                        "code" : "R012",
                        "external_ref" : "EMP-0451",
                        "id" : "rep_12"
                      },
                      "status" : "DELIVERED"
                    },
                    "prices_include_tax" : false,
                    "seq" : 41,
                    "status" : "ISSUED",
                    "tax_submission" : {
                      "eta_uuid" : "3F1D2C9A7B",
                      "reason" : null,
                      "status" : "VALID",
                      "submitted_at" : "2026-10-05T10:42:00Z"
                    },
                    "totals" : {
                      "discount" : "0.00",
                      "subtotal" : "1255.00",
                      "tax" : "175.70",
                      "total" : "1430.70"
                    },
                    "updated_at" : "2026-10-05T10:42:00Z",
                    "version" : 9120
                  } ],
                  "meta" : {
                    "has_more" : false,
                    "high_water" : 9140,
                    "next_version_after" : 9140,
                    "per_page" : 100
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/invoices/cursor" : {
      "get" : {
        "tags" : [ "Documents" ],
        "summary" : "Where the invoice stream stands",
        "description" : "last_seq and high_water: start from now with filter[seq_after]=last_seq or filter[version_after]=high_water.",
        "operationId" : "getInvoiceCursor",
        "parameters" : [ ],
        "responses" : {
          "200" : {
            "description" : "Where the invoice stream stands",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataCursorDto"
                },
                "example" : {
                  "data" : {
                    "high_water" : 9140,
                    "last_seq" : 41
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/invoices/{id}" : {
      "get" : {
        "tags" : [ "Documents" ],
        "summary" : "One invoice",
        "description" : "Needs invoices:read.",
        "operationId" : "getInvoice",
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "description" : "Slflo's id of the invoice, from the invoice feed.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "inv_01J9"
        } ],
        "responses" : {
          "200" : {
            "description" : "One invoice",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataInvoiceDto"
                },
                "example" : {
                  "data" : {
                    "ack" : null,
                    "branch" : {
                      "code" : "MAIN",
                      "external_ref" : "CUST-0042/01",
                      "id" : "C0000001:main"
                    },
                    "currency" : "EGP",
                    "customer" : {
                      "code" : "CUST-1",
                      "external_ref" : "CUST-0042",
                      "id" : "C0000001"
                    },
                    "external_number" : null,
                    "external_ref" : null,
                    "handover_id" : "ord_01J9X",
                    "id" : "inv_01J9",
                    "issue_date" : "2026-10-05",
                    "issued_at" : "2026-10-05T10:42:00Z",
                    "lines" : [ {
                      "description" : "Cola 330ml",
                      "discount" : "0.00",
                      "is_free_goods" : false,
                      "line_number" : 1,
                      "line_total" : "1430.70",
                      "product" : {
                        "code" : "SKU-COLA",
                        "external_ref" : "ITEM-1001",
                        "id" : "P0000001"
                      },
                      "promotion_code" : null,
                      "quantity" : "10.000",
                      "tax" : [ {
                        "amount" : "175.70",
                        "code" : "VAT",
                        "rate" : "14.00"
                      } ],
                      "unit" : {
                        "code" : "CASE",
                        "external_ref" : "cs",
                        "id" : "CASE"
                      },
                      "unit_price" : "125.50"
                    } ],
                    "number" : "INV-000041",
                    "order" : {
                      "branch" : {
                        "code" : "MAIN",
                        "external_ref" : "CUST-0042/01",
                        "id" : "C0000001:main"
                      },
                      "customer" : {
                        "code" : "CUST-1",
                        "external_ref" : "CUST-0042",
                        "id" : "C0000001"
                      },
                      "external_number" : "SO-0012345",
                      "external_ref" : "SO-0012345",
                      "id" : "ord_01J9X",
                      "lines" : [ {
                        "discount" : "0.00",
                        "is_free_goods" : false,
                        "line_number" : 1,
                        "product" : {
                          "code" : "SKU-COLA",
                          "external_ref" : "ITEM-1001",
                          "id" : "P0000001"
                        },
                        "promotion_code" : null,
                        "quantity" : "10.000",
                        "unit" : {
                          "code" : "CASE",
                          "external_ref" : "cs",
                          "id" : "CASE"
                        },
                        "unit_price" : "125.50"
                      } ],
                      "number" : "SO-000123",
                      "sales_rep" : {
                        "code" : "R012",
                        "external_ref" : "EMP-0451",
                        "id" : "rep_12"
                      },
                      "status" : "DELIVERED"
                    },
                    "prices_include_tax" : false,
                    "seq" : 41,
                    "status" : "ISSUED",
                    "tax_submission" : {
                      "eta_uuid" : "3F1D2C9A7B",
                      "reason" : null,
                      "status" : "VALID",
                      "submitted_at" : "2026-10-05T10:42:00Z"
                    },
                    "totals" : {
                      "discount" : "0.00",
                      "subtotal" : "1255.00",
                      "tax" : "175.70",
                      "total" : "1430.70"
                    },
                    "updated_at" : "2026-10-05T10:42:00Z",
                    "version" : 9120
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/invoices/{id}/ack" : {
      "post" : {
        "tags" : [ "Documents" ],
        "summary" : "Answer one invoice",
        "description" : "Kept at the version it answered: a invoice that changes later is pending again. Needs invoices:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "ackInvoice",
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "description" : "Slflo's id of the invoice, from the invoice feed.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "inv_01J9"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/AckBodyDto"
              },
              "example" : {
                "external_number" : "SO-0012345",
                "external_ref" : "SO-0012345",
                "message" : null,
                "outcome" : "ACCEPTED",
                "reason_code" : null
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Answer one invoice",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataAckResultDto"
                },
                "example" : {
                  "data" : {
                    "ack" : {
                      "acked_at" : "2026-10-05T10:42:00Z",
                      "acked_version" : 18343,
                      "external_number" : "SO-0012345",
                      "external_ref" : "SO-0012345",
                      "message" : null,
                      "outcome" : "ACCEPTED",
                      "reason_code" : null
                    },
                    "id" : "ord_01J9X",
                    "number" : "SO-000123",
                    "result" : "applied",
                    "status" : "ERP_CONFIRMED",
                    "version" : 18343
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/lookup" : {
      "get" : {
        "tags" : [ "Lookup" ],
        "summary" : "Find a record by your key or ours",
        "description" : "entity is customer, branch (your key is CUSTOMER_REF/BRANCH_REF), product, unit, price_list, warehouse, order, invoice, payment (or receipt) or return (or credit_note); send external_ref or id. A miss is exists: false. Needs a scope of the entity's family.",
        "operationId" : "lookup",
        "parameters" : [ {
          "name" : "entity",
          "in" : "query",
          "required" : false,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "id",
          "in" : "query",
          "required" : false,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "external_ref",
          "in" : "query",
          "required" : false,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Find a record by your key or ours",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataLookupDto"
                },
                "example" : {
                  "data" : {
                    "entity" : "customer",
                    "exists" : true,
                    "external_number" : null,
                    "external_ref" : "CUST-0042",
                    "id" : "C0000001",
                    "number" : "CUST-1",
                    "version" : 9123
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/me" : {
      "get" : {
        "tags" : [ "Client" ],
        "summary" : "Who am I",
        "description" : "The client, its company, scopes, token expiry and rate limit. Needs no scope; the first call to check settings.",
        "operationId" : "getMe",
        "parameters" : [ ],
        "responses" : {
          "200" : {
            "description" : "Who am I",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataMeDto"
                },
                "example" : {
                  "data" : {
                    "client" : {
                      "id" : "ic_01J9",
                      "name" : "D365 production",
                      "rate_limit_per_minute" : 120,
                      "system" : "DYNAMICS365",
                      "token_expires_at" : "2027-10-05T00:00:00Z",
                      "token_prefix" : "sfi_live_AB12CD34"
                    },
                    "company" : {
                      "code" : "t-demo",
                      "id" : "t-demo",
                      "name" : "Demo Distribution"
                    },
                    "scopes" : [ "invoices:read", "orders:read", "orders:write" ]
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/orders" : {
      "get" : {
        "tags" : [ "Orders" ],
        "summary" : "Orders, by version",
        "description" : "Oldest change first, keyset by version. Repeat with meta.next_version_after until has_more is false; stage by (id, version). Needs orders:read.",
        "operationId" : "listOrders",
        "parameters" : [ {
          "name" : "filter[version_after]",
          "in" : "query",
          "description" : "The cursor: the last version you staged, or meta.next_version_after. version_after is accepted too.",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          },
          "example" : "18000"
        }, {
          "name" : "filter[updated_after]",
          "in" : "query",
          "description" : "ISO-8601 time; starts a first load at the first change from then. Not beside a cursor.",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "2026-10-01T00:00:00Z"
        }, {
          "name" : "filter[ack]",
          "in" : "query",
          "description" : "pending (no ack at the current version), accepted, rejected or any (default).",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "pending"
        }, {
          "name" : "filter[id]",
          "in" : "query",
          "description" : "Comma list of our ids, at most 100.",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "ord_01J9X,ord_01J9Y"
        }, {
          "name" : "filter[external_ref]",
          "in" : "query",
          "description" : "Your key for the record, as you acked it.",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "SO-0012345"
        }, {
          "name" : "per_page",
          "in" : "query",
          "description" : "1 to 500, default 100.",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          },
          "example" : "100"
        }, {
          "name" : "filter[status]",
          "in" : "query",
          "description" : "Comma list of order statuses.",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "ERP_PENDING"
        } ],
        "responses" : {
          "200" : {
            "description" : "Orders, by version",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/OrderPageDto"
                },
                "example" : {
                  "data" : [ {
                    "ack" : null,
                    "branch" : {
                      "code" : "MAIN",
                      "external_ref" : "CUST-0042/01",
                      "id" : "C0000001:main"
                    },
                    "created_at" : "2026-10-05T08:12:44Z",
                    "currency" : "EGP",
                    "customer" : {
                      "code" : "CUST-1",
                      "external_ref" : "CUST-0042",
                      "id" : "C0000001"
                    },
                    "external_number" : null,
                    "external_ref" : null,
                    "id" : "ord_01J9X",
                    "idempotency_key" : "op_7f3a",
                    "lines" : [ {
                      "amount" : "1255.00",
                      "discount" : "0.00",
                      "is_free_goods" : false,
                      "line_number" : 1,
                      "line_total" : "1430.70",
                      "product" : {
                        "code" : "SKU-COLA",
                        "external_ref" : "ITEM-1001",
                        "id" : "P0000001"
                      },
                      "promotion_code" : null,
                      "quantity" : "10.000",
                      "tax" : [ {
                        "amount" : "175.70",
                        "code" : "VAT",
                        "rate" : "14.00"
                      } ],
                      "unit" : {
                        "code" : "CASE",
                        "external_ref" : "cs",
                        "id" : "CASE"
                      },
                      "unit_price" : "125.50"
                    } ],
                    "number" : "SO-000123",
                    "order_date" : "2026-10-05",
                    "prices_include_tax" : false,
                    "sales_rep" : {
                      "code" : "R012",
                      "external_ref" : "EMP-0451",
                      "id" : "rep_12"
                    },
                    "status" : "ERP_PENDING",
                    "totals" : {
                      "discount" : "0.00",
                      "gross" : "1430.70",
                      "net" : "1255.00",
                      "subtotal" : "1255.00",
                      "tax" : "175.70"
                    },
                    "updated_at" : "2026-10-05T10:42:00Z",
                    "version" : 18342,
                    "visit_id" : "vis_01J9"
                  } ],
                  "meta" : {
                    "has_more" : true,
                    "high_water" : 18990,
                    "next_version_after" : 18342,
                    "per_page" : 100
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/orders/{orderId}" : {
      "get" : {
        "tags" : [ "Orders" ],
        "summary" : "One order",
        "description" : "Needs orders:read.",
        "operationId" : "getOrder",
        "parameters" : [ {
          "name" : "orderId",
          "in" : "path",
          "description" : "Slflo's id of the order, from the order feed.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "ord_01J9X"
        } ],
        "responses" : {
          "200" : {
            "description" : "One order",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataOrderDto"
                },
                "example" : {
                  "data" : {
                    "ack" : null,
                    "branch" : {
                      "code" : "MAIN",
                      "external_ref" : "CUST-0042/01",
                      "id" : "C0000001:main"
                    },
                    "created_at" : "2026-10-05T08:12:44Z",
                    "currency" : "EGP",
                    "customer" : {
                      "code" : "CUST-1",
                      "external_ref" : "CUST-0042",
                      "id" : "C0000001"
                    },
                    "external_number" : null,
                    "external_ref" : null,
                    "id" : "ord_01J9X",
                    "idempotency_key" : "op_7f3a",
                    "lines" : [ {
                      "amount" : "1255.00",
                      "discount" : "0.00",
                      "is_free_goods" : false,
                      "line_number" : 1,
                      "line_total" : "1430.70",
                      "product" : {
                        "code" : "SKU-COLA",
                        "external_ref" : "ITEM-1001",
                        "id" : "P0000001"
                      },
                      "promotion_code" : null,
                      "quantity" : "10.000",
                      "tax" : [ {
                        "amount" : "175.70",
                        "code" : "VAT",
                        "rate" : "14.00"
                      } ],
                      "unit" : {
                        "code" : "CASE",
                        "external_ref" : "cs",
                        "id" : "CASE"
                      },
                      "unit_price" : "125.50"
                    } ],
                    "number" : "SO-000123",
                    "order_date" : "2026-10-05",
                    "prices_include_tax" : false,
                    "sales_rep" : {
                      "code" : "R012",
                      "external_ref" : "EMP-0451",
                      "id" : "rep_12"
                    },
                    "status" : "ERP_PENDING",
                    "totals" : {
                      "discount" : "0.00",
                      "gross" : "1430.70",
                      "net" : "1255.00",
                      "subtotal" : "1255.00",
                      "tax" : "175.70"
                    },
                    "updated_at" : "2026-10-05T10:42:00Z",
                    "version" : 18342,
                    "visit_id" : "vis_01J9"
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/orders/{orderId}/ack" : {
      "post" : {
        "tags" : [ "Orders" ],
        "summary" : "Answer an order",
        "description" : "ACCEPTED with your number moves it to ERP_CONFIRMED; REJECTED with a reason to ERP_FAILED, where the office can send it again. Needs orders:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "ackOrder",
        "parameters" : [ {
          "name" : "orderId",
          "in" : "path",
          "description" : "Slflo's id of the order, from the order feed.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "ord_01J9X"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/AckBodyDto"
              },
              "example" : {
                "external_number" : "SO-0012345",
                "external_ref" : "SO-0012345",
                "message" : null,
                "outcome" : "ACCEPTED",
                "reason_code" : null
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Answer an order",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataAckResultDto"
                },
                "example" : {
                  "data" : {
                    "ack" : {
                      "acked_at" : "2026-10-05T10:42:00Z",
                      "acked_version" : 18343,
                      "external_number" : "SO-0012345",
                      "external_ref" : "SO-0012345",
                      "message" : null,
                      "outcome" : "ACCEPTED",
                      "reason_code" : null
                    },
                    "id" : "ord_01J9X",
                    "number" : "SO-000123",
                    "result" : "applied",
                    "status" : "ERP_CONFIRMED",
                    "version" : 18343
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/payments" : {
      "get" : {
        "tags" : [ "Documents" ],
        "summary" : "Payments, by version or by seq",
        "description" : "By version (every change, reversals included) or, with filter[seq_after], each payment once as it is issued, with no gaps. Needs payments:read.",
        "operationId" : "listPayments",
        "parameters" : [ {
          "name" : "filter[version_after]",
          "in" : "query",
          "description" : "The cursor: the last version you staged, or meta.next_version_after. version_after is accepted too.",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          },
          "example" : "18000"
        }, {
          "name" : "filter[updated_after]",
          "in" : "query",
          "description" : "ISO-8601 time; starts a first load at the first change from then. Not beside a cursor.",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "2026-10-01T00:00:00Z"
        }, {
          "name" : "filter[ack]",
          "in" : "query",
          "description" : "pending (no ack at the current version), accepted, rejected or any (default).",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "pending"
        }, {
          "name" : "filter[id]",
          "in" : "query",
          "description" : "Comma list of our ids, at most 100.",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "ord_01J9X,ord_01J9Y"
        }, {
          "name" : "filter[external_ref]",
          "in" : "query",
          "description" : "Your key for the record, as you acked it.",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "SO-0012345"
        }, {
          "name" : "per_page",
          "in" : "query",
          "description" : "1 to 500, default 100.",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          },
          "example" : "100"
        }, {
          "name" : "filter[seq_after]",
          "in" : "query",
          "description" : "Follow newly issued documents in issue order instead: the last seq you took (meta.last_seq). On its own.",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          },
          "example" : "40"
        } ],
        "responses" : {
          "200" : {
            "description" : "Payments, by version or by seq",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/PaymentPage"
                },
                "example" : {
                  "data" : [ {
                    "ack" : null,
                    "allocations" : [ {
                      "amount" : "1430.70",
                      "invoice" : {
                        "code" : "INV-000041",
                        "external_ref" : null,
                        "id" : "inv_01J9"
                      },
                      "kind" : "INVOICE",
                      "receivable_id" : "rcv_01J9",
                      "reference" : "INV-000041"
                    } ],
                    "amount" : "1430.70",
                    "branch" : {
                      "code" : "MAIN",
                      "external_ref" : "CUST-0042/01",
                      "id" : "C0000001:main"
                    },
                    "cheque" : {
                      "bank" : "NBE",
                      "bounce_reason" : null,
                      "due_on" : "2026-10-20",
                      "number" : "000123",
                      "status" : "IN_HAND"
                    },
                    "collected_at" : "2026-10-05T10:42:00Z",
                    "collected_by" : {
                      "sales_rep" : {
                        "code" : "R012",
                        "external_ref" : "EMP-0451",
                        "id" : "rep_12"
                      },
                      "user" : "rep12"
                    },
                    "collection_date" : "2026-10-05",
                    "currency" : "EGP",
                    "customer" : {
                      "code" : "CUST-1",
                      "external_ref" : "CUST-0042",
                      "id" : "C0000001"
                    },
                    "external_number" : null,
                    "external_ref" : null,
                    "id" : "pay_01J9",
                    "method" : "CHEQUE",
                    "number" : "RC-000017",
                    "on_account" : "0.00",
                    "receipt" : {
                      "balance_after" : "0.00",
                      "id" : "rc_01J9",
                      "issued_at" : "2026-10-05T10:42:00Z",
                      "number" : "RC-000017",
                      "seq" : 17,
                      "void_reason" : null,
                      "voided_at" : null
                    },
                    "reference" : "000123",
                    "reversal" : null,
                    "seq" : 17,
                    "status" : "RECORDED",
                    "updated_at" : "2026-10-05T10:42:00Z",
                    "version" : 9133
                  } ],
                  "meta" : {
                    "has_more" : false,
                    "high_water" : 9140,
                    "next_version_after" : 9140,
                    "per_page" : 100
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/payments/cursor" : {
      "get" : {
        "tags" : [ "Documents" ],
        "summary" : "Where the payment stream stands",
        "description" : "last_seq and high_water: start from now with filter[seq_after]=last_seq or filter[version_after]=high_water.",
        "operationId" : "getPaymentCursor",
        "parameters" : [ ],
        "responses" : {
          "200" : {
            "description" : "Where the payment stream stands",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataCursorDto"
                },
                "example" : {
                  "data" : {
                    "high_water" : 9140,
                    "last_seq" : 41
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/payments/{id}" : {
      "get" : {
        "tags" : [ "Documents" ],
        "summary" : "One payment",
        "description" : "Needs payments:read.",
        "operationId" : "getPayment",
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "description" : "Slflo's id of the payment (receipt), from the payment feed.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "pay_01J9"
        } ],
        "responses" : {
          "200" : {
            "description" : "One payment",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataPaymentDto"
                },
                "example" : {
                  "data" : {
                    "ack" : null,
                    "allocations" : [ {
                      "amount" : "1430.70",
                      "invoice" : {
                        "code" : "INV-000041",
                        "external_ref" : null,
                        "id" : "inv_01J9"
                      },
                      "kind" : "INVOICE",
                      "receivable_id" : "rcv_01J9",
                      "reference" : "INV-000041"
                    } ],
                    "amount" : "1430.70",
                    "branch" : {
                      "code" : "MAIN",
                      "external_ref" : "CUST-0042/01",
                      "id" : "C0000001:main"
                    },
                    "cheque" : {
                      "bank" : "NBE",
                      "bounce_reason" : null,
                      "due_on" : "2026-10-20",
                      "number" : "000123",
                      "status" : "IN_HAND"
                    },
                    "collected_at" : "2026-10-05T10:42:00Z",
                    "collected_by" : {
                      "sales_rep" : {
                        "code" : "R012",
                        "external_ref" : "EMP-0451",
                        "id" : "rep_12"
                      },
                      "user" : "rep12"
                    },
                    "collection_date" : "2026-10-05",
                    "currency" : "EGP",
                    "customer" : {
                      "code" : "CUST-1",
                      "external_ref" : "CUST-0042",
                      "id" : "C0000001"
                    },
                    "external_number" : null,
                    "external_ref" : null,
                    "id" : "pay_01J9",
                    "method" : "CHEQUE",
                    "number" : "RC-000017",
                    "on_account" : "0.00",
                    "receipt" : {
                      "balance_after" : "0.00",
                      "id" : "rc_01J9",
                      "issued_at" : "2026-10-05T10:42:00Z",
                      "number" : "RC-000017",
                      "seq" : 17,
                      "void_reason" : null,
                      "voided_at" : null
                    },
                    "reference" : "000123",
                    "reversal" : null,
                    "seq" : 17,
                    "status" : "RECORDED",
                    "updated_at" : "2026-10-05T10:42:00Z",
                    "version" : 9133
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/payments/{id}/ack" : {
      "post" : {
        "tags" : [ "Documents" ],
        "summary" : "Answer one payment",
        "description" : "Kept at the version it answered: a payment that changes later is pending again. Needs payments:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "ackPayment",
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "description" : "Slflo's id of the payment (receipt), from the payment feed.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "pay_01J9"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/AckBodyDto"
              },
              "example" : {
                "external_number" : "SO-0012345",
                "external_ref" : "SO-0012345",
                "message" : null,
                "outcome" : "ACCEPTED",
                "reason_code" : null
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Answer one payment",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataAckResultDto"
                },
                "example" : {
                  "data" : {
                    "ack" : {
                      "acked_at" : "2026-10-05T10:42:00Z",
                      "acked_version" : 18343,
                      "external_number" : "SO-0012345",
                      "external_ref" : "SO-0012345",
                      "message" : null,
                      "outcome" : "ACCEPTED",
                      "reason_code" : null
                    },
                    "id" : "ord_01J9X",
                    "number" : "SO-000123",
                    "result" : "applied",
                    "status" : "ERP_CONFIRMED",
                    "version" : 18343
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/price-lists/{ref}" : {
      "put" : {
        "tags" : [ "Master data" ],
        "summary" : "Push a price list header",
        "description" : "Needs prices:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "putPriceList",
        "parameters" : [ {
          "name" : "ref",
          "in" : "path",
          "description" : "Your key for the price list.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "RETAIL"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/PriceListPushDto"
              },
              "example" : {
                "currency" : "EGP",
                "name" : {
                  "ar" : "التجزئة",
                  "en" : "Retail"
                },
                "source_version" : "12"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Push a price list header",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataPushResultDto"
                },
                "example" : {
                  "data" : {
                    "entity" : "price_list",
                    "external_ref" : "RETAIL",
                    "id" : "PL0000002",
                    "result" : "created"
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/price-lists/{ref}/prices" : {
      "put" : {
        "tags" : [ "Master data" ],
        "summary" : "Push resolved prices",
        "description" : "Up to 500 rows; mode=replace removes the list's other prices, merge (default) leaves them. Unknown refs refuse the whole call with each one in details. Needs prices:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "putPrices",
        "parameters" : [ {
          "name" : "ref",
          "in" : "path",
          "description" : "Your key for the price list.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "RETAIL"
        }, {
          "name" : "mode",
          "in" : "query",
          "required" : false,
          "schema" : {
            "type" : "string",
            "default" : "merge"
          }
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/PricesDto"
              },
              "example" : {
                "prices" : [ {
                  "min_price" : 120.00,
                  "price" : 125.50,
                  "product_ref" : "ITEM-1001",
                  "unit_ref" : "cs",
                  "valid_from" : "2026-10-01",
                  "valid_to" : null
                } ]
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Push resolved prices",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataPricesResultDto"
                },
                "example" : {
                  "data" : {
                    "external_ref" : "RETAIL",
                    "list_id" : "PL0000002",
                    "removed" : 0,
                    "unchanged" : 480,
                    "written" : 1
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/products/{ref}" : {
      "put" : {
        "tags" : [ "Master data" ],
        "summary" : "Push a product",
        "description" : "Its base unit by your unit key. Needs catalog:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "putProduct",
        "parameters" : [ {
          "name" : "ref",
          "in" : "path",
          "description" : "Your key for the product — the item number in your ERP.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "ITEM-1001"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/ProductPushDto"
              },
              "example" : {
                "active" : true,
                "base_unit_ref" : "pcs",
                "category_code" : "DRINKS",
                "name" : {
                  "ar" : "كولا ٣٣٠ مل",
                  "en" : "Cola 330ml"
                },
                "salflo_id" : null,
                "source_version" : "2026-10-05T10:40:00Z"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Push a product",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataPushResultDto"
                },
                "example" : {
                  "data" : {
                    "entity" : "product",
                    "external_ref" : "ITEM-1001",
                    "id" : "P0000001",
                    "result" : "created"
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/products/{ref}/units" : {
      "put" : {
        "tags" : [ "Master data" ],
        "summary" : "Replace a product's sellable units",
        "description" : "The whole list with factors to the base unit. Needs catalog:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "putProductUnits",
        "parameters" : [ {
          "name" : "ref",
          "in" : "path",
          "description" : "Your key for the product — the item number in your ERP.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "ITEM-1001"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/ProductUnitsDto"
              },
              "example" : {
                "units" : [ {
                  "factor_to_base" : 1,
                  "order_default" : false,
                  "unit_ref" : "pcs"
                }, {
                  "factor_to_base" : 24,
                  "order_default" : true,
                  "unit_ref" : "cs"
                } ]
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Replace a product's sellable units",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataPushResultDto"
                },
                "example" : {
                  "data" : {
                    "entity" : "product",
                    "external_ref" : "ITEM-1001",
                    "id" : "P0000001",
                    "result" : "updated"
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/reference/{kind}" : {
      "get" : {
        "tags" : [ "Lookup" ],
        "summary" : "A code list to map",
        "description" : "kind is payment-methods, return-reasons, order-statuses, return-statuses, cheque-statuses, tax-codes, currencies, units, warehouses or price-lists. Needs no scope.",
        "operationId" : "getReferenceList",
        "parameters" : [ {
          "name" : "kind",
          "in" : "path",
          "description" : "Which list: payment-methods, return-reasons, order-statuses, return-statuses, cheque-statuses, tax-codes, currencies, units, warehouses or price-lists.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "payment-methods"
        } ],
        "responses" : {
          "200" : {
            "description" : "A code list to map",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ReferenceListDto"
                },
                "example" : {
                  "data" : [ {
                    "attributes" : {
                      "needs_reference" : "false"
                    },
                    "code" : "CASH",
                    "external_ref" : null,
                    "id" : null,
                    "name" : {
                      "en" : "Cash"
                    }
                  }, {
                    "attributes" : {
                      "needs_reference" : "true"
                    },
                    "code" : "CHEQUE",
                    "external_ref" : null,
                    "id" : null,
                    "name" : {
                      "en" : "Cheque"
                    }
                  } ],
                  "meta" : {
                    "count" : 2,
                    "kind" : "payment-methods"
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/returns" : {
      "get" : {
        "tags" : [ "Documents" ],
        "summary" : "Returns, by version or by seq",
        "description" : "By version (every change, reversals included) or, with filter[seq_after], each return once as it is issued, with no gaps. Needs returns:read.",
        "operationId" : "listReturns",
        "parameters" : [ {
          "name" : "filter[version_after]",
          "in" : "query",
          "description" : "The cursor: the last version you staged, or meta.next_version_after. version_after is accepted too.",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          },
          "example" : "18000"
        }, {
          "name" : "filter[updated_after]",
          "in" : "query",
          "description" : "ISO-8601 time; starts a first load at the first change from then. Not beside a cursor.",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "2026-10-01T00:00:00Z"
        }, {
          "name" : "filter[ack]",
          "in" : "query",
          "description" : "pending (no ack at the current version), accepted, rejected or any (default).",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "pending"
        }, {
          "name" : "filter[id]",
          "in" : "query",
          "description" : "Comma list of our ids, at most 100.",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "ord_01J9X,ord_01J9Y"
        }, {
          "name" : "filter[external_ref]",
          "in" : "query",
          "description" : "Your key for the record, as you acked it.",
          "required" : false,
          "schema" : {
            "type" : "string"
          },
          "example" : "SO-0012345"
        }, {
          "name" : "per_page",
          "in" : "query",
          "description" : "1 to 500, default 100.",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          },
          "example" : "100"
        }, {
          "name" : "filter[seq_after]",
          "in" : "query",
          "description" : "Follow newly issued documents in issue order instead: the last seq you took (meta.last_seq). On its own.",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          },
          "example" : "40"
        } ],
        "responses" : {
          "200" : {
            "description" : "Returns, by version or by seq",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ReturnPage"
                },
                "example" : {
                  "data" : [ {
                    "ack" : null,
                    "approval" : null,
                    "branch" : {
                      "code" : "MAIN",
                      "external_ref" : "CUST-0042/01",
                      "id" : "C0000001:main"
                    },
                    "credit_note_number" : "RET-000004",
                    "currency" : "EGP",
                    "customer" : {
                      "code" : "CUST-1",
                      "external_ref" : "CUST-0042",
                      "id" : "C0000001"
                    },
                    "external_number" : null,
                    "external_ref" : null,
                    "id" : "ret_01J9",
                    "invoice" : {
                      "external_number" : "D365-INV-77",
                      "external_ref" : "D365-INV-77",
                      "id" : "inv_01J9",
                      "number" : "INV-000041",
                      "seq" : 41
                    },
                    "lines" : [ {
                      "batch_id" : null,
                      "invoice_line_number" : 1,
                      "is_expired" : false,
                      "line_number" : 1,
                      "line_total" : "251.00",
                      "product" : {
                        "code" : "SKU-COLA",
                        "external_ref" : "ITEM-1001",
                        "id" : "P0000001"
                      },
                      "quantity" : "2.000",
                      "unit" : {
                        "code" : "CASE",
                        "external_ref" : "cs",
                        "id" : "CASE"
                      },
                      "unit_price" : "125.50"
                    } ],
                    "location" : {
                      "code" : "VAN-12",
                      "external_ref" : "VAN12",
                      "id" : "van_12"
                    },
                    "number" : "RET-000004",
                    "reason" : "DAMAGED",
                    "return_date" : "2026-10-05",
                    "returned_at" : "2026-10-05T10:42:00Z",
                    "sales_rep" : {
                      "code" : "R012",
                      "external_ref" : "EMP-0451",
                      "id" : "rep_12"
                    },
                    "seq" : 4,
                    "status" : "RECORDED",
                    "total" : "251.00",
                    "updated_at" : "2026-10-05T10:42:00Z",
                    "version" : 9140
                  } ],
                  "meta" : {
                    "has_more" : false,
                    "high_water" : 9140,
                    "next_version_after" : 9140,
                    "per_page" : 100
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/returns/cursor" : {
      "get" : {
        "tags" : [ "Documents" ],
        "summary" : "Where the return stream stands",
        "description" : "last_seq and high_water: start from now with filter[seq_after]=last_seq or filter[version_after]=high_water.",
        "operationId" : "getReturnCursor",
        "parameters" : [ ],
        "responses" : {
          "200" : {
            "description" : "Where the return stream stands",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataCursorDto"
                },
                "example" : {
                  "data" : {
                    "high_water" : 9140,
                    "last_seq" : 41
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/returns/{id}" : {
      "get" : {
        "tags" : [ "Documents" ],
        "summary" : "One return",
        "description" : "Needs returns:read.",
        "operationId" : "getReturn",
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "description" : "Slflo's id of the return (credit note), from the return feed.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "ret_01J9"
        } ],
        "responses" : {
          "200" : {
            "description" : "One return",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataReturnDto"
                },
                "example" : {
                  "data" : {
                    "ack" : null,
                    "approval" : null,
                    "branch" : {
                      "code" : "MAIN",
                      "external_ref" : "CUST-0042/01",
                      "id" : "C0000001:main"
                    },
                    "credit_note_number" : "RET-000004",
                    "currency" : "EGP",
                    "customer" : {
                      "code" : "CUST-1",
                      "external_ref" : "CUST-0042",
                      "id" : "C0000001"
                    },
                    "external_number" : null,
                    "external_ref" : null,
                    "id" : "ret_01J9",
                    "invoice" : {
                      "external_number" : "D365-INV-77",
                      "external_ref" : "D365-INV-77",
                      "id" : "inv_01J9",
                      "number" : "INV-000041",
                      "seq" : 41
                    },
                    "lines" : [ {
                      "batch_id" : null,
                      "invoice_line_number" : 1,
                      "is_expired" : false,
                      "line_number" : 1,
                      "line_total" : "251.00",
                      "product" : {
                        "code" : "SKU-COLA",
                        "external_ref" : "ITEM-1001",
                        "id" : "P0000001"
                      },
                      "quantity" : "2.000",
                      "unit" : {
                        "code" : "CASE",
                        "external_ref" : "cs",
                        "id" : "CASE"
                      },
                      "unit_price" : "125.50"
                    } ],
                    "location" : {
                      "code" : "VAN-12",
                      "external_ref" : "VAN12",
                      "id" : "van_12"
                    },
                    "number" : "RET-000004",
                    "reason" : "DAMAGED",
                    "return_date" : "2026-10-05",
                    "returned_at" : "2026-10-05T10:42:00Z",
                    "sales_rep" : {
                      "code" : "R012",
                      "external_ref" : "EMP-0451",
                      "id" : "rep_12"
                    },
                    "seq" : 4,
                    "status" : "RECORDED",
                    "total" : "251.00",
                    "updated_at" : "2026-10-05T10:42:00Z",
                    "version" : 9140
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/returns/{id}/ack" : {
      "post" : {
        "tags" : [ "Documents" ],
        "summary" : "Answer one return",
        "description" : "Kept at the version it answered: a return that changes later is pending again. Needs returns:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "ackReturn",
        "parameters" : [ {
          "name" : "id",
          "in" : "path",
          "description" : "Slflo's id of the return (credit note), from the return feed.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "ret_01J9"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/AckBodyDto"
              },
              "example" : {
                "external_number" : "SO-0012345",
                "external_ref" : "SO-0012345",
                "message" : null,
                "outcome" : "ACCEPTED",
                "reason_code" : null
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Answer one return",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataAckResultDto"
                },
                "example" : {
                  "data" : {
                    "ack" : {
                      "acked_at" : "2026-10-05T10:42:00Z",
                      "acked_version" : 18343,
                      "external_number" : "SO-0012345",
                      "external_ref" : "SO-0012345",
                      "message" : null,
                      "outcome" : "ACCEPTED",
                      "reason_code" : null
                    },
                    "id" : "ord_01J9X",
                    "number" : "SO-000123",
                    "result" : "applied",
                    "status" : "ERP_CONFIRMED",
                    "version" : 18343
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/integration/v1/units/{ref}" : {
      "put" : {
        "tags" : [ "Master data" ],
        "summary" : "Push a unit",
        "description" : "A unit of ours with the same code is adopted. Needs catalog:write. Send an Idempotency-Key header; a retry with the same key and body answers the first answer again, with Idempotent-Replayed: true.",
        "operationId" : "putUnit",
        "parameters" : [ {
          "name" : "ref",
          "in" : "path",
          "description" : "Your key for the unit of measure.",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "pcs"
        }, {
          "name" : "Idempotency-Key",
          "in" : "header",
          "description" : "Your key for this write, at most 100 characters (an order id or journal id works well). Required on every write; kept 7 days. Same key and body: the first answer again. Same key, other body: 422 IDEMPOTENCY_KEY_REUSED.",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/UnitPushDto"
              },
              "example" : {
                "name" : {
                  "ar" : "كرتونة",
                  "en" : "Case"
                },
                "source_version" : "7"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Push a unit",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationDataPushResultDto"
                },
                "example" : {
                  "data" : {
                    "entity" : "unit",
                    "external_ref" : "cs",
                    "id" : "CASE",
                    "result" : "created"
                  }
                }
              }
            }
          },
          "default" : {
            "description" : "An error: the code says what, retryable whether to try again.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/IntegrationError"
                },
                "example" : {
                  "error" : {
                    "code" : "SCOPE_MISSING",
                    "details" : [ ],
                    "message" : "This client does not hold the invoices:read scope.",
                    "request_id" : "req_01J9X4Q7T2M8P3NRT6V5WZ",
                    "retryable" : false
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components" : {
    "schemas" : {
      "AckBatchBodyDto" : {
        "type" : "object",
        "properties" : {
          "entity" : {
            "type" : "string"
          },
          "items" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/AckBatchItemDto"
            }
          }
        }
      },
      "AckBatchDto" : {
        "required" : [ "data", "meta" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/AckBatchItemResultDto"
            }
          },
          "meta" : {
            "$ref" : "#/components/schemas/AckBatchMetaDto"
          }
        }
      },
      "AckBatchItemDto" : {
        "type" : "object",
        "properties" : {
          "external_number" : {
            "type" : "string"
          },
          "external_ref" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string"
          },
          "message" : {
            "type" : "string"
          },
          "outcome" : {
            "type" : "string"
          },
          "reason_code" : {
            "type" : "string"
          }
        }
      },
      "AckBatchItemResultDto" : {
        "required" : [ "result" ],
        "type" : "object",
        "properties" : {
          "ack" : {
            "$ref" : "#/components/schemas/AckDto"
          },
          "error" : {
            "$ref" : "#/components/schemas/AckItemErrorDto"
          },
          "id" : {
            "type" : "string"
          },
          "result" : {
            "type" : "string"
          },
          "status" : {
            "type" : "string"
          },
          "version" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "AckBatchMetaDto" : {
        "required" : [ "applied", "failed", "unchanged" ],
        "type" : "object",
        "properties" : {
          "applied" : {
            "type" : "integer",
            "format" : "int32"
          },
          "failed" : {
            "type" : "integer",
            "format" : "int32"
          },
          "unchanged" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "AckBodyDto" : {
        "type" : "object",
        "properties" : {
          "external_number" : {
            "type" : "string"
          },
          "external_ref" : {
            "type" : "string"
          },
          "message" : {
            "type" : "string"
          },
          "outcome" : {
            "type" : "string"
          },
          "reason_code" : {
            "type" : "string"
          }
        }
      },
      "AckDto" : {
        "required" : [ "acked_at", "acked_version", "outcome" ],
        "type" : "object",
        "properties" : {
          "acked_at" : {
            "type" : "string"
          },
          "acked_version" : {
            "type" : "integer",
            "format" : "int64"
          },
          "external_number" : {
            "type" : "string"
          },
          "external_ref" : {
            "type" : "string"
          },
          "message" : {
            "type" : "string"
          },
          "outcome" : {
            "type" : "string"
          },
          "reason_code" : {
            "type" : "string"
          }
        }
      },
      "AckItemErrorDto" : {
        "required" : [ "code", "details", "message", "retryable", "status" ],
        "type" : "object",
        "properties" : {
          "code" : {
            "type" : "string"
          },
          "details" : {
            "type" : "array",
            "items" : {
              "type" : "object",
              "additionalProperties" : {
                "type" : "string"
              }
            }
          },
          "message" : {
            "type" : "string"
          },
          "retryable" : {
            "type" : "boolean"
          },
          "status" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "AckResultDto" : {
        "required" : [ "ack", "id", "result", "status", "version" ],
        "type" : "object",
        "properties" : {
          "ack" : {
            "$ref" : "#/components/schemas/AckDto"
          },
          "id" : {
            "type" : "string"
          },
          "number" : {
            "type" : "string"
          },
          "result" : {
            "type" : "string"
          },
          "status" : {
            "type" : "string"
          },
          "version" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "AllocationDto" : {
        "required" : [ "amount", "kind", "receivable_id", "reference" ],
        "type" : "object",
        "properties" : {
          "amount" : {
            "type" : "string"
          },
          "invoice" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "kind" : {
            "type" : "string"
          },
          "receivable_id" : {
            "type" : "string"
          },
          "reference" : {
            "type" : "string"
          }
        }
      },
      "ApprovalDto" : {
        "type" : "object",
        "properties" : {
          "decided_at" : {
            "type" : "string"
          },
          "decided_by" : {
            "type" : "string"
          },
          "held_reason" : {
            "type" : "string"
          },
          "note" : {
            "type" : "string"
          }
        }
      },
      "BalancePushDto" : {
        "type" : "object",
        "properties" : {
          "as_of" : {
            "type" : "string"
          },
          "balance" : {
            "type" : "number"
          },
          "credit_limit" : {
            "type" : "number"
          }
        }
      },
      "BatchDto" : {
        "required" : [ "items" ],
        "type" : "object",
        "properties" : {
          "items" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/BatchItemDto"
            }
          }
        }
      },
      "BatchItemDto" : {
        "required" : [ "ref" ],
        "type" : "object",
        "properties" : {
          "body" : {
            "$ref" : "#/components/schemas/JsonNode"
          },
          "ref" : {
            "type" : "string"
          }
        }
      },
      "BatchItemResultDto" : {
        "required" : [ "ok", "ref" ],
        "type" : "object",
        "properties" : {
          "error" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "object"
            }
          },
          "ok" : {
            "type" : "boolean"
          },
          "ref" : {
            "type" : "string"
          },
          "result" : {
            "$ref" : "#/components/schemas/PushResultDto"
          }
        }
      },
      "BatchResultDto" : {
        "required" : [ "data", "meta" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/BatchItemResultDto"
            }
          },
          "meta" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "integer",
              "format" : "int32"
            }
          }
        }
      },
      "BranchPushDto" : {
        "required" : [ "blocked", "name" ],
        "type" : "object",
        "properties" : {
          "address" : {
            "type" : "string"
          },
          "blocked" : {
            "type" : "boolean"
          },
          "contact_name" : {
            "type" : "string"
          },
          "credit_limit" : {
            "type" : "number"
          },
          "latitude" : {
            "type" : "number",
            "format" : "double"
          },
          "longitude" : {
            "type" : "number",
            "format" : "double"
          },
          "name" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "string"
            }
          },
          "payment_terms_days" : {
            "type" : "integer",
            "format" : "int32"
          },
          "phone" : {
            "type" : "string"
          },
          "price_list_ref" : {
            "type" : "string"
          },
          "radius_metres" : {
            "type" : "integer",
            "format" : "int32"
          },
          "source_version" : {
            "type" : "string"
          }
        }
      },
      "ChequeDto" : {
        "required" : [ "number", "status" ],
        "type" : "object",
        "properties" : {
          "bank" : {
            "type" : "string"
          },
          "bounce_reason" : {
            "type" : "string"
          },
          "due_on" : {
            "type" : "string"
          },
          "number" : {
            "type" : "string"
          },
          "status" : {
            "type" : "string"
          }
        }
      },
      "CollectedByDto" : {
        "type" : "object",
        "properties" : {
          "sales_rep" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "user" : {
            "type" : "string"
          }
        }
      },
      "CursorDto" : {
        "required" : [ "high_water", "last_seq" ],
        "type" : "object",
        "properties" : {
          "high_water" : {
            "type" : "integer",
            "format" : "int64"
          },
          "last_seq" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "CustomerPushDto" : {
        "required" : [ "blocked", "name" ],
        "type" : "object",
        "properties" : {
          "address" : {
            "type" : "string"
          },
          "blocked" : {
            "type" : "boolean"
          },
          "credit_limit" : {
            "type" : "number"
          },
          "latitude" : {
            "type" : "number",
            "format" : "double"
          },
          "longitude" : {
            "type" : "number",
            "format" : "double"
          },
          "name" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "string"
            }
          },
          "price_list_ref" : {
            "type" : "string"
          },
          "radius_metres" : {
            "type" : "integer",
            "format" : "int32"
          },
          "salflo_id" : {
            "type" : "string"
          },
          "source_version" : {
            "type" : "string"
          }
        }
      },
      "FeedMetaDto" : {
        "required" : [ "has_more", "high_water", "next_version_after", "per_page" ],
        "type" : "object",
        "properties" : {
          "has_more" : {
            "type" : "boolean"
          },
          "high_water" : {
            "type" : "integer",
            "format" : "int64"
          },
          "next_version_after" : {
            "type" : "integer",
            "format" : "int64"
          },
          "per_page" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "IntegrationDataAckResultDto" : {
        "required" : [ "data" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "$ref" : "#/components/schemas/AckResultDto"
          }
        }
      },
      "IntegrationDataCursorDto" : {
        "required" : [ "data" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "$ref" : "#/components/schemas/CursorDto"
          }
        }
      },
      "IntegrationDataInvoiceDto" : {
        "required" : [ "data" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "$ref" : "#/components/schemas/InvoiceDto"
          }
        }
      },
      "IntegrationDataLookupDto" : {
        "required" : [ "data" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "$ref" : "#/components/schemas/LookupDto"
          }
        }
      },
      "IntegrationDataMeDto" : {
        "required" : [ "data" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "$ref" : "#/components/schemas/MeDto"
          }
        }
      },
      "IntegrationDataOrderDto" : {
        "required" : [ "data" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "$ref" : "#/components/schemas/OrderDto"
          }
        }
      },
      "IntegrationDataPaymentDto" : {
        "required" : [ "data" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "$ref" : "#/components/schemas/PaymentDto"
          }
        }
      },
      "IntegrationDataPricesResultDto" : {
        "required" : [ "data" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "$ref" : "#/components/schemas/PricesResultDto"
          }
        }
      },
      "IntegrationDataPushResultDto" : {
        "required" : [ "data" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "$ref" : "#/components/schemas/PushResultDto"
          }
        }
      },
      "IntegrationDataReturnDto" : {
        "required" : [ "data" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "$ref" : "#/components/schemas/ReturnDto"
          }
        }
      },
      "IntegrationError" : {
        "required" : [ "error" ],
        "type" : "object",
        "properties" : {
          "error" : {
            "required" : [ "code", "message", "details", "request_id", "retryable" ],
            "type" : "object",
            "properties" : {
              "code" : {
                "type" : "string",
                "description" : "Stable code, e.g. SCOPE_MISSING, UNKNOWN_REFERENCE."
              },
              "details" : {
                "type" : "array",
                "description" : "Field-level problems: {field, code}.",
                "items" : {
                  "type" : "object",
                  "additionalProperties" : {
                    "type" : "string"
                  }
                }
              },
              "message" : {
                "type" : "string",
                "description" : "What happened and how to fix it."
              },
              "request_id" : {
                "type" : "string",
                "description" : "Quote it to support; it finds the server log."
              },
              "retryable" : {
                "type" : "boolean",
                "description" : "Whether the same call may succeed later."
              }
            }
          }
        }
      },
      "InvoiceDto" : {
        "required" : [ "branch", "currency", "customer", "id", "issue_date", "issued_at", "lines", "number", "order", "prices_include_tax", "status", "totals", "updated_at", "version" ],
        "type" : "object",
        "properties" : {
          "ack" : {
            "$ref" : "#/components/schemas/AckDto"
          },
          "branch" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "currency" : {
            "type" : "string"
          },
          "customer" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "external_number" : {
            "type" : "string"
          },
          "external_ref" : {
            "type" : "string"
          },
          "handover_id" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string"
          },
          "issue_date" : {
            "type" : "string"
          },
          "issued_at" : {
            "type" : "string"
          },
          "lines" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/InvoiceLineDto"
            }
          },
          "number" : {
            "type" : "string"
          },
          "order" : {
            "$ref" : "#/components/schemas/InvoicedOrderDto"
          },
          "prices_include_tax" : {
            "type" : "boolean"
          },
          "seq" : {
            "type" : "integer",
            "format" : "int64"
          },
          "status" : {
            "type" : "string"
          },
          "tax_submission" : {
            "$ref" : "#/components/schemas/TaxSubmissionDto"
          },
          "totals" : {
            "$ref" : "#/components/schemas/InvoiceTotalsDto"
          },
          "updated_at" : {
            "type" : "string"
          },
          "version" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "InvoiceLineDto" : {
        "required" : [ "description", "discount", "is_free_goods", "line_number", "line_total", "product", "quantity", "tax", "unit", "unit_price" ],
        "type" : "object",
        "properties" : {
          "description" : {
            "type" : "string"
          },
          "discount" : {
            "type" : "string"
          },
          "is_free_goods" : {
            "type" : "boolean"
          },
          "line_number" : {
            "type" : "integer",
            "format" : "int32"
          },
          "line_total" : {
            "type" : "string"
          },
          "product" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "promotion_code" : {
            "type" : "string"
          },
          "quantity" : {
            "type" : "string"
          },
          "tax" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/TaxDto"
            }
          },
          "unit" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "unit_price" : {
            "type" : "string"
          }
        }
      },
      "InvoicePage" : {
        "required" : [ "data", "meta" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/InvoiceDto"
            }
          },
          "meta" : {
            "oneOf" : [ {
              "$ref" : "#/components/schemas/FeedMetaDto"
            }, {
              "$ref" : "#/components/schemas/SeqMetaDto"
            } ]
          }
        }
      },
      "InvoiceTotalsDto" : {
        "required" : [ "discount", "subtotal", "tax", "total" ],
        "type" : "object",
        "properties" : {
          "discount" : {
            "type" : "string"
          },
          "subtotal" : {
            "type" : "string"
          },
          "tax" : {
            "type" : "string"
          },
          "total" : {
            "type" : "string"
          }
        }
      },
      "InvoicedOrderDto" : {
        "required" : [ "branch", "customer", "id", "lines", "number", "sales_rep", "status" ],
        "type" : "object",
        "properties" : {
          "branch" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "customer" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "external_number" : {
            "type" : "string"
          },
          "external_ref" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string"
          },
          "lines" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/OrderedLineDto"
            }
          },
          "number" : {
            "type" : "string"
          },
          "sales_rep" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "status" : {
            "type" : "string"
          }
        }
      },
      "JsonNode" : {
        "type" : "object"
      },
      "LookupDto" : {
        "required" : [ "entity", "exists" ],
        "type" : "object",
        "properties" : {
          "entity" : {
            "type" : "string"
          },
          "exists" : {
            "type" : "boolean"
          },
          "external_number" : {
            "type" : "string"
          },
          "external_ref" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string"
          },
          "number" : {
            "type" : "string"
          },
          "version" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "MeClientDto" : {
        "required" : [ "id", "name", "rate_limit_per_minute", "system", "token_expires_at", "token_prefix" ],
        "type" : "object",
        "properties" : {
          "id" : {
            "type" : "string"
          },
          "name" : {
            "type" : "string"
          },
          "rate_limit_per_minute" : {
            "type" : "integer",
            "format" : "int32"
          },
          "system" : {
            "type" : "string"
          },
          "token_expires_at" : {
            "type" : "string"
          },
          "token_prefix" : {
            "type" : "string"
          }
        }
      },
      "MeCompanyDto" : {
        "required" : [ "code", "id", "name" ],
        "type" : "object",
        "properties" : {
          "code" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string"
          },
          "name" : {
            "type" : "string"
          }
        }
      },
      "MeDto" : {
        "required" : [ "client", "company", "scopes" ],
        "type" : "object",
        "properties" : {
          "client" : {
            "$ref" : "#/components/schemas/MeClientDto"
          },
          "company" : {
            "$ref" : "#/components/schemas/MeCompanyDto"
          },
          "scopes" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            }
          }
        }
      },
      "OrderDto" : {
        "required" : [ "branch", "created_at", "currency", "customer", "id", "idempotency_key", "lines", "number", "order_date", "prices_include_tax", "sales_rep", "status", "totals", "updated_at", "version" ],
        "type" : "object",
        "properties" : {
          "ack" : {
            "$ref" : "#/components/schemas/AckDto"
          },
          "branch" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "created_at" : {
            "type" : "string"
          },
          "currency" : {
            "type" : "string"
          },
          "customer" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "external_number" : {
            "type" : "string"
          },
          "external_ref" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string"
          },
          "idempotency_key" : {
            "type" : "string"
          },
          "lines" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/OrderLineDto"
            }
          },
          "number" : {
            "type" : "string"
          },
          "order_date" : {
            "type" : "string"
          },
          "prices_include_tax" : {
            "type" : "boolean"
          },
          "sales_rep" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "status" : {
            "type" : "string"
          },
          "totals" : {
            "$ref" : "#/components/schemas/TotalsDto"
          },
          "updated_at" : {
            "type" : "string"
          },
          "version" : {
            "type" : "integer",
            "format" : "int64"
          },
          "visit_id" : {
            "type" : "string"
          }
        }
      },
      "OrderLineDto" : {
        "required" : [ "amount", "discount", "is_free_goods", "line_number", "line_total", "product", "quantity", "tax", "unit", "unit_price" ],
        "type" : "object",
        "properties" : {
          "amount" : {
            "type" : "string"
          },
          "discount" : {
            "type" : "string"
          },
          "is_free_goods" : {
            "type" : "boolean"
          },
          "line_number" : {
            "type" : "integer",
            "format" : "int32"
          },
          "line_total" : {
            "type" : "string"
          },
          "product" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "promotion_code" : {
            "type" : "string"
          },
          "quantity" : {
            "type" : "string"
          },
          "tax" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/TaxDto"
            }
          },
          "unit" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "unit_price" : {
            "type" : "string"
          }
        }
      },
      "OrderPageDto" : {
        "required" : [ "data", "meta" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/OrderDto"
            }
          },
          "meta" : {
            "$ref" : "#/components/schemas/FeedMetaDto"
          }
        }
      },
      "OrderedLineDto" : {
        "required" : [ "discount", "is_free_goods", "line_number", "product", "quantity", "unit", "unit_price" ],
        "type" : "object",
        "properties" : {
          "discount" : {
            "type" : "string"
          },
          "is_free_goods" : {
            "type" : "boolean"
          },
          "line_number" : {
            "type" : "integer",
            "format" : "int32"
          },
          "product" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "promotion_code" : {
            "type" : "string"
          },
          "quantity" : {
            "type" : "string"
          },
          "unit" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "unit_price" : {
            "type" : "string"
          }
        }
      },
      "PaymentDto" : {
        "required" : [ "allocations", "amount", "branch", "collected_at", "collected_by", "collection_date", "currency", "customer", "id", "method", "on_account", "status", "updated_at", "version" ],
        "type" : "object",
        "properties" : {
          "ack" : {
            "$ref" : "#/components/schemas/AckDto"
          },
          "allocations" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/AllocationDto"
            }
          },
          "amount" : {
            "type" : "string"
          },
          "branch" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "cheque" : {
            "$ref" : "#/components/schemas/ChequeDto"
          },
          "collected_at" : {
            "type" : "string"
          },
          "collected_by" : {
            "$ref" : "#/components/schemas/CollectedByDto"
          },
          "collection_date" : {
            "type" : "string"
          },
          "currency" : {
            "type" : "string"
          },
          "customer" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "external_number" : {
            "type" : "string"
          },
          "external_ref" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string"
          },
          "method" : {
            "type" : "string"
          },
          "number" : {
            "type" : "string"
          },
          "on_account" : {
            "type" : "string"
          },
          "receipt" : {
            "$ref" : "#/components/schemas/ReceiptDto"
          },
          "reference" : {
            "type" : "string"
          },
          "reversal" : {
            "$ref" : "#/components/schemas/ReversalDto"
          },
          "seq" : {
            "type" : "integer",
            "format" : "int64"
          },
          "status" : {
            "type" : "string"
          },
          "updated_at" : {
            "type" : "string"
          },
          "version" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "PaymentPage" : {
        "required" : [ "data", "meta" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/PaymentDto"
            }
          },
          "meta" : {
            "oneOf" : [ {
              "$ref" : "#/components/schemas/FeedMetaDto"
            }, {
              "$ref" : "#/components/schemas/SeqMetaDto"
            } ]
          }
        }
      },
      "PriceDto" : {
        "required" : [ "price", "product_ref", "unit_ref", "valid_from" ],
        "type" : "object",
        "properties" : {
          "min_price" : {
            "type" : "number"
          },
          "price" : {
            "type" : "number"
          },
          "product_ref" : {
            "type" : "string"
          },
          "unit_ref" : {
            "type" : "string"
          },
          "valid_from" : {
            "type" : "string"
          },
          "valid_to" : {
            "type" : "string"
          }
        }
      },
      "PriceListPushDto" : {
        "required" : [ "currency", "name" ],
        "type" : "object",
        "properties" : {
          "currency" : {
            "type" : "string"
          },
          "name" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "string"
            }
          },
          "source_version" : {
            "type" : "string"
          }
        }
      },
      "PricesDto" : {
        "required" : [ "prices" ],
        "type" : "object",
        "properties" : {
          "prices" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/PriceDto"
            }
          }
        }
      },
      "PricesResultDto" : {
        "required" : [ "external_ref", "list_id", "removed", "unchanged", "written" ],
        "type" : "object",
        "properties" : {
          "external_ref" : {
            "type" : "string"
          },
          "list_id" : {
            "type" : "string"
          },
          "removed" : {
            "type" : "integer",
            "format" : "int32"
          },
          "unchanged" : {
            "type" : "integer",
            "format" : "int32"
          },
          "written" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "ProductPushDto" : {
        "required" : [ "active", "base_unit_ref", "name" ],
        "type" : "object",
        "properties" : {
          "active" : {
            "type" : "boolean"
          },
          "base_unit_ref" : {
            "type" : "string"
          },
          "category_code" : {
            "type" : "string"
          },
          "name" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "string"
            }
          },
          "salflo_id" : {
            "type" : "string"
          },
          "source_version" : {
            "type" : "string"
          }
        }
      },
      "ProductUnitDto" : {
        "required" : [ "factor_to_base", "order_default", "unit_ref" ],
        "type" : "object",
        "properties" : {
          "factor_to_base" : {
            "type" : "number"
          },
          "order_default" : {
            "type" : "boolean"
          },
          "unit_ref" : {
            "type" : "string"
          }
        }
      },
      "ProductUnitsDto" : {
        "required" : [ "units" ],
        "type" : "object",
        "properties" : {
          "units" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/ProductUnitDto"
            }
          }
        }
      },
      "PushResultDto" : {
        "required" : [ "entity", "external_ref", "id", "result" ],
        "type" : "object",
        "properties" : {
          "entity" : {
            "type" : "string"
          },
          "external_ref" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string"
          },
          "result" : {
            "type" : "string"
          }
        }
      },
      "ReceiptDto" : {
        "required" : [ "balance_after", "id", "issued_at", "number" ],
        "type" : "object",
        "properties" : {
          "balance_after" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string"
          },
          "issued_at" : {
            "type" : "string"
          },
          "number" : {
            "type" : "string"
          },
          "seq" : {
            "type" : "integer",
            "format" : "int64"
          },
          "void_reason" : {
            "type" : "string"
          },
          "voided_at" : {
            "type" : "string"
          }
        }
      },
      "RefDto" : {
        "required" : [ "id" ],
        "type" : "object",
        "properties" : {
          "code" : {
            "type" : "string"
          },
          "external_ref" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string"
          }
        }
      },
      "ReferenceItemDto" : {
        "required" : [ "attributes", "code", "name" ],
        "type" : "object",
        "properties" : {
          "attributes" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "string"
            }
          },
          "code" : {
            "type" : "string"
          },
          "external_ref" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string"
          },
          "name" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "string"
            }
          }
        }
      },
      "ReferenceListDto" : {
        "required" : [ "data", "meta" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/ReferenceItemDto"
            }
          },
          "meta" : {
            "$ref" : "#/components/schemas/ReferenceMetaDto"
          }
        }
      },
      "ReferenceMetaDto" : {
        "required" : [ "count", "kind" ],
        "type" : "object",
        "properties" : {
          "count" : {
            "type" : "integer",
            "format" : "int32"
          },
          "kind" : {
            "type" : "string"
          }
        }
      },
      "ReturnDto" : {
        "required" : [ "branch", "currency", "customer", "id", "invoice", "lines", "location", "number", "reason", "return_date", "returned_at", "sales_rep", "status", "total", "updated_at", "version" ],
        "type" : "object",
        "properties" : {
          "ack" : {
            "$ref" : "#/components/schemas/AckDto"
          },
          "approval" : {
            "$ref" : "#/components/schemas/ApprovalDto"
          },
          "branch" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "credit_note_number" : {
            "type" : "string"
          },
          "currency" : {
            "type" : "string"
          },
          "customer" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "external_number" : {
            "type" : "string"
          },
          "external_ref" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string"
          },
          "invoice" : {
            "$ref" : "#/components/schemas/ReturnedInvoiceDto"
          },
          "lines" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/ReturnLineDto"
            }
          },
          "location" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "number" : {
            "type" : "string"
          },
          "reason" : {
            "type" : "string"
          },
          "return_date" : {
            "type" : "string"
          },
          "returned_at" : {
            "type" : "string"
          },
          "sales_rep" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "seq" : {
            "type" : "integer",
            "format" : "int64"
          },
          "status" : {
            "type" : "string"
          },
          "total" : {
            "type" : "string"
          },
          "updated_at" : {
            "type" : "string"
          },
          "version" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "ReturnLineDto" : {
        "required" : [ "invoice_line_number", "is_expired", "line_number", "line_total", "product", "quantity", "unit", "unit_price" ],
        "type" : "object",
        "properties" : {
          "batch_id" : {
            "type" : "string"
          },
          "invoice_line_number" : {
            "type" : "integer",
            "format" : "int32"
          },
          "is_expired" : {
            "type" : "boolean"
          },
          "line_number" : {
            "type" : "integer",
            "format" : "int32"
          },
          "line_total" : {
            "type" : "string"
          },
          "product" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "quantity" : {
            "type" : "string"
          },
          "unit" : {
            "$ref" : "#/components/schemas/RefDto"
          },
          "unit_price" : {
            "type" : "string"
          }
        }
      },
      "ReturnPage" : {
        "required" : [ "data", "meta" ],
        "type" : "object",
        "properties" : {
          "data" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/ReturnDto"
            }
          },
          "meta" : {
            "oneOf" : [ {
              "$ref" : "#/components/schemas/FeedMetaDto"
            }, {
              "$ref" : "#/components/schemas/SeqMetaDto"
            } ]
          }
        }
      },
      "ReturnedInvoiceDto" : {
        "required" : [ "id", "number" ],
        "type" : "object",
        "properties" : {
          "external_number" : {
            "type" : "string"
          },
          "external_ref" : {
            "type" : "string"
          },
          "id" : {
            "type" : "string"
          },
          "number" : {
            "type" : "string"
          },
          "seq" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "ReversalDto" : {
        "required" : [ "reason", "reversed_at", "reversed_by" ],
        "type" : "object",
        "properties" : {
          "reason" : {
            "type" : "string"
          },
          "reversed_at" : {
            "type" : "string"
          },
          "reversed_by" : {
            "type" : "string"
          }
        }
      },
      "SeqMetaDto" : {
        "required" : [ "has_more", "last_seq", "per_page" ],
        "type" : "object",
        "properties" : {
          "has_more" : {
            "type" : "boolean"
          },
          "last_seq" : {
            "type" : "integer",
            "format" : "int64"
          },
          "per_page" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "TaxDto" : {
        "required" : [ "amount", "code", "rate" ],
        "type" : "object",
        "properties" : {
          "amount" : {
            "type" : "string"
          },
          "code" : {
            "type" : "string"
          },
          "rate" : {
            "type" : "string"
          }
        }
      },
      "TaxSubmissionDto" : {
        "required" : [ "status" ],
        "type" : "object",
        "properties" : {
          "eta_uuid" : {
            "type" : "string"
          },
          "reason" : {
            "type" : "string"
          },
          "status" : {
            "type" : "string"
          },
          "submitted_at" : {
            "type" : "string"
          }
        }
      },
      "TotalsDto" : {
        "required" : [ "discount", "gross", "net", "subtotal", "tax" ],
        "type" : "object",
        "properties" : {
          "discount" : {
            "type" : "string"
          },
          "gross" : {
            "type" : "string"
          },
          "net" : {
            "type" : "string"
          },
          "subtotal" : {
            "type" : "string"
          },
          "tax" : {
            "type" : "string"
          }
        }
      },
      "UnitPushDto" : {
        "required" : [ "name" ],
        "type" : "object",
        "properties" : {
          "name" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "string"
            }
          },
          "source_version" : {
            "type" : "string"
          }
        }
      }
    },
    "securitySchemes" : {
      "bearer" : {
        "description" : "An integration token, sfi_live_… (the hosted sandbox's too; sfi_test_… only on a copy of Slflo run with the demo seed).",
        "scheme" : "bearer",
        "type" : "http"
      }
    }
  }
}