{
  "openapi": "3.1.0",
  "info": {
    "title": "PeptideTech Merchant API and Webhooks",
    "version": "2026-11-06",
    "description": "Scoped custom backend integration. Live onboarding requires the current signed agreement and owner-managed payouts. The isolated sandbox simulates payments and backend acknowledgement. See /partners/api and the integration guide for the complete backend contract."
  },
  "servers": [
    {
      "url": "https://peptidetech.is"
    }
  ],
  "components": {
    "securitySchemes": {
      "LiveBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "ptk_api_",
        "description": "Store-bound, expiring, revocable token. Available scopes: account:read, catalogue:write, orders:read, orders:write, operations:read, operations:write, tax:read. Never permits wallet or legal changes."
      },
      "TestBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "ptk_test_",
        "description": "Isolated sandbox token, valid 24 hours."
      }
    },
    "schemas": {
      "Product": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "price": {
            "oneOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "string",
                "pattern": "^\\d+(\\.\\d{1,2})?$"
              }
            ]
          },
          "status": {
            "const": "publish"
          },
          "currency": {
            "const": "USD"
          },
          "permalink": {
            "type": "string",
            "format": "uri"
          },
          "stock_status": {
            "enum": [
              "instock",
              "outofstock",
              "onbackorder"
            ]
          },
          "stock_quantity": {
            "type": "integer"
          },
          "sku": {
            "type": "string"
          },
          "attributes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              },
              "required": []
            }
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "description": {
            "type": "string"
          },
          "coa_links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                }
              },
              "required": []
            }
          }
        },
        "required": [
          "id",
          "name",
          "price"
        ]
      },
      "Catalogue": {
        "type": "object",
        "properties": {
          "products": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "price": {
                  "oneOf": [
                    {
                      "type": "number",
                      "minimum": 0
                    },
                    {
                      "type": "string",
                      "pattern": "^\\d+(\\.\\d{1,2})?$"
                    }
                  ]
                },
                "status": {
                  "const": "publish"
                },
                "currency": {
                  "const": "USD"
                },
                "permalink": {
                  "type": "string",
                  "format": "uri"
                },
                "stock_status": {
                  "enum": [
                    "instock",
                    "outofstock",
                    "onbackorder"
                  ]
                },
                "stock_quantity": {
                  "type": "integer"
                },
                "sku": {
                  "type": "string"
                },
                "attributes": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      }
                    },
                    "required": []
                  }
                },
                "categories": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "description": {
                  "type": "string"
                },
                "coa_links": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string"
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "required": []
                  }
                }
              },
              "required": [
                "id",
                "name",
                "price"
              ]
            },
            "maxItems": 250
          },
          "remove": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 250
          }
        },
        "required": []
      },
      "OrderUpdate": {
        "type": "object",
        "properties": {
          "suborder_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "enum": [
              "processing",
              "on-hold",
              "pending",
              "shipped",
              "delivered",
              "cancelled",
              "refunded",
              "failed"
            ]
          },
          "handoff_at": {
            "type": "string",
            "format": "date-time",
            "description": "Required for shipped/delivered, after payment and no later than now. Tracking labels alone are not handoff."
          },
          "order_id": {
            "type": "string"
          },
          "order_number": {
            "type": "string"
          },
          "tracking": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "carrier": {
                  "type": "string"
                },
                "number": {
                  "type": "string"
                },
                "url": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "required": []
            }
          },
          "note": {
            "type": "string"
          }
        },
        "required": [
          "suborder_id",
          "status"
        ]
      },
      "PaidOrder": {
        "type": "object",
        "properties": {
          "suborder_id": {
            "type": "string",
            "format": "uuid"
          },
          "ref": {
            "type": "string"
          },
          "quote_id": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "address": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "line1": {
                "type": "string"
              },
              "line2": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "state": {
                "type": "string"
              },
              "postcode": {
                "type": "string"
              },
              "country": {
                "type": "string"
              },
              "phone": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "line1",
              "city",
              "postcode",
              "country"
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "external_id": {
                  "type": "string"
                },
                "qty": {
                  "type": "integer",
                  "minimum": 1
                },
                "unit_price": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "required": []
            }
          },
          "shipping_method": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "cost": {
                "type": "number",
                "minimum": 0
              }
            },
            "required": []
          },
          "totals": {
            "type": "object",
            "properties": {
              "subtotal": {
                "type": "number",
                "minimum": 0
              },
              "shipping": {
                "type": "number",
                "minimum": 0
              },
              "tax": {
                "type": "number",
                "minimum": 0
              },
              "total": {
                "type": "number",
                "minimum": 0
              }
            },
            "required": []
          },
          "payment": {
            "type": "object",
            "properties": {
              "method": {
                "type": "string"
              },
              "provider": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "coin": {
                "type": "string"
              },
              "txid_in": {
                "type": "string"
              },
              "txid_out": {
                "type": "string"
              },
              "payout_wallet": {
                "type": "string"
              },
              "payout_amount": {
                "type": "number",
                "minimum": 0
              },
              "wallet_amount": {
                "type": "number",
                "minimum": 0
              },
              "guarantee_offset": {
                "type": "number",
                "minimum": 0
              },
              "guarantee_repaid": {
                "type": "number",
                "minimum": 0
              },
              "fee": {
                "type": "number",
                "minimum": 0
              },
              "fee_rate": {
                "type": "number",
                "minimum": 0
              }
            },
            "required": []
          }
        },
        "required": [
          "suborder_id",
          "ref",
          "email",
          "address",
          "items",
          "totals",
          "payment"
        ]
      },
      "Address": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "line1": {
            "type": "string"
          },
          "line2": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "postcode": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "line1",
          "city",
          "postcode",
          "country"
        ]
      }
    }
  },
  "paths": {
    "/api/partners/v2/operations": {
      "get": {
        "summary": "Read own merchant operations and capability limits",
        "x-required-scope": "operations:read",
        "security": [
          {
            "LiveBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "controls": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "accepted": {
                      "type": "boolean"
                    },
                    "capabilities": {
                      "type": "object",
                      "properties": {
                        "automatic_paygate_cash_refunds": {
                          "const": false
                        },
                        "automatic_paygate_debits": {
                          "const": false
                        },
                        "automatic_paygate_dispute_events": {
                          "const": false
                        },
                        "automatic_tax_remittance": {
                          "const": false
                        },
                        "independent_evidence_service_configured": {
                          "type": "boolean"
                        },
                        "limitations": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": []
                    },
                    "cases": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "suborder_id": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "uuid"
                          },
                          "kind": {
                            "enum": [
                              "refund",
                              "dispute",
                              "verification",
                              "tax",
                              "shipping"
                            ]
                          },
                          "status": {
                            "enum": [
                              "action_required",
                              "submitted",
                              "awaiting_verification",
                              "overdue",
                              "verified",
                              "resolved"
                            ]
                          },
                          "subject": {
                            "type": "object",
                            "properties": {},
                            "required": []
                          },
                          "evidence": {
                            "type": [
                              "object",
                              "null"
                            ]
                          },
                          "result": {
                            "type": [
                              "object",
                              "null"
                            ]
                          },
                          "due_at": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "last_error": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "attempts": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "status",
                          "subject"
                        ]
                      }
                    }
                  },
                  "required": [
                    "controls",
                    "accepted",
                    "capabilities",
                    "cases"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/partners/v2/operations/respond": {
      "post": {
        "summary": "Submit unverified evidence; cannot transfer money or approve a case",
        "x-required-scope": "operations:write",
        "security": [
          {
            "LiveBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "case_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "reference": {
                    "type": "string"
                  },
                  "note": {
                    "type": "string"
                  }
                },
                "required": [
                  "case_id",
                  "reference",
                  "note"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "case": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "suborder_id": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uuid"
                        },
                        "kind": {
                          "enum": [
                            "refund",
                            "dispute",
                            "verification",
                            "tax",
                            "shipping"
                          ]
                        },
                        "status": {
                          "enum": [
                            "action_required",
                            "submitted",
                            "awaiting_verification",
                            "overdue",
                            "verified",
                            "resolved"
                          ]
                        },
                        "subject": {
                          "type": "object",
                          "properties": {},
                          "required": []
                        },
                        "evidence": {
                          "type": [
                            "object",
                            "null"
                          ]
                        },
                        "result": {
                          "type": [
                            "object",
                            "null"
                          ]
                        },
                        "due_at": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "updated_at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "last_error": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "attempts": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "id",
                        "kind",
                        "status",
                        "subject"
                      ]
                    },
                    "verified": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "case",
                    "verified"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/partners/v2/tax": {
      "get": {
        "summary": "Read own merchant tax records; not a filing or remittance",
        "x-required-scope": "tax:read",
        "security": [
          {
            "LiveBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "month": {
                      "type": "string"
                    },
                    "responsibility": {
                      "type": "string"
                    },
                    "remittance_verified": {
                      "type": "boolean"
                    },
                    "remittance_evidence": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "tax_total": {
                      "type": "string"
                    },
                    "currency": {
                      "const": "USD"
                    },
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "enum": [
                              "sale",
                              "refund"
                            ]
                          },
                          "reference": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "string"
                          },
                          "currency": {
                            "const": "USD"
                          },
                          "country": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "order_ref": {
                            "type": "string"
                          }
                        },
                        "required": []
                      }
                    }
                  },
                  "required": [
                    "month",
                    "tax_total",
                    "entries",
                    "remittance_verified"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "month",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
            }
          }
        ]
      }
    },
    "/api/partners/v2/account": {
      "get": {
        "summary": "Read own connection status and data-sharing settings",
        "x-required-scope": "account:read",
        "security": [
          {
            "LiveBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "mode": {
                      "const": "live"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "verified": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "string"
                    },
                    "data_settings": {
                      "type": "object",
                      "properties": {
                        "stock": {
                          "enum": [
                            "exact",
                            "status"
                          ]
                        },
                        "descriptions": {
                          "type": "boolean"
                        },
                        "ai_matching": {
                          "type": "boolean"
                        },
                        "order_notes": {
                          "type": "boolean"
                        },
                        "buyer_phone": {
                          "type": "boolean"
                        },
                        "quote_address": {
                          "enum": [
                            "full",
                            "region"
                          ]
                        }
                      },
                      "required": []
                    }
                  },
                  "required": []
                }
              }
            }
          },
          "400": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/partners/v2/catalogue": {
      "post": {
        "summary": "Upsert or remove selected products",
        "x-required-scope": "catalogue:write",
        "security": [
          {
            "LiveBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "products": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "price": {
                          "oneOf": [
                            {
                              "type": "number",
                              "minimum": 0
                            },
                            {
                              "type": "string",
                              "pattern": "^\\d+(\\.\\d{1,2})?$"
                            }
                          ]
                        },
                        "status": {
                          "const": "publish"
                        },
                        "currency": {
                          "const": "USD"
                        },
                        "permalink": {
                          "type": "string",
                          "format": "uri"
                        },
                        "stock_status": {
                          "enum": [
                            "instock",
                            "outofstock",
                            "onbackorder"
                          ]
                        },
                        "stock_quantity": {
                          "type": "integer"
                        },
                        "sku": {
                          "type": "string"
                        },
                        "attributes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              }
                            },
                            "required": []
                          }
                        },
                        "categories": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "description": {
                          "type": "string"
                        },
                        "coa_links": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string"
                              },
                              "text": {
                                "type": "string"
                              }
                            },
                            "required": []
                          }
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "price"
                      ]
                    },
                    "maxItems": 250
                  },
                  "remove": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 250
                  }
                },
                "required": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": []
                }
              }
            }
          },
          "400": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/partners/v2/orders/pending": {
      "get": {
        "summary": "Read own paid unacknowledged orders",
        "x-required-scope": "orders:read",
        "security": [
          {
            "LiveBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "orders": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "suborder_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "ref": {
                            "type": "string"
                          },
                          "quote_id": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string",
                            "format": "email"
                          },
                          "address": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "line1": {
                                "type": "string"
                              },
                              "line2": {
                                "type": "string"
                              },
                              "city": {
                                "type": "string"
                              },
                              "state": {
                                "type": "string"
                              },
                              "postcode": {
                                "type": "string"
                              },
                              "country": {
                                "type": "string"
                              },
                              "phone": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "name",
                              "line1",
                              "city",
                              "postcode",
                              "country"
                            ]
                          },
                          "items": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "external_id": {
                                  "type": "string"
                                },
                                "qty": {
                                  "type": "integer",
                                  "minimum": 1
                                },
                                "unit_price": {
                                  "type": "number",
                                  "minimum": 0
                                }
                              },
                              "required": []
                            }
                          },
                          "shipping_method": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "cost": {
                                "type": "number",
                                "minimum": 0
                              }
                            },
                            "required": []
                          },
                          "totals": {
                            "type": "object",
                            "properties": {
                              "subtotal": {
                                "type": "number",
                                "minimum": 0
                              },
                              "shipping": {
                                "type": "number",
                                "minimum": 0
                              },
                              "tax": {
                                "type": "number",
                                "minimum": 0
                              },
                              "total": {
                                "type": "number",
                                "minimum": 0
                              }
                            },
                            "required": []
                          },
                          "payment": {
                            "type": "object",
                            "properties": {
                              "method": {
                                "type": "string"
                              },
                              "provider": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "coin": {
                                "type": "string"
                              },
                              "txid_in": {
                                "type": "string"
                              },
                              "txid_out": {
                                "type": "string"
                              },
                              "payout_wallet": {
                                "type": "string"
                              },
                              "payout_amount": {
                                "type": "number",
                                "minimum": 0
                              },
                              "wallet_amount": {
                                "type": "number",
                                "minimum": 0
                              },
                              "guarantee_offset": {
                                "type": "number",
                                "minimum": 0
                              },
                              "guarantee_repaid": {
                                "type": "number",
                                "minimum": 0
                              },
                              "fee": {
                                "type": "number",
                                "minimum": 0
                              },
                              "fee_rate": {
                                "type": "number",
                                "minimum": 0
                              }
                            },
                            "required": []
                          }
                        },
                        "required": [
                          "suborder_id",
                          "ref",
                          "email",
                          "address",
                          "items",
                          "totals",
                          "payment"
                        ]
                      }
                    }
                  },
                  "required": []
                }
              }
            }
          },
          "400": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/partners/v2/orders/ack": {
      "post": {
        "summary": "Acknowledge an order idempotently",
        "x-required-scope": "orders:write",
        "security": [
          {
            "LiveBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "suborder_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "order_id": {
                    "type": "string"
                  },
                  "order_number": {
                    "type": "string"
                  }
                },
                "required": [
                  "suborder_id",
                  "order_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": []
                }
              }
            }
          },
          "400": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/partners/v2/events": {
      "post": {
        "summary": "Submit signed merchant events",
        "x-required-scope": "Permission depends on event type",
        "security": [
          {
            "LiveBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{16,100}$"
                      },
                      "type": {
                        "const": "catalogue.upsert"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "products": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "price": {
                                  "oneOf": [
                                    {
                                      "type": "number",
                                      "minimum": 0
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^\\d+(\\.\\d{1,2})?$"
                                    }
                                  ]
                                },
                                "status": {
                                  "const": "publish"
                                },
                                "currency": {
                                  "const": "USD"
                                },
                                "permalink": {
                                  "type": "string",
                                  "format": "uri"
                                },
                                "stock_status": {
                                  "enum": [
                                    "instock",
                                    "outofstock",
                                    "onbackorder"
                                  ]
                                },
                                "stock_quantity": {
                                  "type": "integer"
                                },
                                "sku": {
                                  "type": "string"
                                },
                                "attributes": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "name": {
                                        "type": "string"
                                      },
                                      "value": {
                                        "type": "string"
                                      }
                                    },
                                    "required": []
                                  }
                                },
                                "categories": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "description": {
                                  "type": "string"
                                },
                                "coa_links": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "url": {
                                        "type": "string"
                                      },
                                      "text": {
                                        "type": "string"
                                      }
                                    },
                                    "required": []
                                  }
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "price"
                              ]
                            },
                            "maxItems": 250
                          },
                          "remove": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "maxItems": 250
                          }
                        },
                        "required": []
                      }
                    },
                    "required": [
                      "id",
                      "type",
                      "data"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{16,100}$"
                      },
                      "type": {
                        "const": "order.updated"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "suborder_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "status": {
                            "enum": [
                              "processing",
                              "on-hold",
                              "pending",
                              "shipped",
                              "delivered",
                              "cancelled",
                              "refunded",
                              "failed"
                            ]
                          },
                          "handoff_at": {
                            "type": "string",
                            "format": "date-time",
                            "description": "Required for shipped/delivered, after payment and no later than now. Tracking labels alone are not handoff."
                          },
                          "order_id": {
                            "type": "string"
                          },
                          "order_number": {
                            "type": "string"
                          },
                          "tracking": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "carrier": {
                                  "type": "string"
                                },
                                "number": {
                                  "type": "string"
                                },
                                "url": {
                                  "type": "string",
                                  "format": "uri"
                                }
                              },
                              "required": []
                            }
                          },
                          "note": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "suborder_id",
                          "status"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "type",
                      "data"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{16,100}$"
                      },
                      "type": {
                        "const": "heartbeat"
                      },
                      "data": {
                        "type": "object",
                        "properties": {},
                        "required": []
                      }
                    },
                    "required": [
                      "id",
                      "type",
                      "data"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{16,100}$"
                      },
                      "type": {
                        "const": "case.responded"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "case_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "reference": {
                            "type": "string"
                          },
                          "note": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "case_id",
                          "reference",
                          "note"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "type",
                      "data"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": []
                }
              }
            }
          },
          "400": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "header",
            "name": "x-peptidetech-timestamp",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Unix seconds within five minutes"
          },
          {
            "in": "header",
            "name": "x-peptidetech-nonce",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Equal to the event id"
          },
          {
            "in": "header",
            "name": "x-peptidetech-signature",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Hex HMAC-SHA256(secret, timestamp.nonce.METHOD.path.sha256hex(raw body)). Exact path and bytes."
          }
        ],
        "description": "catalogue.upsert: catalogue:write. order.updated: orders:write. heartbeat: account:read. Stable ids; duplicate completed events return the prior result. Changed body or processing event returns 409. Receipt retention 90 days."
      }
    },
    "/api/partners/sandbox": {
      "post": {
        "summary": "Create isolated demo session",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": []
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "One-time ptk_test_ key and signing secret, fictional state and expiry",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "api_key": {
                      "type": "string"
                    },
                    "signing_secret": {
                      "type": "string"
                    },
                    "mode": {
                      "const": "sandbox"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "orders": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {},
                        "required": []
                      }
                    },
                    "products": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "price": {
                            "oneOf": [
                              {
                                "type": "number",
                                "minimum": 0
                              },
                              {
                                "type": "string",
                                "pattern": "^\\d+(\\.\\d{1,2})?$"
                              }
                            ]
                          },
                          "status": {
                            "const": "publish"
                          },
                          "currency": {
                            "const": "USD"
                          },
                          "permalink": {
                            "type": "string",
                            "format": "uri"
                          },
                          "stock_status": {
                            "enum": [
                              "instock",
                              "outofstock",
                              "onbackorder"
                            ]
                          },
                          "stock_quantity": {
                            "type": "integer"
                          },
                          "sku": {
                            "type": "string"
                          },
                          "attributes": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                }
                              },
                              "required": []
                            }
                          },
                          "categories": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "description": {
                            "type": "string"
                          },
                          "coa_links": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "url": {
                                  "type": "string"
                                },
                                "text": {
                                  "type": "string"
                                }
                              },
                              "required": []
                            }
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "price"
                        ]
                      }
                    }
                  },
                  "required": []
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "security": []
      },
      "get": {
        "summary": "Read own demo session",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": []
                }
              }
            }
          },
          "400": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "TestBearer": []
          }
        ]
      }
    },
    "/api/partners/sandbox/catalogue": {
      "post": {
        "summary": "Replace fictional limited catalogue",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "products": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "price": {
                          "oneOf": [
                            {
                              "type": "number",
                              "minimum": 0
                            },
                            {
                              "type": "string",
                              "pattern": "^\\d+(\\.\\d{1,2})?$"
                            }
                          ]
                        },
                        "status": {
                          "const": "publish"
                        },
                        "currency": {
                          "const": "USD"
                        },
                        "permalink": {
                          "type": "string",
                          "format": "uri"
                        },
                        "stock_status": {
                          "enum": [
                            "instock",
                            "outofstock",
                            "onbackorder"
                          ]
                        },
                        "stock_quantity": {
                          "type": "integer"
                        },
                        "sku": {
                          "type": "string"
                        },
                        "attributes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              }
                            },
                            "required": []
                          }
                        },
                        "categories": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "description": {
                          "type": "string"
                        },
                        "coa_links": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string"
                              },
                              "text": {
                                "type": "string"
                              }
                            },
                            "required": []
                          }
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "price"
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 50
                  }
                },
                "required": [
                  "products"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": []
                }
              }
            }
          },
          "400": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "TestBearer": []
          }
        ]
      }
    },
    "/api/partners/sandbox/orders": {
      "post": {
        "summary": "Create fictional paid order with simulated backend acknowledgement",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "product_id": {
                    "type": "string"
                  }
                },
                "required": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": []
                }
              }
            }
          },
          "400": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "TestBearer": []
          }
        ]
      }
    },
    "/api/partners/sandbox/events": {
      "post": {
        "summary": "Submit signed fictional shipment/refund events",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{16,100}$"
                      },
                      "type": {
                        "const": "order.updated"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "suborder_id": {
                            "type": "string",
                            "description": "The sandbox order id (order_id is also accepted)"
                          },
                          "status": {
                            "enum": [
                              "shipped",
                              "delivered"
                            ]
                          },
                          "handoff_at": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "tracking": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "carrier": {
                                  "type": "string"
                                },
                                "number": {
                                  "type": "string"
                                },
                                "url": {
                                  "type": "string",
                                  "format": "uri"
                                }
                              },
                              "required": []
                            }
                          }
                        },
                        "required": [
                          "suborder_id",
                          "status",
                          "handoff_at"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "type",
                      "data"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{16,100}$"
                      },
                      "type": {
                        "const": "order.shipped"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "order_id": {
                            "type": "string"
                          },
                          "handoff_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "order_id"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "type",
                      "data"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{16,100}$"
                      },
                      "type": {
                        "const": "clock.advance"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "order_id": {
                            "type": "string"
                          },
                          "handoff_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "order_id"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "type",
                      "data"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9_-]{16,100}$"
                      },
                      "type": {
                        "const": "refund.recorded"
                      },
                      "data": {
                        "type": "object",
                        "properties": {
                          "order_id": {
                            "type": "string"
                          },
                          "handoff_at": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "order_id"
                        ]
                      }
                    },
                    "required": [
                      "id",
                      "type",
                      "data"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  },
                  "required": []
                }
              }
            }
          },
          "400": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "header",
            "name": "x-peptidetech-timestamp",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Unix seconds within five minutes"
          },
          {
            "in": "header",
            "name": "x-peptidetech-nonce",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Equal to the event id"
          },
          {
            "in": "header",
            "name": "x-peptidetech-signature",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Hex HMAC-SHA256(secret, timestamp.nonce.METHOD.path.sha256hex(raw body)). Exact path and bytes."
          }
        ],
        "security": [
          {
            "TestBearer": []
          }
        ]
      }
    },
    "/api/partners/sandbox/backend-test": {
      "post": {
        "summary": "Send signed sample requests to your own backend with the sandbox secret and report each check. Fictional data; not live verification.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "base_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Public HTTPS base URL; /verify, /quote, /webhooks and /orders/{id} are appended"
                  },
                  "product_id": {
                    "type": "string",
                    "description": "Sandbox product to quote and order; defaults to the first"
                  }
                },
                "required": [
                  "base_url"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "backend_test": {
                      "type": "object",
                      "properties": {
                        "base_url": {
                          "type": "string"
                        },
                        "at": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "passed": {
                          "type": "boolean"
                        },
                        "counts": {
                          "type": "object",
                          "properties": {
                            "pass": {
                              "type": "integer"
                            },
                            "warn": {
                              "type": "integer"
                            },
                            "fail": {
                              "type": "integer"
                            },
                            "skipped": {
                              "type": "integer"
                            }
                          },
                          "required": []
                        },
                        "steps": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "key": {
                                "enum": [
                                  "verify",
                                  "quote-empty",
                                  "quote-item",
                                  "integration-test",
                                  "bad-signature",
                                  "order-paid",
                                  "order-paid-retry",
                                  "order-status"
                                ]
                              },
                              "label": {
                                "type": "string"
                              },
                              "result": {
                                "enum": [
                                  "pass",
                                  "warn",
                                  "fail",
                                  "skipped"
                                ]
                              },
                              "detail": {
                                "type": "string"
                              },
                              "status": {
                                "type": [
                                  "integer",
                                  "null"
                                ]
                              },
                              "ms": {
                                "type": "integer"
                              },
                              "request": {
                                "type": "object",
                                "properties": {
                                  "method": {
                                    "type": "string"
                                  },
                                  "path": {
                                    "type": "string"
                                  },
                                  "body": {
                                    "type": "string"
                                  },
                                  "headers": {
                                    "type": "object",
                                    "properties": {},
                                    "required": []
                                  }
                                },
                                "required": []
                              },
                              "response": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "key",
                              "label",
                              "result"
                            ]
                          }
                        }
                      },
                      "required": [
                        "passed",
                        "steps"
                      ]
                    }
                  },
                  "required": []
                }
              }
            }
          },
          "400": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "JSON error with error and, where useful, a stable code. Signed-event refusals use bad_timestamp, expired_timestamp (with server_time), bad_event_id, event_id_mismatch or bad_signature; bad_signature adds what PeptideTech signed (never the secret).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "server_time": {
                      "type": "integer"
                    },
                    "signed": {
                      "type": "object",
                      "properties": {
                        "method": {
                          "type": "string"
                        },
                        "path": {
                          "type": "string"
                        },
                        "body_sha256": {
                          "type": "string"
                        },
                        "string_to_sign": {
                          "type": "string"
                        }
                      },
                      "required": []
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "TestBearer": []
          }
        ]
      }
    }
  },
  "webhooks": {
    "orderPaid": {
      "post": {
        "summary": "PeptideTech calls merchant BASE/webhooks after payment",
        "description": "Exact receiver URL is configured by the owner. Signed with the shared secret and stable event id. Retry 1,5,15,60 minutes then every 6 hours; also accessible through the pending-order fallback. Acknowledge processing only; report actual handoff separately.",
        "parameters": [
          {
            "in": "header",
            "name": "x-peptidetech-timestamp",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Unix seconds within five minutes"
          },
          {
            "in": "header",
            "name": "x-peptidetech-nonce",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Equal to the event id"
          },
          {
            "in": "header",
            "name": "x-peptidetech-signature",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Hex HMAC-SHA256(secret, timestamp.nonce.METHOD.path.sha256hex(raw body)). Exact path and bytes."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "type": {
                    "const": "order.paid"
                  },
                  "version": {
                    "const": "2026-11-06"
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "suborder_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "ref": {
                        "type": "string"
                      },
                      "quote_id": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string",
                        "format": "email"
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "line1": {
                            "type": "string"
                          },
                          "line2": {
                            "type": "string"
                          },
                          "city": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          },
                          "postcode": {
                            "type": "string"
                          },
                          "country": {
                            "type": "string"
                          },
                          "phone": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "name",
                          "line1",
                          "city",
                          "postcode",
                          "country"
                        ]
                      },
                      "items": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "external_id": {
                              "type": "string"
                            },
                            "qty": {
                              "type": "integer",
                              "minimum": 1
                            },
                            "unit_price": {
                              "type": "number",
                              "minimum": 0
                            }
                          },
                          "required": []
                        }
                      },
                      "shipping_method": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "cost": {
                            "type": "number",
                            "minimum": 0
                          }
                        },
                        "required": []
                      },
                      "totals": {
                        "type": "object",
                        "properties": {
                          "subtotal": {
                            "type": "number",
                            "minimum": 0
                          },
                          "shipping": {
                            "type": "number",
                            "minimum": 0
                          },
                          "tax": {
                            "type": "number",
                            "minimum": 0
                          },
                          "total": {
                            "type": "number",
                            "minimum": 0
                          }
                        },
                        "required": []
                      },
                      "payment": {
                        "type": "object",
                        "properties": {
                          "method": {
                            "type": "string"
                          },
                          "provider": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "coin": {
                            "type": "string"
                          },
                          "txid_in": {
                            "type": "string"
                          },
                          "txid_out": {
                            "type": "string"
                          },
                          "payout_wallet": {
                            "type": "string"
                          },
                          "payout_amount": {
                            "type": "number",
                            "minimum": 0
                          },
                          "wallet_amount": {
                            "type": "number",
                            "minimum": 0
                          },
                          "guarantee_offset": {
                            "type": "number",
                            "minimum": 0
                          },
                          "guarantee_repaid": {
                            "type": "number",
                            "minimum": 0
                          },
                          "fee": {
                            "type": "number",
                            "minimum": 0
                          },
                          "fee_rate": {
                            "type": "number",
                            "minimum": 0
                          }
                        },
                        "required": []
                      }
                    },
                    "required": [
                      "suborder_id",
                      "ref",
                      "email",
                      "address",
                      "items",
                      "totals",
                      "payment"
                    ]
                  }
                },
                "required": [
                  "id",
                  "type",
                  "data"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Order created or already present",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "order_id": {
                      "type": "string"
                    },
                    "order_number": {
                      "type": "string"
                    },
                    "status": {
                      "const": "processing"
                    }
                  },
                  "required": [
                    "order_id",
                    "status"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "merchantOperation": {
      "post": {
        "summary": "Signed merchant operation request on the owner-authorized backend",
        "description": "Acknowledgement is not a paid refund or verified evidence. Persist event and underlying case/order idempotency.",
        "parameters": [
          {
            "in": "header",
            "name": "x-peptidetech-timestamp",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Unix seconds within five minutes"
          },
          {
            "in": "header",
            "name": "x-peptidetech-nonce",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Equal to the event id"
          },
          {
            "in": "header",
            "name": "x-peptidetech-signature",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Hex HMAC-SHA256(secret, timestamp.nonce.METHOD.path.sha256hex(raw body)). Exact path and bytes."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "type": {
                    "enum": [
                      "refund.requested",
                      "dispute.requested",
                      "tax.requested",
                      "verification.requested"
                    ]
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "suborder_id": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "uuid"
                      },
                      "kind": {
                        "enum": [
                          "refund",
                          "dispute",
                          "verification",
                          "tax",
                          "shipping"
                        ]
                      },
                      "status": {
                        "enum": [
                          "action_required",
                          "submitted",
                          "awaiting_verification",
                          "overdue",
                          "verified",
                          "resolved"
                        ]
                      },
                      "subject": {
                        "type": "object",
                        "properties": {},
                        "required": []
                      },
                      "evidence": {
                        "type": [
                          "object",
                          "null"
                        ]
                      },
                      "result": {
                        "type": [
                          "object",
                          "null"
                        ]
                      },
                      "due_at": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time"
                      },
                      "updated_at": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "last_error": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "attempts": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "id",
                      "kind",
                      "status",
                      "subject"
                    ]
                  }
                },
                "required": [
                  "id",
                  "type",
                  "data"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Receipt only",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "event_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "event_id"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}
