{
  "openapi": "3.1.0",
  "info": {
    "title": "B7R API",
    "version": "v1",
    "description": "Print on demand under your brand. Guides: https://docs.b7r.app. Errors: https://docs.b7r.app/errors."
  },
  "servers": [
    {
      "url": "https://api.b7r.app/v1"
    }
  ],
  "paths": {
    "/status": {
      "get": {
        "operationId": "getStatus",
        "summary": "Whether the Custom API answers and is switched on",
        "parameters": [
          {
            "name": "Accept-Language",
            "in": "header",
            "required": false,
            "description": "ar for Arabic error titles; anything else gives English.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "ok"
                    },
                    "api_enabled": {
                      "type": "boolean"
                    },
                    "time": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
                    }
                  },
                  "required": [
                    "status",
                    "api_enabled",
                    "time"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "upstream_unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "request_expired, service_unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "upstream_timeout",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/me": {
      "get": {
        "operationId": "getMe",
        "summary": "The calling key, its account, limits and default carrier",
        "parameters": [
          {
            "name": "Accept-Language",
            "in": "header",
            "required": false,
            "description": "ar for Arabic error titles; anything else gives English.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerKey": []
          },
          {
            "headerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "account": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "store_name": {
                          "type": "string"
                        },
                        "verified": {
                          "type": "boolean"
                        },
                        "active": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "id",
                        "store_name",
                        "verified",
                        "active"
                      ]
                    },
                    "key": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "prefix": {
                          "type": "string"
                        },
                        "areas": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "catalog",
                              "products:read",
                              "products:write",
                              "orders:read",
                              "orders:write",
                              "wallet:read"
                            ]
                          }
                        },
                        "expires_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "name",
                        "prefix",
                        "areas",
                        "expires_at"
                      ]
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "calls_per_minute": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "calls_per_minute"
                      ]
                    },
                    "switches": {
                      "type": "object",
                      "properties": {
                        "api_enabled": {
                          "type": "boolean",
                          "const": true
                        },
                        "connection_enabled": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "api_enabled",
                        "connection_enabled"
                      ]
                    },
                    "default_carrier": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "name": {
                              "type": "object",
                              "properties": {
                                "ar": {
                                  "type": "string"
                                },
                                "en": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "ar",
                                "en"
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "account",
                    "key",
                    "limits",
                    "switches",
                    "default_carrier"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "account_inactive, connection_disabled",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "upstream_unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "api_unavailable, request_expired, service_unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "upstream_timeout",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/catalog/products": {
      "get": {
        "operationId": "listCatalogProducts",
        "summary": "The base products you can order, with their options and costs",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,3}$"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            }
          },
          {
            "name": "updated_since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,9})?Z$"
            }
          },
          {
            "name": "Accept-Language",
            "in": "header",
            "required": false,
            "description": "ar for Arabic error titles; anything else gives English.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerKey": []
          },
          {
            "headerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "name": {
                            "type": "object",
                            "properties": {
                              "ar": {
                                "type": "string"
                              },
                              "en": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "ar",
                              "en"
                            ]
                          },
                          "colors": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                },
                                "name": {
                                  "type": "object",
                                  "properties": {
                                    "ar": {
                                      "type": "string"
                                    },
                                    "en": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "ar",
                                    "en"
                                  ]
                                },
                                "hex": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "hex"
                              ]
                            }
                          },
                          "sizes": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ]
                            }
                          },
                          "techniques": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                },
                                "name": {
                                  "type": "object",
                                  "properties": {
                                    "ar": {
                                      "type": "string"
                                    },
                                    "en": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "ar",
                                    "en"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ]
                            }
                          },
                          "zones": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                },
                                "name": {
                                  "type": "object",
                                  "properties": {
                                    "ar": {
                                      "type": "string"
                                    },
                                    "en": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "ar",
                                    "en"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ]
                            }
                          },
                          "options": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "technique_id": {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                },
                                "zone_ids": {
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                  }
                                },
                                "cost": {
                                  "type": "object",
                                  "properties": {
                                    "net": {
                                      "type": "string",
                                      "pattern": "^\\d+\\.\\d{2}$"
                                    },
                                    "vat": {
                                      "type": "string",
                                      "pattern": "^\\d+\\.\\d{2}$"
                                    },
                                    "gross": {
                                      "type": "string",
                                      "pattern": "^\\d+\\.\\d{2}$"
                                    },
                                    "currency": {
                                      "type": "string",
                                      "const": "SAR"
                                    }
                                  },
                                  "required": [
                                    "net",
                                    "vat",
                                    "gross",
                                    "currency"
                                  ]
                                },
                                "minimum_selling_price": {
                                  "type": "object",
                                  "properties": {
                                    "amount": {
                                      "type": "string",
                                      "pattern": "^\\d+\\.\\d{2}$"
                                    },
                                    "currency": {
                                      "type": "string",
                                      "const": "SAR"
                                    }
                                  },
                                  "required": [
                                    "amount",
                                    "currency"
                                  ]
                                }
                              },
                              "required": [
                                "technique_id",
                                "zone_ids",
                                "cost",
                                "minimum_selling_price"
                              ]
                            }
                          },
                          "updated_at": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "colors",
                          "sizes",
                          "techniques",
                          "zones",
                          "options",
                          "updated_at"
                        ]
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "area_forbidden, account_inactive, connection_disabled",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "upstream_unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "api_unavailable, request_expired, service_unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "upstream_timeout",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-b7r-area": "catalog"
      }
    },
    "/catalog/products/{id}": {
      "get": {
        "operationId": "getCatalogProduct",
        "summary": "One base product, with its options and costs",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Accept-Language",
            "in": "header",
            "required": false,
            "description": "ar for Arabic error titles; anything else gives English.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerKey": []
          },
          {
            "headerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "name": {
                      "type": "object",
                      "properties": {
                        "ar": {
                          "type": "string"
                        },
                        "en": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "ar",
                        "en"
                      ]
                    },
                    "colors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "name": {
                            "type": "object",
                            "properties": {
                              "ar": {
                                "type": "string"
                              },
                              "en": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "ar",
                              "en"
                            ]
                          },
                          "hex": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "hex"
                        ]
                      }
                    },
                    "sizes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ]
                      }
                    },
                    "techniques": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "name": {
                            "type": "object",
                            "properties": {
                              "ar": {
                                "type": "string"
                              },
                              "en": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "ar",
                              "en"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ]
                      }
                    },
                    "zones": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "name": {
                            "type": "object",
                            "properties": {
                              "ar": {
                                "type": "string"
                              },
                              "en": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "ar",
                              "en"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ]
                      }
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "technique_id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "zone_ids": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            }
                          },
                          "cost": {
                            "type": "object",
                            "properties": {
                              "net": {
                                "type": "string",
                                "pattern": "^\\d+\\.\\d{2}$"
                              },
                              "vat": {
                                "type": "string",
                                "pattern": "^\\d+\\.\\d{2}$"
                              },
                              "gross": {
                                "type": "string",
                                "pattern": "^\\d+\\.\\d{2}$"
                              },
                              "currency": {
                                "type": "string",
                                "const": "SAR"
                              }
                            },
                            "required": [
                              "net",
                              "vat",
                              "gross",
                              "currency"
                            ]
                          },
                          "minimum_selling_price": {
                            "type": "object",
                            "properties": {
                              "amount": {
                                "type": "string",
                                "pattern": "^\\d+\\.\\d{2}$"
                              },
                              "currency": {
                                "type": "string",
                                "const": "SAR"
                              }
                            },
                            "required": [
                              "amount",
                              "currency"
                            ]
                          }
                        },
                        "required": [
                          "technique_id",
                          "zone_ids",
                          "cost",
                          "minimum_selling_price"
                        ]
                      }
                    },
                    "updated_at": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "colors",
                    "sizes",
                    "techniques",
                    "zones",
                    "options",
                    "updated_at"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "area_forbidden, account_inactive, connection_disabled",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "not_found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "upstream_unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "api_unavailable, request_expired, service_unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "upstream_timeout",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-b7r-area": "catalog"
      }
    },
    "/carriers": {
      "get": {
        "operationId": "listCarriers",
        "summary": "The active shipping carriers and their fees",
        "parameters": [
          {
            "name": "Accept-Language",
            "in": "header",
            "required": false,
            "description": "ar for Arabic error titles; anything else gives English.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerKey": []
          },
          {
            "headerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "name": {
                            "type": "object",
                            "properties": {
                              "ar": {
                                "type": "string"
                              },
                              "en": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "ar",
                              "en"
                            ]
                          },
                          "fee": {
                            "type": "object",
                            "properties": {
                              "net": {
                                "type": "string",
                                "pattern": "^\\d+\\.\\d{2}$"
                              },
                              "vat": {
                                "type": "string",
                                "pattern": "^\\d+\\.\\d{2}$"
                              },
                              "gross": {
                                "type": "string",
                                "pattern": "^\\d+\\.\\d{2}$"
                              },
                              "currency": {
                                "type": "string",
                                "const": "SAR"
                              }
                            },
                            "required": [
                              "net",
                              "vat",
                              "gross",
                              "currency"
                            ]
                          },
                          "delivery_method": {
                            "type": "string",
                            "enum": [
                              "home",
                              "pickup"
                            ]
                          },
                          "eta_days": {
                            "type": "object",
                            "properties": {
                              "min": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "max": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "min",
                              "max"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "fee",
                          "delivery_method",
                          "eta_days"
                        ]
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "area_forbidden, account_inactive, connection_disabled",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "upstream_unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "api_unavailable, request_expired, service_unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "upstream_timeout",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-b7r-area": "catalog"
      }
    },
    "/quote": {
      "post": {
        "operationId": "createQuote",
        "summary": "What an order of one product would cost you",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A new value per operation, the same value on its retries.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{1,255}$"
            }
          },
          {
            "name": "Accept-Language",
            "in": "header",
            "required": false,
            "description": "ar for Arabic error titles; anything else gives English.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerKey": []
          },
          {
            "headerKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "product_id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "technique_id": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    "zone_ids": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      }
                    },
                    "quantity": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "unit_cost": {
                      "type": "object",
                      "properties": {
                        "net": {
                          "type": "string",
                          "pattern": "^\\d+\\.\\d{2}$"
                        },
                        "vat": {
                          "type": "string",
                          "pattern": "^\\d+\\.\\d{2}$"
                        },
                        "gross": {
                          "type": "string",
                          "pattern": "^\\d+\\.\\d{2}$"
                        },
                        "currency": {
                          "type": "string",
                          "const": "SAR"
                        }
                      },
                      "required": [
                        "net",
                        "vat",
                        "gross",
                        "currency"
                      ]
                    },
                    "lines_total": {
                      "type": "object",
                      "properties": {
                        "net": {
                          "type": "string",
                          "pattern": "^\\d+\\.\\d{2}$"
                        },
                        "vat": {
                          "type": "string",
                          "pattern": "^\\d+\\.\\d{2}$"
                        },
                        "gross": {
                          "type": "string",
                          "pattern": "^\\d+\\.\\d{2}$"
                        },
                        "currency": {
                          "type": "string",
                          "const": "SAR"
                        }
                      },
                      "required": [
                        "net",
                        "vat",
                        "gross",
                        "currency"
                      ]
                    },
                    "shipping": {
                      "type": "object",
                      "properties": {
                        "carrier_id": {
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "fee": {
                          "type": "object",
                          "properties": {
                            "net": {
                              "type": "string",
                              "pattern": "^\\d+\\.\\d{2}$"
                            },
                            "vat": {
                              "type": "string",
                              "pattern": "^\\d+\\.\\d{2}$"
                            },
                            "gross": {
                              "type": "string",
                              "pattern": "^\\d+\\.\\d{2}$"
                            },
                            "currency": {
                              "type": "string",
                              "const": "SAR"
                            }
                          },
                          "required": [
                            "net",
                            "vat",
                            "gross",
                            "currency"
                          ]
                        }
                      },
                      "required": [
                        "carrier_id",
                        "fee"
                      ]
                    },
                    "total": {
                      "type": "object",
                      "properties": {
                        "net": {
                          "type": "string",
                          "pattern": "^\\d+\\.\\d{2}$"
                        },
                        "vat": {
                          "type": "string",
                          "pattern": "^\\d+\\.\\d{2}$"
                        },
                        "gross": {
                          "type": "string",
                          "pattern": "^\\d+\\.\\d{2}$"
                        },
                        "currency": {
                          "type": "string",
                          "const": "SAR"
                        }
                      },
                      "required": [
                        "net",
                        "vat",
                        "gross",
                        "currency"
                      ]
                    },
                    "minimum_selling_price": {
                      "type": "object",
                      "properties": {
                        "amount": {
                          "type": "string",
                          "pattern": "^\\d+\\.\\d{2}$"
                        },
                        "currency": {
                          "type": "string",
                          "const": "SAR"
                        }
                      },
                      "required": [
                        "amount",
                        "currency"
                      ]
                    }
                  },
                  "required": [
                    "product_id",
                    "technique_id",
                    "zone_ids",
                    "quantity",
                    "unit_cost",
                    "lines_total",
                    "shipping",
                    "total",
                    "minimum_selling_price"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "invalid_request, idempotency_key_required",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "area_forbidden, account_inactive, connection_disabled",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "request_too_large",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "415": {
            "description": "unsupported_media_type",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "internal_error",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "502": {
            "description": "upstream_unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "api_unavailable, request_expired, service_unavailable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "504": {
            "description": "upstream_timeout",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-b7r-area": "catalog",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "product_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "technique_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "zone_ids": {
                    "minItems": 1,
                    "maxItems": 2,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    }
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 999
                  },
                  "carrier_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  }
                },
                "required": [
                  "product_id",
                  "technique_id",
                  "zone_ids",
                  "quantity"
                ]
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authorization: Bearer b7r_live_..."
      },
      "headerKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-B7R-Key"
      }
    },
    "schemas": {
      "Problem": {
        "type": "object",
        "required": [
          "type",
          "title",
          "status",
          "code",
          "retryable",
          "request_id"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "The code's row on https://docs.b7r.app/errors."
          },
          "title": {
            "type": "string",
            "description": "A short message in the Accept-Language locale (ar or en)."
          },
          "status": {
            "type": "integer"
          },
          "code": {
            "type": "string",
            "enum": [
              "unauthorized",
              "area_forbidden",
              "account_inactive",
              "connection_disabled",
              "not_found",
              "method_not_allowed",
              "invalid_request",
              "idempotency_key_required",
              "request_too_large",
              "unsupported_media_type",
              "rate_limited",
              "internal_error",
              "upstream_unavailable",
              "api_unavailable",
              "request_expired",
              "service_unavailable",
              "upstream_timeout"
            ],
            "description": "Stable, never translated."
          },
          "retryable": {
            "type": "boolean",
            "description": "True only when the same request may succeed later."
          },
          "request_id": {
            "type": "string",
            "description": "Also sent as the X-Request-Id header."
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "code"
              ],
              "properties": {
                "pointer": {
                  "type": "string",
                  "description": "A JSON Pointer into the body or the query."
                },
                "line": {
                  "type": "integer"
                },
                "code": {
                  "type": "string",
                  "enum": [
                    "required",
                    "unknown_field",
                    "invalid_type",
                    "invalid_value",
                    "too_small",
                    "too_large",
                    "invalid_cursor",
                    "unknown_product",
                    "unknown_technique",
                    "unknown_zone",
                    "unknown_carrier",
                    "missing_area"
                  ]
                },
                "message": {
                  "type": "string"
                },
                "valid_values": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
