{ "openapi": "3.1.0", "info": { "title": "server-example", "description": "", "license": { "name": "" }, "version": "0.1.0" }, "paths": { "/quote": { "post": { "tags": ["crate::server"], "summary": "Example quote handler", "description": "This is an example quote handler that returns a hardcoded quote response", "operationId": "example_quote", "parameters": [ { "name": "X-API-KEY", "in": "header", "description": "Optional API Key (if required by the webhook)", "required": true, "schema": { "type": "string" } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/QuoteRequest" } } }, "required": true }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/QuoteResponse" } } } }, "400": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/swap": { "post": { "tags": ["crate::server"], "summary": "Example swap handler", "description": "This is an example swap handler that showcase how to execute a swap from the MM side", "operationId": "example_swap", "parameters": [ { "name": "X-API-KEY", "in": "header", "description": "Optional API Key (if required by the webhook)", "required": false, "schema": { "type": ["string", "null"] } } ], "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SwapRequest" } } }, "required": true }, "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SwapResponse" } } } }, "400": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "500": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } } }, "components": { "schemas": { "ErrorResponse": { "type": "object", "required": ["message"], "properties": { "message": { "type": "string", "examples": ["webhook api error message or code"] } } }, "Protocol": { "type": "string", "enum": ["v1"] }, "QuoteRequest": { "type": "object", "description": "Request to get a quote from the Market Maker", "required": [ "requestId", "quoteId", "tokenIn", "amountIn", "amount", "tokenOut", "quoteType", "protocol" ], "properties": { "amount": { "type": "string", "examples": ["250000000"] }, "amountIn": { "type": "string", "examples": ["250000000"] }, "protocol": { "$ref": "#/components/schemas/Protocol" }, "quoteId": { "type": "string", "examples": ["59db3e19-c7b0-4753-a8aa-206701004498"] }, "quoteType": { "$ref": "#/components/schemas/QuoteType" }, "requestId": { "type": "string", "examples": ["629bddf3-0038-43a6-8956-f5433d6b1191"] }, "suggestedPrioritizationFees": { "type": ["integer", "null"], "format": "int64", "description": "If no taker is provided, the there will be no suggested fee\nThis is the suggested total fees in lamports to be paid when building the transaction\nMMs will have the option to ignore our suggested fee and provide their own when responding to this quote", "examples": ["10000"], "minimum": 0 }, "taker": { "type": ["string", "null"], "description": "Taker is optional here as there are times we want to just get a quote without user signing in\nWhen user signs in, we should try to requote again so the new quote request will have a taker", "examples": ["5v2Vd71VoJ1wZhz1PkhTY48mrJwS6wF4LfvDbYPnJ3bc"] }, "tokenIn": { "type": "string", "examples": ["So11111111111111111111111111111111111111112"] }, "tokenOut": { "type": "string", "examples": ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"] } } }, "QuoteResponse": { "type": "object", "description": "Response to a quote request from the Market Maker", "required": [ "requestId", "quoteId", "tokenIn", "amountIn", "tokenOut", "quoteType", "protocol", "amountOut", "maker" ], "properties": { "amountIn": { "type": "string", "examples": ["250000000"] }, "amountOut": { "type": "string", "examples": ["1000000000"] }, "maker": { "type": "string", "examples": ["8iJxVDtFxnWpdCvdrgNDSXigxHo9vLf7KCS1pNKrs5Nh"] }, "prioritizationFeeToUse": { "type": ["integer", "null"], "format": "int64", "description": "Total fees in lamports to be paid when building the transaction\nMMs to return us the fees they want to use either the suggested_fees in the quote request or a custom amount", "examples": ["10000"], "minimum": 0 }, "protocol": { "$ref": "#/components/schemas/Protocol" }, "quoteId": { "type": "string", "examples": ["59db3e19-c7b0-4753-a8aa-206701004498"] }, "quoteType": { "$ref": "#/components/schemas/QuoteType" }, "requestId": { "type": "string", "examples": ["629bddf3-0038-43a6-8956-f5433d6b1191"] }, "taker": { "type": ["string", "null"], "description": "Taker is optional here as there are times we want to just get a quote without user signing in", "examples": ["5v2Vd71VoJ1wZhz1PkhTY48mrJwS6wF4LfvDbYPnJ3bc"] }, "tokenIn": { "type": "string", "examples": ["So11111111111111111111111111111111111111112"] }, "tokenOut": { "type": "string", "examples": ["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"] } } }, "QuoteType": { "type": "string", "enum": ["exactIn", "exactOut"] }, "SwapRequest": { "type": "object", "description": "Order to be fulfilled by the Market Maker", "required": ["requestId", "quoteId", "transaction"], "properties": { "quoteId": { "type": "string", "examples": ["59db3e19-c7b0-4753-a8aa-206701004498"] }, "requestId": { "type": "string", "examples": ["629bddf3-0038-43a6-8956-f5433d6b1191"] }, "transaction": { "type": "string", "description": "Base64 encoded versioned transaction", "examples": [ "AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAIABgxSnEehNb4kLTrfnzoVcTu/GPLBwP0kKZRTJowyLvHxxSdkl7oLuGWRcrcu3Yxm4Y9WF2TZyGphCjp+D3nAuvnbWolfQZ0Kl+9/uOLLKVXoXu/o/NQI5LY9pgx8ibLVfztqKpSdlIRAyuBnIsFa1A93abdI4AmIcbFLGFGatrhAXnMzpil7FnByGEuo10mEgCYqn/QfD1DTR6idALqAu9Bhh6NTL/nu9FDLsM2mMKzzPPKY2nBeuUHR7ibnmbqVw/MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMGRm/lIRcy/+ytunLDm+e8jOW7xfcSayxDmzpAAAAABpuIV/6rgYT7aH9jRhjANdrEOdwa6ztVmKDwAAAAAAEG3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqUpYSftyo7vpH9xbDmpX9jxaHLRbIGem7Qys02OVyKECxvp6877brTo9ZfNqq8l0MbG75MLS9uDkfKYCA0UvXWE9f/tHi80zsUphEh9edGz8h7JFCM8ITLeBpkq6CPTyfQMHAAkDmLEBAAAAAAAHAAUCwFwVAAoMAQACAwoFCwkICQYEIKhgt6NcCiigAMqaOwAAAAAm/0kBAQAAAEAvW2cAAAAAAA==" ] } } }, "SwapResponse": { "type": "object", "description": "Response to a swap request to the Market Maker", "required": ["quoteId", "state"], "properties": { "quoteId": { "type": "string", "examples": ["59db3e19-c7b0-4753-a8aa-206701004498"] }, "rejectionReason": { "type": ["string", "null"], "description": "Optional message to provide more context when the swap is rejected" }, "state": { "$ref": "#/components/schemas/SwapState" }, "txSignature": { "type": ["string", "null"], "examples": [ "5K6CqVweTk4t9K6Xfa1gw7D9rS4GeAa8Z67e2q8Mi7f8QwexqTmtLnZgNeBe93PaRtt8beijqV9t7rp7C7yGfzkXGy2yFbF" ] } } }, "SwapState": { "type": "string", "enum": ["accepted", "rejected"] } } }, "tags": [ { "name": "RFQ Webhook API", "description": "Webhook API for RFQ providers" } ] }