{
    "openapi": "3.1.0",
    "info": {
        "title": "B2B Service",
        "description": "Purchase requests API for legal entity client users.",
        "license": {
            "name": "MIT",
            "url": "https://opensource.org/licenses/MIT"
        },
        "version": "1.0.0"
    },
    "paths": {
        "/v1/organizations": {
            "get": {
                "tags": [
                    "organizations"
                ],
                "summary": "Get Organization",
                "operationId": "get_organization_v1_organizations_get",
                "responses": {
                    "200": {
                        "description": "Successful Response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/OrganizationResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/organizations/wallets": {
            "get": {
                "tags": [
                    "organizations"
                ],
                "summary": "List Organization Wallets",
                "operationId": "list_organization_wallets_v1_organizations_wallets_get",
                "responses": {
                    "200": {
                        "description": "Successful Response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/WalletResponse"
                                    },
                                    "type": "array",
                                    "title": "Response List Organization Wallets V1 Organizations Wallets Get"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/organizations/wallets/mnemonic": {
            "get": {
                "tags": [
                    "organizations"
                ],
                "summary": "Get Organization Mnemonic",
                "operationId": "get_organization_mnemonic_v1_organizations_wallets_mnemonic_get",
                "responses": {
                    "200": {
                        "description": "Successful Response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/MnemonicResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/organizations/wallets/secret-keys": {
            "get": {
                "tags": [
                    "organizations"
                ],
                "summary": "Get Organization Secret Keys",
                "operationId": "get_organization_secret_keys_v1_organizations_wallets_secret_keys_get",
                "responses": {
                    "200": {
                        "description": "Successful Response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "items": {
                                        "$ref": "#/components/schemas/SecretKeyResponse"
                                    },
                                    "type": "array",
                                    "title": "Response Get Organization Secret Keys V1 Organizations Wallets Secret Keys Get"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/purchase-requests": {
            "post": {
                "tags": [
                    "purchase-requests"
                ],
                "summary": "Create Purchase Request",
                "operationId": "create_purchase_request_purchase_requests_post",
                "parameters": [
                    {
                        "name": "X-CSRF-Token",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "title": "X-Csrf-Token"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CreatePurchaseRequestBody"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Successful Response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PurchaseRequestResponse"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/HTTPValidationError"
                                }
                            }
                        }
                    }
                }
            },
            "get": {
                "tags": [
                    "purchase-requests"
                ],
                "summary": "List Purchase Requests",
                "operationId": "list_purchase_requests_purchase_requests_get",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "title": "Status"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "maximum": 200,
                            "minimum": 1,
                            "default": 50,
                            "title": "Limit"
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 0,
                            "default": 0,
                            "title": "Offset"
                        }
                    },
                    {
                        "name": "X-CSRF-Token",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "title": "X-Csrf-Token"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful Response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PurchaseRequestListResponse"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/HTTPValidationError"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/purchase-requests/{request_id}": {
            "get": {
                "tags": [
                    "purchase-requests"
                ],
                "summary": "Get Purchase Request",
                "operationId": "get_purchase_request_purchase_requests__request_id__get",
                "parameters": [
                    {
                        "name": "request_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "title": "Request Id"
                        }
                    },
                    {
                        "name": "X-CSRF-Token",
                        "in": "header",
                        "required": false,
                        "schema": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ],
                            "title": "X-Csrf-Token"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful Response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PurchaseRequestResponse"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation Error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/HTTPValidationError"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/ping": {
            "post": {
                "summary": "Ping",
                "operationId": "ping_ping_post",
                "responses": {
                    "200": {
                        "description": "Successful Response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "additionalProperties": {
                                        "type": "string"
                                    },
                                    "type": "object",
                                    "title": "Response Ping Ping Post"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "CreatePurchaseRequestBody": {
                "properties": {
                    "usdt_amount": {
                        "anyOf": [
                            {
                                "type": "number",
                                "exclusiveMinimum": 0.0
                            },
                            {
                                "type": "string",
                                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
                            }
                        ],
                        "title": "Usdt Amount"
                    },
                    "comment": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Comment"
                    },
                    "target_wallet_chain": {
                        "anyOf": [
                            {
                                "type": "string",
                                "maxLength": 16
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Target Wallet Chain",
                        "default": "ETH"
                    },
                    "target_wallet_address": {
                        "anyOf": [
                            {
                                "type": "string",
                                "maxLength": 128
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Target Wallet Address"
                    }
                },
                "type": "object",
                "required": [
                    "usdt_amount"
                ],
                "title": "CreatePurchaseRequestBody"
            },
            "HTTPValidationError": {
                "properties": {
                    "detail": {
                        "items": {
                            "$ref": "#/components/schemas/ValidationError"
                        },
                        "type": "array",
                        "title": "Detail"
                    }
                },
                "type": "object",
                "title": "HTTPValidationError"
            },
            "MnemonicResponse": {
                "properties": {
                    "mnemonic": {
                        "type": "string",
                        "title": "Mnemonic"
                    }
                },
                "type": "object",
                "required": [
                    "mnemonic"
                ],
                "title": "MnemonicResponse"
            },
            "OrganizationResponse": {
                "properties": {
                    "id": {
                        "type": "string",
                        "title": "Id"
                    },
                    "user_id": {
                        "type": "string",
                        "title": "User Id"
                    },
                    "name": {
                        "type": "string",
                        "title": "Name"
                    },
                    "short_name": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Short Name"
                    },
                    "inn": {
                        "type": "string",
                        "title": "Inn"
                    },
                    "ogrn": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Ogrn"
                    },
                    "kpp": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Kpp"
                    },
                    "legal_address": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Legal Address"
                    },
                    "actual_address": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Actual Address"
                    },
                    "bank_details": {
                        "anyOf": [
                            {
                                "additionalProperties": true,
                                "type": "object"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Bank Details"
                    },
                    "contact_person": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Contact Person"
                    },
                    "contact_phone": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Contact Phone"
                    },
                    "status": {
                        "type": "string",
                        "title": "Status"
                    },
                    "kyc_verified": {
                        "type": "boolean",
                        "title": "Kyc Verified"
                    },
                    "kyc_verified_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Kyc Verified At"
                    },
                    "has_wallets": {
                        "type": "boolean",
                        "title": "Has Wallets"
                    },
                    "created_by": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Created By"
                    },
                    "created_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Created At"
                    },
                    "updated_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Updated At"
                    }
                },
                "type": "object",
                "required": [
                    "id",
                    "user_id",
                    "name",
                    "short_name",
                    "inn",
                    "ogrn",
                    "kpp",
                    "legal_address",
                    "actual_address",
                    "bank_details",
                    "contact_person",
                    "contact_phone",
                    "status",
                    "kyc_verified",
                    "kyc_verified_at",
                    "has_wallets",
                    "created_by",
                    "created_at",
                    "updated_at"
                ],
                "title": "OrganizationResponse"
            },
            "PurchaseRequestListResponse": {
                "properties": {
                    "items": {
                        "items": {
                            "$ref": "#/components/schemas/PurchaseRequestResponse"
                        },
                        "type": "array",
                        "title": "Items"
                    },
                    "total": {
                        "type": "integer",
                        "title": "Total"
                    }
                },
                "type": "object",
                "required": [
                    "items",
                    "total"
                ],
                "title": "PurchaseRequestListResponse"
            },
            "PurchaseRequestResponse": {
                "properties": {
                    "id": {
                        "type": "string",
                        "title": "Id"
                    },
                    "organization_id": {
                        "type": "string",
                        "title": "Organization Id"
                    },
                    "status": {
                        "type": "string",
                        "title": "Status"
                    },
                    "usdt_amount": {
                        "type": "string",
                        "title": "Usdt Amount"
                    },
                    "rub_amount": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Rub Amount"
                    },
                    "exchange_rate": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Exchange Rate"
                    },
                    "service_fee_percent": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Service Fee Percent"
                    },
                    "comment": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Comment"
                    },
                    "admin_comment": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Admin Comment"
                    },
                    "target_wallet_chain": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Target Wallet Chain"
                    },
                    "target_wallet_address": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Target Wallet Address"
                    },
                    "tx_hash": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Tx Hash"
                    },
                    "created_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Created At"
                    },
                    "updated_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Updated At"
                    },
                    "completed_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Completed At"
                    }
                },
                "type": "object",
                "required": [
                    "id",
                    "organization_id",
                    "status",
                    "usdt_amount",
                    "rub_amount",
                    "exchange_rate",
                    "service_fee_percent",
                    "comment",
                    "admin_comment",
                    "target_wallet_chain",
                    "target_wallet_address",
                    "tx_hash",
                    "created_at",
                    "updated_at",
                    "completed_at"
                ],
                "title": "PurchaseRequestResponse"
            },
            "SecretKeyResponse": {
                "properties": {
                    "chain": {
                        "type": "string",
                        "title": "Chain"
                    },
                    "address": {
                        "type": "string",
                        "title": "Address"
                    },
                    "derivation_path": {
                        "type": "string",
                        "title": "Derivation Path"
                    },
                    "private_key": {
                        "type": "string",
                        "title": "Private Key"
                    }
                },
                "type": "object",
                "required": [
                    "chain",
                    "address",
                    "derivation_path",
                    "private_key"
                ],
                "title": "SecretKeyResponse"
            },
            "ValidationError": {
                "properties": {
                    "loc": {
                        "items": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "integer"
                                }
                            ]
                        },
                        "type": "array",
                        "title": "Location"
                    },
                    "msg": {
                        "type": "string",
                        "title": "Message"
                    },
                    "type": {
                        "type": "string",
                        "title": "Error Type"
                    },
                    "input": {
                        "title": "Input"
                    },
                    "ctx": {
                        "type": "object",
                        "title": "Context"
                    }
                },
                "type": "object",
                "required": [
                    "loc",
                    "msg",
                    "type"
                ],
                "title": "ValidationError"
            },
            "WalletResponse": {
                "properties": {
                    "id": {
                        "type": "string",
                        "title": "Id"
                    },
                    "chain": {
                        "type": "string",
                        "title": "Chain"
                    },
                    "address": {
                        "type": "string",
                        "title": "Address"
                    },
                    "derivation_path": {
                        "type": "string",
                        "title": "Derivation Path"
                    },
                    "created_at": {
                        "anyOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "null"
                            }
                        ],
                        "title": "Created At"
                    }
                },
                "type": "object",
                "required": [
                    "id",
                    "chain",
                    "address",
                    "derivation_path",
                    "created_at"
                ],
                "title": "WalletResponse"
            }
        }
    }
}