#!/usr/bin/env node
/**
* BlindPay MCP Server - Model Context Protocol server for BlindPay API
* Provides AI assistants with direct access to BlindPay's stablecoin payment API
*/
// Load environment variables from .env file
import dotenv from 'dotenv';
dotenv.config();
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import {
CallToolRequestSchema,
ListToolsRequestSchema,
type Tool,
type CallToolResult,
type CallToolRequest,
} from '@modelcontextprotocol/sdk/types.js';
import { z, ZodError } from 'zod';
import { jsonSchemaToZod } from 'json-schema-to-zod';
import axios, { type AxiosRequestConfig, type AxiosError } from 'axios';
/**
* Type definition for JSON objects
*/
type JsonObject = Record<string, any>;
/**
* Interface for MCP Tool Definition
*/
interface McpToolDefinition {
name: string;
description: string;
inputSchema: any;
method: string;
pathTemplate: string;
executionParameters: { name: string; in: string }[];
requestBodyContentType?: string;
securityRequirements: any[];
}
/**
* Server configuration
*/
export const SERVER_NAME = '@blindpay/mcp';
export const SERVER_VERSION = '1.1.0';
export const API_BASE_URL = 'https://api.blindpay.com';
/**
* MCP Server instance
*/
const mcpServer = new McpServer(
{ name: SERVER_NAME, version: SERVER_VERSION },
{ capabilities: { tools: {} } }
);
// Access the underlying Server for handler registration
const server = mcpServer.server;
/**
* Map of tool definitions by name
*/
const toolDefinitionMap: Map<string, McpToolDefinition> = new Map([
[
'PutV1InstancesById',
{
name: 'PutV1InstancesById',
description: `Update Instance`,
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
name: { type: 'string', minLength: 3, maxLength: 100 },
receiver_invite_redirect_url: {
type: ['string', 'null'],
format: 'uri',
},
},
required: ['name'],
description: 'Update instance',
},
},
required: ['id'],
},
method: 'put',
pathTemplate: '/v1/instances/{id}',
executionParameters: [{ name: 'id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'DeleteV1InstancesById',
{
name: 'DeleteV1InstancesById',
description: `Delete Instance`,
inputSchema: {
type: 'object',
properties: { id: { type: 'string', minLength: 15, maxLength: 15 } },
required: ['id'],
},
method: 'delete',
pathTemplate: '/v1/instances/{id}',
executionParameters: [{ name: 'id', in: 'path' }],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesMembers',
{
name: 'GetV1InstancesMembers',
description: `Retrieve Instance Members`,
inputSchema: {
type: 'object',
properties: { id: { type: 'string', minLength: 15, maxLength: 15 } },
required: ['id'],
},
method: 'get',
pathTemplate: '/v1/instances/{id}/members',
executionParameters: [{ name: 'id', in: 'path' }],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PutV1InstancesMembersByUserId',
{
name: 'PutV1InstancesMembersByUserId',
description: `Update Instance Member Role`,
inputSchema: {
type: 'object',
properties: {
id: { type: 'string' },
user_id: { type: 'string' },
requestBody: {
type: 'object',
properties: {
user_role: {
type: 'string',
enum: ['owner', 'admin', 'finance', 'checker', 'operations', 'developer', 'viewer'],
},
},
required: ['user_role'],
description: 'Update instance member role',
},
},
required: ['id', 'user_id'],
},
method: 'put',
pathTemplate: '/v1/instances/{id}/members/{user_id}',
executionParameters: [
{ name: 'id', in: 'path' },
{ name: 'user_id', in: 'path' },
],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'DeleteV1InstancesMembersByUserId',
{
name: 'DeleteV1InstancesMembersByUserId',
description: `Delete Member from Instance`,
inputSchema: {
type: 'object',
properties: { id: { type: 'string' }, user_id: { type: 'string' } },
required: ['id', 'user_id'],
},
method: 'delete',
pathTemplate: '/v1/instances/{id}/members/{user_id}',
executionParameters: [
{ name: 'id', in: 'path' },
{ name: 'user_id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1EInstancesTos',
{
name: 'PostV1EInstancesTos',
description: `Initiate Terms of Service`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
idempotency_key: { type: 'string', format: 'uuid' },
receiver_id: {
type: ['string', 'null'],
minLength: 15,
maxLength: 15,
},
redirect_url: { type: ['string', 'null'], format: 'uri' },
},
required: ['idempotency_key'],
description: 'Initiate a new terms of service',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/e/instances/{instance_id}/tos',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesReceivers',
{
name: 'GetV1InstancesReceivers',
description: `Retrieve Receivers`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
limit: {
type: 'string',
enum: ['10', '50', '100', '200', '500', '1000'],
description: 'Number of items to return',
},
offset: {
type: 'string',
enum: ['0', '10', '50', '100', '200', '500', '1000'],
description: 'Number of items to skip',
},
starting_after: {
type: 'string',
description:
'A cursor for use in pagination. starting_after is an object ID that defines your place in the list.',
},
ending_before: {
type: 'string',
description:
'A cursor for use in pagination. ending_before is an object ID that defines your place in the list.',
},
full_name: { type: 'string' },
},
required: ['instance_id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/receivers',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'limit', in: 'query' },
{ name: 'offset', in: 'query' },
{ name: 'starting_after', in: 'query' },
{ name: 'ending_before', in: 'query' },
{ name: 'full_name', in: 'query' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesReceivers',
{
name: 'PostV1InstancesReceivers',
description: `Create Receiver`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
type: { type: 'string', enum: ['individual', 'business'] },
kyc_type: {
type: 'string',
enum: ['light', 'standard', 'enhanced'],
},
email: { type: 'string', format: 'email' },
tax_id: { type: ['string', 'null'] },
address_line_1: { type: ['string', 'null'] },
address_line_2: { type: ['string', 'null'] },
city: { type: ['string', 'null'] },
state_province_region: { type: ['string', 'null'] },
country: {
type: 'string',
enum: [
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BQ',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
'BI',
'CV',
'KH',
'CM',
'CA',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
'CD',
'CG',
'CK',
'CR',
'HR',
'CU',
'CW',
'CY',
'CZ',
'CI',
'DK',
'DJ',
'DM',
'DO',
'EC',
'EG',
'SV',
'GQ',
'ER',
'EE',
'SZ',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'GF',
'PF',
'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GG',
'GN',
'GW',
'GY',
'HT',
'HM',
'VA',
'HN',
'HK',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IM',
'IL',
'IT',
'JM',
'JP',
'JE',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'ME',
'MS',
'MA',
'MZ',
'MM',
'NA',
'NR',
'NP',
'NL',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
'PK',
'PW',
'PS',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'MK',
'RO',
'RU',
'RW',
'RE',
'BL',
'SH',
'KN',
'LC',
'MF',
'PM',
'VC',
'WS',
'SM',
'ST',
'SA',
'SN',
'RS',
'SC',
'SL',
'SG',
'SX',
'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'SS',
'ES',
'LK',
'SD',
'SR',
'SJ',
'SE',
'CH',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TL',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
'TV',
'UG',
'UA',
'AE',
'GB',
'UM',
'US',
'UY',
'UZ',
'VU',
'VE',
'VN',
'VG',
'VI',
'WF',
'EH',
'YE',
'ZM',
'ZW',
'AX',
],
},
postal_code: { type: ['string', 'null'] },
ip_address: { type: ['string', 'null'], format: 'ip' },
image_url: { type: ['string', 'null'], format: 'uri' },
phone_number: { type: ['string', 'null'] },
proof_of_address_doc_type: {
type: ['string', 'null'],
enum: [
'UTILITY_BILL',
'BANK_STATEMENT',
'RENTAL_AGREEMENT',
'TAX_DOCUMENT',
'GOVERNMENT_CORRESPONDENCE',
],
},
proof_of_address_doc_file: {
type: ['string', 'null'],
format: 'uri',
description:
'Please upload one document that serve as proof of address, this needs to be the same physical address as the one provided above. Only PDF and image files are accepted (.jpg, .jpeg, .png, .pdf) with a maximum size of 3MB.',
},
first_name: { type: ['string', 'null'] },
last_name: { type: ['string', 'null'] },
date_of_birth: {
anyOf: [
{ type: 'string', format: 'date-time' },
{ type: 'string' },
{ type: 'null' },
],
},
id_doc_country: {
type: ['string', 'null'],
enum: [
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BQ',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
'BI',
'CV',
'KH',
'CM',
'CA',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
'CD',
'CG',
'CK',
'CR',
'HR',
'CU',
'CW',
'CY',
'CZ',
'CI',
'DK',
'DJ',
'DM',
'DO',
'EC',
'EG',
'SV',
'GQ',
'ER',
'EE',
'SZ',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'GF',
'PF',
'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GG',
'GN',
'GW',
'GY',
'HT',
'HM',
'VA',
'HN',
'HK',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IM',
'IL',
'IT',
'JM',
'JP',
'JE',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'ME',
'MS',
'MA',
'MZ',
'MM',
'NA',
'NR',
'NP',
'NL',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
'PK',
'PW',
'PS',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'MK',
'RO',
'RU',
'RW',
'RE',
'BL',
'SH',
'KN',
'LC',
'MF',
'PM',
'VC',
'WS',
'SM',
'ST',
'SA',
'SN',
'RS',
'SC',
'SL',
'SG',
'SX',
'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'SS',
'ES',
'LK',
'SD',
'SR',
'SJ',
'SE',
'CH',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TL',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
'TV',
'UG',
'UA',
'AE',
'GB',
'UM',
'US',
'UY',
'UZ',
'VU',
'VE',
'VN',
'VG',
'VI',
'WF',
'EH',
'YE',
'ZM',
'ZW',
'AX',
],
},
id_doc_type: {
type: ['string', 'null'],
enum: ['PASSPORT', 'ID_CARD', 'DRIVERS'],
},
id_doc_front_file: {
type: ['string', 'null'],
format: 'uri',
description: 'Only image files are accepted (.jpg, .jpeg, .png)',
},
id_doc_back_file: {
type: ['string', 'null'],
format: 'uri',
description: 'Only image files are accepted (.jpg, .jpeg, .png)',
},
legal_name: { type: ['string', 'null'] },
alternate_name: { type: ['string', 'null'] },
formation_date: {
anyOf: [
{ type: 'string', format: 'date-time' },
{ type: 'string' },
{ type: 'null' },
],
format: 'date-time',
},
website: { type: ['string', 'null'], format: 'uri' },
owners: {
type: ['array', 'null'],
items: {
type: 'object',
properties: {
role: {
type: 'string',
enum: ['beneficial_controlling', 'beneficial_owner', 'controlling_person'],
description:
'A beneficial owner is someone who directly or indirectly owns 25% or more of your business. A controlling person is someone with significant responsibility to control, manage or direct your business (typically a CEO, senior executive officer or equivalent).',
example: 'beneficial_owner',
},
first_name: {
type: 'string',
minLength: 1,
example: 'John',
},
last_name: { type: 'string', minLength: 1, example: 'Doe' },
date_of_birth: {
anyOf: [{ type: 'string', format: 'date-time' }, { type: 'string' }],
example: '1998-01-01T00:00:00Z',
},
tax_id: { type: 'string', example: '536804398' },
address_line_1: { type: 'string', example: '738 Plain St' },
address_line_2: {
type: ['string', 'null'],
example: 'Building 22',
},
city: { type: 'string', example: 'Marshfield' },
state_province_region: { type: 'string', example: 'MA' },
country: {
type: 'string',
enum: [
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BQ',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
'BI',
'CV',
'KH',
'CM',
'CA',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
'CD',
'CG',
'CK',
'CR',
'HR',
'CU',
'CW',
'CY',
'CZ',
'CI',
'DK',
'DJ',
'DM',
'DO',
'EC',
'EG',
'SV',
'GQ',
'ER',
'EE',
'SZ',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'GF',
'PF',
'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GG',
'GN',
'GW',
'GY',
'HT',
'HM',
'VA',
'HN',
'HK',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IM',
'IL',
'IT',
'JM',
'JP',
'JE',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'ME',
'MS',
'MA',
'MZ',
'MM',
'NA',
'NR',
'NP',
'NL',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
'PK',
'PW',
'PS',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'MK',
'RO',
'RU',
'RW',
'RE',
'BL',
'SH',
'KN',
'LC',
'MF',
'PM',
'VC',
'WS',
'SM',
'ST',
'SA',
'SN',
'RS',
'SC',
'SL',
'SG',
'SX',
'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'SS',
'ES',
'LK',
'SD',
'SR',
'SJ',
'SE',
'CH',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TL',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
'TV',
'UG',
'UA',
'AE',
'GB',
'UM',
'US',
'UY',
'UZ',
'VU',
'VE',
'VN',
'VG',
'VI',
'WF',
'EH',
'YE',
'ZM',
'ZW',
'AX',
],
example: 'US',
},
postal_code: { type: 'string', example: '02050' },
id_doc_country: {
type: 'string',
enum: [
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BQ',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
'BI',
'CV',
'KH',
'CM',
'CA',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
'CD',
'CG',
'CK',
'CR',
'HR',
'CU',
'CW',
'CY',
'CZ',
'CI',
'DK',
'DJ',
'DM',
'DO',
'EC',
'EG',
'SV',
'GQ',
'ER',
'EE',
'SZ',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'GF',
'PF',
'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GG',
'GN',
'GW',
'GY',
'HT',
'HM',
'VA',
'HN',
'HK',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IM',
'IL',
'IT',
'JM',
'JP',
'JE',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'ME',
'MS',
'MA',
'MZ',
'MM',
'NA',
'NR',
'NP',
'NL',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
'PK',
'PW',
'PS',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'MK',
'RO',
'RU',
'RW',
'RE',
'BL',
'SH',
'KN',
'LC',
'MF',
'PM',
'VC',
'WS',
'SM',
'ST',
'SA',
'SN',
'RS',
'SC',
'SL',
'SG',
'SX',
'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'SS',
'ES',
'LK',
'SD',
'SR',
'SJ',
'SE',
'CH',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TL',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
'TV',
'UG',
'UA',
'AE',
'GB',
'UM',
'US',
'UY',
'UZ',
'VU',
'VE',
'VN',
'VG',
'VI',
'WF',
'EH',
'YE',
'ZM',
'ZW',
'AX',
],
example: 'BR',
},
id_doc_type: {
type: 'string',
enum: ['PASSPORT', 'ID_CARD', 'DRIVERS'],
example: 'PASSPORT',
},
id_doc_front_file: { type: 'string', format: 'uri' },
id_doc_back_file: {
type: ['string', 'null'],
format: 'uri',
description: 'Only image files are accepted (.jpg, .jpeg, .png)',
},
proof_of_address_doc_type: {
type: ['string', 'null'],
enum: [
'UTILITY_BILL',
'BANK_STATEMENT',
'RENTAL_AGREEMENT',
'TAX_DOCUMENT',
'GOVERNMENT_CORRESPONDENCE',
],
example: 'UTILITY_BILL',
},
proof_of_address_doc_file: {
type: ['string', 'null'],
format: 'uri',
description:
'Please upload one document that serve as proof of address, this needs to be the same address as the one provided above. Only PDF and image files are accepted (.jpg, .jpeg, .png, .pdf) with a maximum size of 3MB.',
},
},
required: [
'role',
'first_name',
'last_name',
'date_of_birth',
'tax_id',
'address_line_1',
'city',
'state_province_region',
'country',
'postal_code',
'id_doc_country',
'id_doc_type',
'id_doc_front_file',
],
},
description: 'Receiver owners',
},
incorporation_doc_file: {
type: ['string', 'null'],
format: 'uri',
description:
'Please upload your articles of incorporation below. The articles of incorporation or a certificate of incorporation usually includes information like the company name, business purpose, number of shares offered, value of shares, etc. Only PDF and image files are accepted (.jpg, .jpeg, .png, .pdf) with a maximum size of 3MB.',
},
proof_of_ownership_doc_file: {
type: ['string', 'null'],
format: 'uri',
description:
'Please upload your proof of ownership below. This document usually includes information like the shareholders names and percentages. Only PDF and image files are accepted (.jpg, .jpeg, .png, .pdf) with a maximum size of 3MB.',
},
source_of_funds_doc_type: {
type: ['string', 'null'],
enum: [
'business_income',
'gambling_proceeds',
'gifts',
'government_benefits',
'inheritance',
'investment_loans',
'pension_retirement',
'salary',
'sale_of_assets_real_estate',
'savings',
'esops',
'investment_proceeds',
'someone_else_funds',
],
},
source_of_funds_doc_file: {
type: ['string', 'null'],
format: 'uri',
},
selfie_file: {
type: ['string', 'null'],
format: 'uri',
description: 'Only image files are accepted (.jpg, .jpeg, .png)',
},
purpose_of_transactions: {
type: ['string', 'null'],
enum: [
'business_transactions',
'charitable_donations',
'investment_purposes',
'payments_to_friends_or_family_abroad',
'personal_or_living_expenses',
'protect_wealth',
'purchase_good_and_services',
'receive_payment_for_freelancing',
'receive_salary',
'other',
],
},
purpose_of_transactions_explanation: { type: ['string', 'null'] },
is_fbo: { type: ['boolean', 'null'] },
external_id: { type: ['string', 'null'] },
tos_id: {
type: ['string', 'null'],
minLength: 15,
maxLength: 15,
},
},
required: ['type', 'kyc_type', 'email', 'country'],
description: 'Create a new receiver',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/receivers',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesReceiversById',
{
name: 'GetV1InstancesReceiversById',
description: `Retrieve Receiver`,
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['id', 'instance_id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/receivers/{id}',
executionParameters: [
{ name: 'id', in: 'path' },
{ name: 'instance_id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PutV1InstancesReceiversById',
{
name: 'PutV1InstancesReceiversById',
description: `Update Receiver`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
email: { type: 'string', format: 'email' },
tax_id: { type: ['string', 'null'] },
address_line_1: { type: ['string', 'null'] },
address_line_2: { type: ['string', 'null'] },
city: { type: ['string', 'null'] },
state_province_region: { type: ['string', 'null'] },
country: {
type: 'string',
enum: [
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BQ',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
'BI',
'CV',
'KH',
'CM',
'CA',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
'CD',
'CG',
'CK',
'CR',
'HR',
'CU',
'CW',
'CY',
'CZ',
'CI',
'DK',
'DJ',
'DM',
'DO',
'EC',
'EG',
'SV',
'GQ',
'ER',
'EE',
'SZ',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'GF',
'PF',
'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GG',
'GN',
'GW',
'GY',
'HT',
'HM',
'VA',
'HN',
'HK',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IM',
'IL',
'IT',
'JM',
'JP',
'JE',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'ME',
'MS',
'MA',
'MZ',
'MM',
'NA',
'NR',
'NP',
'NL',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
'PK',
'PW',
'PS',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'MK',
'RO',
'RU',
'RW',
'RE',
'BL',
'SH',
'KN',
'LC',
'MF',
'PM',
'VC',
'WS',
'SM',
'ST',
'SA',
'SN',
'RS',
'SC',
'SL',
'SG',
'SX',
'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'SS',
'ES',
'LK',
'SD',
'SR',
'SJ',
'SE',
'CH',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TL',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
'TV',
'UG',
'UA',
'AE',
'GB',
'UM',
'US',
'UY',
'UZ',
'VU',
'VE',
'VN',
'VG',
'VI',
'WF',
'EH',
'YE',
'ZM',
'ZW',
'AX',
],
},
postal_code: { type: ['string', 'null'] },
ip_address: { type: ['string', 'null'], format: 'ip' },
image_url: { type: ['string', 'null'], format: 'uri' },
phone_number: { type: ['string', 'null'] },
proof_of_address_doc_type: {
type: ['string', 'null'],
enum: [
'UTILITY_BILL',
'BANK_STATEMENT',
'RENTAL_AGREEMENT',
'TAX_DOCUMENT',
'GOVERNMENT_CORRESPONDENCE',
],
},
proof_of_address_doc_file: {
type: ['string', 'null'],
format: 'uri',
description:
'Please upload one document that serve as proof of address, this needs to be the same physical address as the one provided above. Only PDF and image files are accepted (.jpg, .jpeg, .png, .pdf) with a maximum size of 3MB.',
},
first_name: { type: ['string', 'null'] },
last_name: { type: ['string', 'null'] },
date_of_birth: {
anyOf: [
{ type: 'string', format: 'date-time' },
{ type: 'string' },
{ type: 'null' },
],
},
id_doc_country: {
type: ['string', 'null'],
enum: [
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BQ',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
'BI',
'CV',
'KH',
'CM',
'CA',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
'CD',
'CG',
'CK',
'CR',
'HR',
'CU',
'CW',
'CY',
'CZ',
'CI',
'DK',
'DJ',
'DM',
'DO',
'EC',
'EG',
'SV',
'GQ',
'ER',
'EE',
'SZ',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'GF',
'PF',
'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GG',
'GN',
'GW',
'GY',
'HT',
'HM',
'VA',
'HN',
'HK',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IM',
'IL',
'IT',
'JM',
'JP',
'JE',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'ME',
'MS',
'MA',
'MZ',
'MM',
'NA',
'NR',
'NP',
'NL',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
'PK',
'PW',
'PS',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'MK',
'RO',
'RU',
'RW',
'RE',
'BL',
'SH',
'KN',
'LC',
'MF',
'PM',
'VC',
'WS',
'SM',
'ST',
'SA',
'SN',
'RS',
'SC',
'SL',
'SG',
'SX',
'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'SS',
'ES',
'LK',
'SD',
'SR',
'SJ',
'SE',
'CH',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TL',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
'TV',
'UG',
'UA',
'AE',
'GB',
'UM',
'US',
'UY',
'UZ',
'VU',
'VE',
'VN',
'VG',
'VI',
'WF',
'EH',
'YE',
'ZM',
'ZW',
'AX',
],
},
id_doc_type: {
type: ['string', 'null'],
enum: ['PASSPORT', 'ID_CARD', 'DRIVERS'],
},
id_doc_front_file: {
type: ['string', 'null'],
format: 'uri',
description: 'Only image files are accepted (.jpg, .jpeg, .png)',
},
id_doc_back_file: {
type: ['string', 'null'],
format: 'uri',
description: 'Only image files are accepted (.jpg, .jpeg, .png)',
},
legal_name: { type: ['string', 'null'] },
alternate_name: { type: ['string', 'null'] },
formation_date: {
anyOf: [
{ type: 'string', format: 'date-time' },
{ type: 'string' },
{ type: 'null' },
],
format: 'date-time',
},
website: { type: ['string', 'null'], format: 'uri' },
owners: {
type: ['array', 'null'],
items: {
type: 'object',
properties: {
id: {
type: 'string',
minLength: 15,
maxLength: 15,
example: 'ub_000000000000',
},
instance_id: {
type: 'string',
minLength: 15,
maxLength: 15,
example: 'in_000000000000',
},
receiver_id: {
type: 'string',
minLength: 15,
maxLength: 15,
example: 're_000000000000',
},
role: {
type: 'string',
enum: ['beneficial_controlling', 'beneficial_owner', 'controlling_person'],
description:
'A beneficial owner is someone who directly or indirectly owns 25% or more of your business. A controlling person is someone with significant responsibility to control, manage or direct your business (typically a CEO, senior executive officer or equivalent).',
example: 'beneficial_owner',
},
first_name: {
type: 'string',
minLength: 1,
example: 'John',
},
last_name: { type: 'string', minLength: 1, example: 'Doe' },
date_of_birth: {
anyOf: [{ type: 'string', format: 'date-time' }, { type: 'string' }],
example: '1998-01-01T00:00:00Z',
},
tax_id: { type: 'string', example: '536804398' },
address_line_1: { type: 'string', example: '738 Plain St' },
address_line_2: {
type: ['string', 'null'],
example: 'Building 22',
},
city: { type: 'string', example: 'Marshfield' },
state_province_region: { type: 'string', example: 'MA' },
country: {
type: 'string',
enum: [
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BQ',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
'BI',
'CV',
'KH',
'CM',
'CA',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
'CD',
'CG',
'CK',
'CR',
'HR',
'CU',
'CW',
'CY',
'CZ',
'CI',
'DK',
'DJ',
'DM',
'DO',
'EC',
'EG',
'SV',
'GQ',
'ER',
'EE',
'SZ',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'GF',
'PF',
'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GG',
'GN',
'GW',
'GY',
'HT',
'HM',
'VA',
'HN',
'HK',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IM',
'IL',
'IT',
'JM',
'JP',
'JE',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'ME',
'MS',
'MA',
'MZ',
'MM',
'NA',
'NR',
'NP',
'NL',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
'PK',
'PW',
'PS',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'MK',
'RO',
'RU',
'RW',
'RE',
'BL',
'SH',
'KN',
'LC',
'MF',
'PM',
'VC',
'WS',
'SM',
'ST',
'SA',
'SN',
'RS',
'SC',
'SL',
'SG',
'SX',
'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'SS',
'ES',
'LK',
'SD',
'SR',
'SJ',
'SE',
'CH',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TL',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
'TV',
'UG',
'UA',
'AE',
'GB',
'UM',
'US',
'UY',
'UZ',
'VU',
'VE',
'VN',
'VG',
'VI',
'WF',
'EH',
'YE',
'ZM',
'ZW',
'AX',
],
example: 'US',
},
postal_code: { type: 'string', example: '02050' },
id_doc_country: {
type: 'string',
enum: [
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BQ',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
'BI',
'CV',
'KH',
'CM',
'CA',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
'CD',
'CG',
'CK',
'CR',
'HR',
'CU',
'CW',
'CY',
'CZ',
'CI',
'DK',
'DJ',
'DM',
'DO',
'EC',
'EG',
'SV',
'GQ',
'ER',
'EE',
'SZ',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'GF',
'PF',
'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GG',
'GN',
'GW',
'GY',
'HT',
'HM',
'VA',
'HN',
'HK',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IM',
'IL',
'IT',
'JM',
'JP',
'JE',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'ME',
'MS',
'MA',
'MZ',
'MM',
'NA',
'NR',
'NP',
'NL',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
'PK',
'PW',
'PS',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'MK',
'RO',
'RU',
'RW',
'RE',
'BL',
'SH',
'KN',
'LC',
'MF',
'PM',
'VC',
'WS',
'SM',
'ST',
'SA',
'SN',
'RS',
'SC',
'SL',
'SG',
'SX',
'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'SS',
'ES',
'LK',
'SD',
'SR',
'SJ',
'SE',
'CH',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TL',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
'TV',
'UG',
'UA',
'AE',
'GB',
'UM',
'US',
'UY',
'UZ',
'VU',
'VE',
'VN',
'VG',
'VI',
'WF',
'EH',
'YE',
'ZM',
'ZW',
'AX',
],
example: 'BR',
},
id_doc_type: {
type: 'string',
enum: ['PASSPORT', 'ID_CARD', 'DRIVERS'],
example: 'PASSPORT',
},
id_doc_front_file: {
type: ['string', 'null'],
format: 'uri',
description: 'Only image files are accepted (.jpg, .jpeg, .png)',
},
id_doc_back_file: {
type: ['string', 'null'],
format: 'uri',
description: 'Only image files are accepted (.jpg, .jpeg, .png)',
},
proof_of_address_doc_type: {
type: ['string', 'null'],
enum: [
'UTILITY_BILL',
'BANK_STATEMENT',
'RENTAL_AGREEMENT',
'TAX_DOCUMENT',
'GOVERNMENT_CORRESPONDENCE',
],
example: 'UTILITY_BILL',
},
proof_of_address_doc_file: {
type: ['string', 'null'],
format: 'uri',
description:
'Please upload one document that serve as proof of address, this needs to be the same address as the one provided above. Only PDF and image files are accepted (.jpg, .jpeg, .png, .pdf) with a maximum size of 3MB.',
},
},
},
description: 'Receiver owners',
},
incorporation_doc_file: {
type: ['string', 'null'],
format: 'uri',
description:
'Please upload your articles of incorporation below. The articles of incorporation or a certificate of incorporation usually includes information like the company name, business purpose, number of shares offered, value of shares, etc. Only PDF and image files are accepted (.jpg, .jpeg, .png, .pdf) with a maximum size of 3MB.',
},
proof_of_ownership_doc_file: {
type: ['string', 'null'],
format: 'uri',
description:
'Please upload your proof of ownership below. This document usually includes information like the shareholders names and percentages. Only PDF and image files are accepted (.jpg, .jpeg, .png, .pdf) with a maximum size of 3MB.',
},
source_of_funds_doc_type: {
type: ['string', 'null'],
enum: [
'business_income',
'gambling_proceeds',
'gifts',
'government_benefits',
'inheritance',
'investment_loans',
'pension_retirement',
'salary',
'sale_of_assets_real_estate',
'savings',
'esops',
'investment_proceeds',
'someone_else_funds',
],
},
source_of_funds_doc_file: {
type: ['string', 'null'],
format: 'uri',
},
selfie_file: {
type: ['string', 'null'],
format: 'uri',
description: 'Only image files are accepted (.jpg, .jpeg, .png)',
},
purpose_of_transactions: {
type: ['string', 'null'],
enum: [
'business_transactions',
'charitable_donations',
'investment_purposes',
'payments_to_friends_or_family_abroad',
'personal_or_living_expenses',
'protect_wealth',
'purchase_good_and_services',
'receive_payment_for_freelancing',
'receive_salary',
'other',
],
},
purpose_of_transactions_explanation: { type: ['string', 'null'] },
is_fbo: { type: ['boolean', 'null'] },
external_id: { type: ['string', 'null'] },
tos_id: {
type: ['string', 'null'],
minLength: 15,
maxLength: 15,
},
},
required: ['email', 'country'],
description: 'Update a receiver',
},
},
required: ['instance_id', 'id'],
},
method: 'put',
pathTemplate: '/v1/instances/{instance_id}/receivers/{id}',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'DeleteV1InstancesReceiversById',
{
name: 'DeleteV1InstancesReceiversById',
description: `Delete Receiver`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id', 'id'],
},
method: 'delete',
pathTemplate: '/v1/instances/{instance_id}/receivers/{id}',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesLimitsReceiversById',
{
name: 'GetV1InstancesLimitsReceiversById',
description: `Retrieve Receiver Limits`,
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['id', 'instance_id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/limits/receivers/{id}',
executionParameters: [
{ name: 'id', in: 'path' },
{ name: 'instance_id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesReceiversLimitIncrease',
{
name: 'GetV1InstancesReceiversLimitIncrease',
description: `Retrieve Limit Increase Requests`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id', 'receiver_id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/limit-increase',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'receiver_id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesReceiversLimitIncrease',
{
name: 'PostV1InstancesReceiversLimitIncrease',
description: `Request Limit Increase`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
per_transaction: {
type: ['integer', 'null'],
maximum: 100000000000,
},
daily: { type: ['integer', 'null'], maximum: 100000000000 },
monthly: { type: ['integer', 'null'], maximum: 100000000000 },
supporting_document_type: {
type: 'string',
enum: [
'individual_bank_statement',
'individual_tax_return',
'individual_proof_of_income',
'business_bank_statement',
'business_financial_statements',
'business_tax_return',
],
},
supporting_document_file: { type: 'string', format: 'uri' },
},
required: [
'per_transaction',
'daily',
'monthly',
'supporting_document_type',
'supporting_document_file',
],
description: 'Request new limit increase',
},
},
required: ['instance_id', 'receiver_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/limit-increase',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'receiver_id', in: 'path' },
],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesReceiversBankAccounts',
{
name: 'GetV1InstancesReceiversBankAccounts',
description: `Retrieve Bank Accounts`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['receiver_id', 'instance_id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/bank-accounts',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesReceiversBankAccounts',
{
name: 'PostV1InstancesReceiversBankAccounts',
description: `Add Bank Account`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
type: {
type: 'string',
enum: [
'wire',
'ach',
'pix',
'pix_safe',
'spei_bitso',
'transfers_bitso',
'ach_cop_bitso',
'international_swift',
'rtp',
],
},
name: { type: 'string' },
pix_key: { type: ['string', 'null'] },
force_cpf_cnpj: {
type: ['boolean', 'null'],
description: 'Force CPF/CNPJ validation for PIX key',
},
beneficiary_name: { type: ['string', 'null'], maxLength: 128 },
routing_number: { type: ['string', 'null'] },
account_number: { type: ['string', 'null'] },
account_type: {
type: ['string', 'null'],
enum: ['checking', 'saving'],
},
account_class: {
type: ['string', 'null'],
enum: ['individual', 'business'],
},
address_line_1: { type: ['string', 'null'] },
address_line_2: { type: ['string', 'null'] },
city: { type: ['string', 'null'] },
state_province_region: { type: ['string', 'null'] },
country: {
type: ['string', 'null'],
enum: [
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BQ',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
'BI',
'CV',
'KH',
'CM',
'CA',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
'CD',
'CG',
'CK',
'CR',
'HR',
'CU',
'CW',
'CY',
'CZ',
'CI',
'DK',
'DJ',
'DM',
'DO',
'EC',
'EG',
'SV',
'GQ',
'ER',
'EE',
'SZ',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'GF',
'PF',
'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GG',
'GN',
'GW',
'GY',
'HT',
'HM',
'VA',
'HN',
'HK',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IM',
'IL',
'IT',
'JM',
'JP',
'JE',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'ME',
'MS',
'MA',
'MZ',
'MM',
'NA',
'NR',
'NP',
'NL',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
'PK',
'PW',
'PS',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'MK',
'RO',
'RU',
'RW',
'RE',
'BL',
'SH',
'KN',
'LC',
'MF',
'PM',
'VC',
'WS',
'SM',
'ST',
'SA',
'SN',
'RS',
'SC',
'SL',
'SG',
'SX',
'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'SS',
'ES',
'LK',
'SD',
'SR',
'SJ',
'SE',
'CH',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TL',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
'TV',
'UG',
'UA',
'AE',
'GB',
'UM',
'US',
'UY',
'UZ',
'VU',
'VE',
'VN',
'VG',
'VI',
'WF',
'EH',
'YE',
'ZM',
'ZW',
'AX',
],
},
postal_code: { type: ['string', 'null'] },
checkbook_account_id: { type: ['string', 'null'] },
checkbook_user_key: { type: ['string', 'null'] },
pix_safe_bank_code: {
type: ['string', 'null'],
pattern: '^\\d{4,8}$',
},
pix_safe_branch_code: {
type: ['string', 'null'],
pattern: '^\\d{4}$',
},
pix_safe_cpf_cnpj: { type: ['string', 'null'] },
spei_protocol: {
type: ['string', 'null'],
enum: ['clabe', 'debitcard', 'phonenum'],
description: 'For debitcard and phonenum the spei_institution_code is required',
},
spei_institution_code: {
type: ['string', 'null'],
minLength: 5,
maxLength: 5,
},
spei_clabe: { type: ['string', 'null'] },
transfers_type: {
type: ['string', 'null'],
enum: ['CVU', 'CBU', 'ALIAS'],
},
transfers_account: { type: ['string', 'null'] },
ach_cop_beneficiary_first_name: { type: ['string', 'null'] },
ach_cop_beneficiary_last_name: { type: ['string', 'null'] },
ach_cop_document_id: { type: ['string', 'null'] },
ach_cop_document_type: {
type: ['string', 'null'],
enum: ['CC', 'CE', 'NIT', 'PASS', 'PEP'],
description:
'CC - Cédula de Ciudadanía; CE - Cédula de Extranjería; NIT - Número de Identificación Tributaria; PASS - Passport; PEP - Permiso Especial de Permanencia',
},
ach_cop_email: { type: ['string', 'null'] },
ach_cop_bank_code: { type: ['string', 'null'] },
ach_cop_bank_account: { type: ['string', 'null'] },
swift_code_bic: { type: ['string', 'null'] },
swift_account_holder_name: {
type: ['string', 'null'],
maxLength: 50,
},
swift_account_number_iban: {
type: ['string', 'null'],
maxLength: 34,
},
swift_beneficiary_address_line_1: { type: ['string', 'null'] },
swift_beneficiary_address_line_2: { type: ['string', 'null'] },
swift_beneficiary_country: {
type: ['string', 'null'],
enum: [
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BQ',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
'BI',
'CV',
'KH',
'CM',
'CA',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
'CD',
'CG',
'CK',
'CR',
'HR',
'CU',
'CW',
'CY',
'CZ',
'CI',
'DK',
'DJ',
'DM',
'DO',
'EC',
'EG',
'SV',
'GQ',
'ER',
'EE',
'SZ',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'GF',
'PF',
'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GG',
'GN',
'GW',
'GY',
'HT',
'HM',
'VA',
'HN',
'HK',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IM',
'IL',
'IT',
'JM',
'JP',
'JE',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'ME',
'MS',
'MA',
'MZ',
'MM',
'NA',
'NR',
'NP',
'NL',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
'PK',
'PW',
'PS',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'MK',
'RO',
'RU',
'RW',
'RE',
'BL',
'SH',
'KN',
'LC',
'MF',
'PM',
'VC',
'WS',
'SM',
'ST',
'SA',
'SN',
'RS',
'SC',
'SL',
'SG',
'SX',
'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'SS',
'ES',
'LK',
'SD',
'SR',
'SJ',
'SE',
'CH',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TL',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
'TV',
'UG',
'UA',
'AE',
'GB',
'UM',
'US',
'UY',
'UZ',
'VU',
'VE',
'VN',
'VG',
'VI',
'WF',
'EH',
'YE',
'ZM',
'ZW',
'AX',
],
},
swift_beneficiary_city: { type: ['string', 'null'] },
swift_beneficiary_state_province_region: {
type: ['string', 'null'],
},
swift_beneficiary_postal_code: { type: ['string', 'null'] },
swift_bank_name: { type: ['string', 'null'] },
swift_bank_address_line_1: { type: ['string', 'null'] },
swift_bank_address_line_2: { type: ['string', 'null'] },
swift_bank_country: {
type: ['string', 'null'],
enum: [
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BQ',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
'BI',
'CV',
'KH',
'CM',
'CA',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
'CD',
'CG',
'CK',
'CR',
'HR',
'CU',
'CW',
'CY',
'CZ',
'CI',
'DK',
'DJ',
'DM',
'DO',
'EC',
'EG',
'SV',
'GQ',
'ER',
'EE',
'SZ',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'GF',
'PF',
'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GG',
'GN',
'GW',
'GY',
'HT',
'HM',
'VA',
'HN',
'HK',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IM',
'IL',
'IT',
'JM',
'JP',
'JE',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'ME',
'MS',
'MA',
'MZ',
'MM',
'NA',
'NR',
'NP',
'NL',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
'PK',
'PW',
'PS',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'MK',
'RO',
'RU',
'RW',
'RE',
'BL',
'SH',
'KN',
'LC',
'MF',
'PM',
'VC',
'WS',
'SM',
'ST',
'SA',
'SN',
'RS',
'SC',
'SL',
'SG',
'SX',
'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'SS',
'ES',
'LK',
'SD',
'SR',
'SJ',
'SE',
'CH',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TL',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
'TV',
'UG',
'UA',
'AE',
'GB',
'UM',
'US',
'UY',
'UZ',
'VU',
'VE',
'VN',
'VG',
'VI',
'WF',
'EH',
'YE',
'ZM',
'ZW',
'AX',
],
},
swift_bank_city: { type: ['string', 'null'] },
swift_bank_state_province_region: { type: ['string', 'null'] },
swift_bank_postal_code: { type: ['string', 'null'] },
swift_intermediary_bank_swift_code_bic: {
anyOf: [
{ type: 'string', minLength: 8, maxLength: 8 },
{ type: 'string', minLength: 11, maxLength: 11 },
{ type: 'null' },
],
},
swift_intermediary_bank_account_number_iban: {
type: ['string', 'null'],
maxLength: 34,
},
swift_intermediary_bank_name: { type: ['string', 'null'] },
swift_intermediary_bank_country: {
type: ['string', 'null'],
enum: [
'AF',
'AL',
'DZ',
'AS',
'AD',
'AO',
'AI',
'AQ',
'AG',
'AR',
'AM',
'AW',
'AU',
'AT',
'AZ',
'BS',
'BH',
'BD',
'BB',
'BY',
'BE',
'BZ',
'BJ',
'BM',
'BT',
'BO',
'BQ',
'BA',
'BW',
'BV',
'BR',
'IO',
'BN',
'BG',
'BF',
'BI',
'CV',
'KH',
'CM',
'CA',
'KY',
'CF',
'TD',
'CL',
'CN',
'CX',
'CC',
'CO',
'KM',
'CD',
'CG',
'CK',
'CR',
'HR',
'CU',
'CW',
'CY',
'CZ',
'CI',
'DK',
'DJ',
'DM',
'DO',
'EC',
'EG',
'SV',
'GQ',
'ER',
'EE',
'SZ',
'ET',
'FK',
'FO',
'FJ',
'FI',
'FR',
'GF',
'PF',
'TF',
'GA',
'GM',
'GE',
'DE',
'GH',
'GI',
'GR',
'GL',
'GD',
'GP',
'GU',
'GT',
'GG',
'GN',
'GW',
'GY',
'HT',
'HM',
'VA',
'HN',
'HK',
'HU',
'IS',
'IN',
'ID',
'IR',
'IQ',
'IE',
'IM',
'IL',
'IT',
'JM',
'JP',
'JE',
'JO',
'KZ',
'KE',
'KI',
'KP',
'KR',
'KW',
'KG',
'LA',
'LV',
'LB',
'LS',
'LR',
'LY',
'LI',
'LT',
'LU',
'MO',
'MG',
'MW',
'MY',
'MV',
'ML',
'MT',
'MH',
'MQ',
'MR',
'MU',
'YT',
'MX',
'FM',
'MD',
'MC',
'MN',
'ME',
'MS',
'MA',
'MZ',
'MM',
'NA',
'NR',
'NP',
'NL',
'NC',
'NZ',
'NI',
'NE',
'NG',
'NU',
'NF',
'MP',
'NO',
'OM',
'PK',
'PW',
'PS',
'PA',
'PG',
'PY',
'PE',
'PH',
'PN',
'PL',
'PT',
'PR',
'QA',
'MK',
'RO',
'RU',
'RW',
'RE',
'BL',
'SH',
'KN',
'LC',
'MF',
'PM',
'VC',
'WS',
'SM',
'ST',
'SA',
'SN',
'RS',
'SC',
'SL',
'SG',
'SX',
'SK',
'SI',
'SB',
'SO',
'ZA',
'GS',
'SS',
'ES',
'LK',
'SD',
'SR',
'SJ',
'SE',
'CH',
'SY',
'TW',
'TJ',
'TZ',
'TH',
'TL',
'TG',
'TK',
'TO',
'TT',
'TN',
'TR',
'TM',
'TC',
'TV',
'UG',
'UA',
'AE',
'GB',
'UM',
'US',
'UY',
'UZ',
'VU',
'VE',
'VN',
'VG',
'VI',
'WF',
'EH',
'YE',
'ZM',
'ZW',
'AX',
],
},
},
required: ['type', 'name'],
description: 'Create a new bank account',
},
},
required: ['receiver_id', 'instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/bank-accounts',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesReceiversBankAccountsById',
{
name: 'GetV1InstancesReceiversBankAccountsById',
description: `Retrieve Bank Account`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['receiver_id', 'instance_id', 'id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/bank-accounts/{id}',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'DeleteV1InstancesReceiversBankAccountsById',
{
name: 'DeleteV1InstancesReceiversBankAccountsById',
description: `Remove Bank Account`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['receiver_id', 'instance_id', 'id'],
},
method: 'delete',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/bank-accounts/{id}',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesReceiversVirtualAccounts',
{
name: 'GetV1InstancesReceiversVirtualAccounts',
description: `Retrieve Virtual Accounts`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['receiver_id', 'instance_id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/virtual-accounts',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesReceiversVirtualAccounts',
{
name: 'PostV1InstancesReceiversVirtualAccounts',
description: `Create Virtual Account`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
banking_partner: { type: 'string', enum: ['jpmorgan', 'citi'] },
token: { type: 'string', enum: ['USDC', 'USDT', 'USDB'] },
blockchain_wallet_id: { type: 'string' },
},
required: ['banking_partner', 'token', 'blockchain_wallet_id'],
description: 'Create a new virtual account',
},
},
required: ['receiver_id', 'instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/virtual-accounts',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesReceiversVirtualAccountsById',
{
name: 'GetV1InstancesReceiversVirtualAccountsById',
description: `Retrieve Virtual Account`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['receiver_id', 'instance_id', 'id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/virtual-accounts/{id}',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PutV1InstancesReceiversVirtualAccountsById',
{
name: 'PutV1InstancesReceiversVirtualAccountsById',
description: `Update Virtual Account`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
token: { type: 'string', enum: ['USDC', 'USDT', 'USDB'] },
blockchain_wallet_id: { type: 'string' },
},
required: ['token', 'blockchain_wallet_id'],
description: 'Update a new virtual account',
},
},
required: ['receiver_id', 'instance_id', 'id'],
},
method: 'put',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/virtual-accounts/{id}',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesReceiversBlockchainWalletsSignMessage',
{
name: 'GetV1InstancesReceiversBlockchainWalletsSignMessage',
description: `Retrieve Blockchain Wallet Message`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['receiver_id', 'instance_id'],
},
method: 'get',
pathTemplate:
'/v1/instances/{instance_id}/receivers/{receiver_id}/blockchain-wallets/sign-message',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesReceiversBlockchainWallets',
{
name: 'GetV1InstancesReceiversBlockchainWallets',
description: `Retrieve Blockchain Wallets`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['receiver_id', 'instance_id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/blockchain-wallets',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesReceiversBlockchainWallets',
{
name: 'PostV1InstancesReceiversBlockchainWallets',
description: `Add Blockchain Wallet`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
name: { type: 'string' },
network: {
type: 'string',
enum: [
'base',
'sepolia',
'arbitrum_sepolia',
'base_sepolia',
'arbitrum',
'polygon',
'polygon_amoy',
'ethereum',
'stellar',
'stellar_testnet',
'tron',
'solana',
'solana_devnet',
],
},
signature_tx_hash: { type: ['string', 'null'] },
address: { type: ['string', 'null'] },
is_account_abstraction: { type: ['boolean', 'null'] },
},
required: ['name', 'network'],
description: 'Create a new blockchain wallet',
},
},
required: ['receiver_id', 'instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/blockchain-wallets',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesReceiversBlockchainWalletsById',
{
name: 'GetV1InstancesReceiversBlockchainWalletsById',
description: `Retrieve Blockchain Wallet`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['receiver_id', 'instance_id', 'id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/blockchain-wallets/{id}',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'DeleteV1InstancesReceiversBlockchainWalletsById',
{
name: 'DeleteV1InstancesReceiversBlockchainWalletsById',
description: `Remove Blockchain Wallet`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['receiver_id', 'instance_id', 'id'],
},
method: 'delete',
pathTemplate: '/v1/instances/{instance_id}/receivers/{receiver_id}/blockchain-wallets/{id}',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesReceiversBankAccountsOfframpWallets',
{
name: 'GetV1InstancesReceiversBankAccountsOfframpWallets',
description: `Get Offramp Wallets`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
bank_account_id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['receiver_id', 'instance_id', 'bank_account_id'],
},
method: 'get',
pathTemplate:
'/v1/instances/{instance_id}/receivers/{receiver_id}/bank-accounts/{bank_account_id}/offramp-wallets',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
{ name: 'bank_account_id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesReceiversBankAccountsOfframpWallets',
{
name: 'PostV1InstancesReceiversBankAccountsOfframpWallets',
description: `Create Offramp Wallet`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
bank_account_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
external_id: { type: ['string', 'null'] },
network: { type: 'string', enum: ['tron', 'solana'] },
},
required: ['network'],
description: 'Create a new offramp wallet',
},
},
required: ['receiver_id', 'instance_id', 'bank_account_id'],
},
method: 'post',
pathTemplate:
'/v1/instances/{instance_id}/receivers/{receiver_id}/bank-accounts/{bank_account_id}/offramp-wallets',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
{ name: 'bank_account_id', in: 'path' },
],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesReceiversBankAccountsOfframpWalletsById',
{
name: 'GetV1InstancesReceiversBankAccountsOfframpWalletsById',
description: `Get Offramp Wallet`,
inputSchema: {
type: 'object',
properties: {
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
bank_account_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['receiver_id', 'instance_id', 'bank_account_id', 'id'],
},
method: 'get',
pathTemplate:
'/v1/instances/{instance_id}/receivers/{receiver_id}/bank-accounts/{bank_account_id}/offramp-wallets/{id}',
executionParameters: [
{ name: 'receiver_id', in: 'path' },
{ name: 'instance_id', in: 'path' },
{ name: 'bank_account_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesQuotes',
{
name: 'PostV1InstancesQuotes',
description: `Create Quote`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
bank_account_id: { type: 'string', minLength: 15, maxLength: 15 },
currency_type: {
type: 'string',
enum: ['sender', 'receiver'],
description: '',
},
cover_fees: {
type: ['boolean', 'null'],
description:
'If true, the sender will cover the fees. If false, the receiver will cover the fees.',
},
request_amount: {
type: 'number',
minimum: 100,
description: '100 represents 1, 2050 represents 20.50',
},
network: {
type: 'string',
enum: [
'base',
'sepolia',
'arbitrum_sepolia',
'base_sepolia',
'arbitrum',
'polygon',
'polygon_amoy',
'ethereum',
'stellar',
'stellar_testnet',
'tron',
'solana',
'solana_devnet',
],
description: 'Check blindpay available networks',
},
token: {
type: 'string',
enum: ['USDC', 'USDT', 'USDB'],
description: 'Check blindpay available tokens',
},
description: { type: ['string', 'null'], maxLength: 128 },
partner_fee_id: {
type: ['string', 'null'],
minLength: 15,
maxLength: 15,
},
transaction_document_type: {
type: ['string', 'null'],
enum: [
'invoice',
'purchase_order',
'delivery_slip',
'contract',
'customs_declaration',
'bill_of_lading',
'others',
],
},
transaction_document_id: {
type: ['string', 'null'],
maxLength: 512,
},
transaction_document_file: {
type: ['string', 'null'],
format: 'uri',
},
},
required: ['bank_account_id', 'currency_type', 'request_amount', 'network', 'token'],
description: 'Create a new quote',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/quotes',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesQuotesFx',
{
name: 'PostV1InstancesQuotesFx',
description: `Get FX Rate`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
from: { type: 'string', enum: ['USDC', 'USDT', 'USDB'] },
to: { type: 'string', enum: ['BRL', 'USD', 'MXN', 'COP', 'ARS'] },
request_amount: {
type: 'number',
minimum: 100,
description: '100 represents 1, 2050 represents 20.50',
},
currency_type: {
type: 'string',
enum: ['sender', 'receiver'],
description: '',
},
},
required: ['from', 'to', 'request_amount', 'currency_type'],
description: 'Check FX rate',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/quotes/fx',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesPayoutsById',
{
name: 'GetV1InstancesPayoutsById',
description: `Retrieve Payout`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id', 'id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/payouts/{id}',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1EPayoutsById',
{
name: 'GetV1EPayoutsById',
description: `Retrieve Payout Track`,
inputSchema: {
type: 'object',
properties: { id: { type: 'string', minLength: 15, maxLength: 15 } },
required: ['id'],
},
method: 'get',
pathTemplate: '/v1/e/payouts/{id}',
executionParameters: [{ name: 'id', in: 'path' }],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesPayouts',
{
name: 'GetV1InstancesPayouts',
description: `Retrieve Payouts`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
limit: {
type: 'string',
enum: ['10', '50', '100', '200', '500', '1000'],
description: 'Number of items to return',
},
offset: {
type: 'string',
enum: ['0', '10', '50', '100', '200', '500', '1000'],
description: 'Number of items to skip',
},
starting_after: {
type: 'string',
description:
'A cursor for use in pagination. starting_after is an object ID that defines your place in the list.',
},
ending_before: {
type: 'string',
description:
'A cursor for use in pagination. ending_before is an object ID that defines your place in the list.',
},
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
status: {
type: 'string',
enum: ['processing', 'failed', 'refunded', 'completed', 'on_hold'],
},
},
required: ['instance_id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/payouts',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'limit', in: 'query' },
{ name: 'offset', in: 'query' },
{ name: 'starting_after', in: 'query' },
{ name: 'ending_before', in: 'query' },
{ name: 'receiver_id', in: 'query' },
{ name: 'status', in: 'query' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesPayoutsStellarAuthorize',
{
name: 'PostV1InstancesPayoutsStellarAuthorize',
description: `Authorize Token Stellar`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
quote_id: { type: 'string', minLength: 15, maxLength: 15 },
sender_wallet_address: {
type: 'string',
description: 'Payout wallet address',
},
},
required: ['quote_id', 'sender_wallet_address'],
description: 'The JSON request body.',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/payouts/stellar/authorize',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesPayoutsStellar',
{
name: 'PostV1InstancesPayoutsStellar',
description: `Create Payout on Stellar`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
quote_id: { type: 'string', minLength: 15, maxLength: 15 },
signed_transaction: {
type: ['string', 'null'],
description: 'Signed transaction',
},
sender_wallet_address: {
type: 'string',
description: 'Payout wallet address',
},
},
required: ['quote_id', 'sender_wallet_address'],
description: 'Start payout on stellar blockchain',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/payouts/stellar',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesPayoutsSolana',
{
name: 'PostV1InstancesPayoutsSolana',
description: `Create Payout on Solana`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
quote_id: { type: 'string', minLength: 15, maxLength: 15 },
signed_transaction: {
type: ['string', 'null'],
description: 'Signed transaction',
},
sender_wallet_address: {
type: 'string',
description: 'Payout wallet address',
},
},
required: ['quote_id', 'sender_wallet_address'],
description: 'Start payout on solana blockchain',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/payouts/solana',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesPayoutsEvm',
{
name: 'PostV1InstancesPayoutsEvm',
description: `Create Payout on EVM Chains`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
quote_id: { type: 'string', minLength: 15, maxLength: 15 },
sender_wallet_address: {
type: 'string',
description: 'Payout wallet address',
},
},
required: ['quote_id', 'sender_wallet_address'],
description: 'Start payout on evm blockchain',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/payouts/evm',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesPayinQuotes',
{
name: 'PostV1InstancesPayinQuotes',
description: `Create Payin Quote`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
blockchain_wallet_id: {
type: 'string',
minLength: 15,
maxLength: 15,
},
currency_type: {
type: 'string',
enum: ['sender', 'receiver'],
description: '',
},
cover_fees: {
type: ['boolean', 'null'],
description:
'If true, the sender will cover the fees. If false, the receiver will cover the fees.',
},
request_amount: {
type: 'number',
minimum: 0,
description: '100 represents 1, 2050 represents 20.50',
},
payment_method: {
type: 'string',
enum: ['ach', 'wire', 'pix', 'spei', 'transfers', 'pse'],
},
token: { type: 'string', enum: ['USDC', 'USDT', 'USDB'] },
partner_fee_id: {
type: ['string', 'null'],
minLength: 15,
maxLength: 15,
},
payer_rules: {
type: ['object', 'null'],
properties: {
pix_allowed_tax_ids: {
type: ['array', 'null'],
items: { type: 'string', example: '149.476.777-58' },
},
transfers_allowed_tax_id: {
type: ['string', 'null'],
example: '20-12345678-3',
},
pse_allowed_tax_ids: {
type: ['array', 'null'],
items: { type: 'string', example: '1234567890' },
},
pse_full_name: { type: ['string', 'null'], maxLength: 50 },
pse_document_type: {
type: ['string', 'null'],
enum: ['CC', 'NIT'],
},
pse_document_number: { type: ['string', 'null'] },
pse_email: { type: ['string', 'null'], format: 'email' },
pse_phone: {
type: ['string', 'null'],
pattern: '^\\+573\\d{9}$',
},
pse_bank_code: { type: ['string', 'null'] },
},
},
is_otc: {
type: ['boolean', 'null'],
description:
'If true, the payin quote is for an OTC (Over the Counter) transaction',
},
},
required: [
'blockchain_wallet_id',
'currency_type',
'request_amount',
'payment_method',
'token',
],
description: 'Create a new quote',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/payin-quotes',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesPayinQuotesFx',
{
name: 'PostV1InstancesPayinQuotesFx',
description: `Get FX Rate`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
from: {
type: 'string',
enum: ['USDC', 'USDT', 'USDB', 'BRL', 'USD', 'MXN', 'COP', 'ARS'],
},
to: {
type: 'string',
enum: ['USDC', 'USDT', 'USDB', 'BRL', 'USD', 'MXN', 'COP', 'ARS'],
},
request_amount: {
type: 'number',
minimum: 0,
description: '100 represents 1, 2050 represents 20.50',
},
currency_type: {
type: 'string',
enum: ['sender', 'receiver'],
description: '',
},
},
required: ['from', 'to', 'request_amount', 'currency_type'],
description: 'Check FX rate',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/payin-quotes/fx',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesPayinsById',
{
name: 'GetV1InstancesPayinsById',
description: `Retrieve Payin`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id', 'id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/payins/{id}',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1EPayinsById',
{
name: 'GetV1EPayinsById',
description: `Retrieve Payin Track`,
inputSchema: {
type: 'object',
properties: { id: { type: 'string', minLength: 15, maxLength: 15 } },
required: ['id'],
},
method: 'get',
pathTemplate: '/v1/e/payins/{id}',
executionParameters: [{ name: 'id', in: 'path' }],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesPayins',
{
name: 'GetV1InstancesPayins',
description: `Retrieve Payins`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
limit: {
type: 'string',
enum: ['10', '50', '100', '200', '500', '1000'],
description: 'Number of items to return',
},
offset: {
type: 'string',
enum: ['0', '10', '50', '100', '200', '500', '1000'],
description: 'Number of items to skip',
},
starting_after: {
type: 'string',
description:
'A cursor for use in pagination. starting_after is an object ID that defines your place in the list.',
},
ending_before: {
type: 'string',
description:
'A cursor for use in pagination. ending_before is an object ID that defines your place in the list.',
},
receiver_id: { type: 'string', minLength: 15, maxLength: 15 },
status: {
type: 'string',
enum: ['processing', 'on_hold', 'failed', 'refunded', 'completed'],
},
},
required: ['instance_id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/payins',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'limit', in: 'query' },
{ name: 'offset', in: 'query' },
{ name: 'starting_after', in: 'query' },
{ name: 'ending_before', in: 'query' },
{ name: 'receiver_id', in: 'query' },
{ name: 'status', in: 'query' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesPayinsEvm',
{
name: 'PostV1InstancesPayinsEvm',
description: `Create Payin`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
payin_quote_id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['payin_quote_id'],
description: 'Start payin',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/payins/evm',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesApiKeys',
{
name: 'GetV1InstancesApiKeys',
description: `Retrieve Api Keys`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/api-keys',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesApiKeys',
{
name: 'PostV1InstancesApiKeys',
description: `Create Api Key`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
name: { type: 'string', minLength: 1 },
permission: { type: 'string', enum: ['full_access'] },
ip_whitelist: {
type: ['array', 'null'],
items: { type: 'string', format: 'ip' },
},
},
required: ['name', 'permission'],
description: 'Create a new api key',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/api-keys',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesApiKeysById',
{
name: 'GetV1InstancesApiKeysById',
description: `Retrieve Api Key`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id', 'id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/api-keys/{id}',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'DeleteV1InstancesApiKeysById',
{
name: 'DeleteV1InstancesApiKeysById',
description: `Delete Api Key`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id', 'id'],
},
method: 'delete',
pathTemplate: '/v1/instances/{instance_id}/api-keys/{id}',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesWebhookEndpoints',
{
name: 'GetV1InstancesWebhookEndpoints',
description: `Retrieve Webhooks`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/webhook-endpoints',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesWebhookEndpoints',
{
name: 'PostV1InstancesWebhookEndpoints',
description: `Register Webhook`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
url: { type: 'string', format: 'uri' },
events: {
type: 'array',
items: {
type: 'string',
enum: [
'receiver.new',
'receiver.update',
'bankAccount.new',
'payout.new',
'payout.update',
'payout.complete',
'payout.partnerFee',
'blockchainWallet.new',
'payin.new',
'payin.update',
'payin.complete',
'payin.partnerFee',
'tos.accept',
'limitIncrease.new',
'limitIncrease.update',
],
},
},
},
required: ['url', 'events'],
description: 'Create a new webhook endpoint',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/webhook-endpoints',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'DeleteV1InstancesWebhookEndpointsById',
{
name: 'DeleteV1InstancesWebhookEndpointsById',
description: `Remove Webhook`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id', 'id'],
},
method: 'delete',
pathTemplate: '/v1/instances/{instance_id}/webhook-endpoints/{id}',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesWebhookEndpointsSecret',
{
name: 'GetV1InstancesWebhookEndpointsSecret',
description: `Retrieve Webhook Secret`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id', 'id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/webhook-endpoints/{id}/secret',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesWebhookEndpointsPortalAccess',
{
name: 'GetV1InstancesWebhookEndpointsPortalAccess',
description: `Retrieve Webhook Portal Access`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/webhook-endpoints/portal-access',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesPartnerFees',
{
name: 'GetV1InstancesPartnerFees',
description: `Retrieve Partner Fees`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/partner-fees',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesPartnerFees',
{
name: 'PostV1InstancesPartnerFees',
description: `Add Partner Fee`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
name: { type: 'string' },
payout_percentage_fee: {
type: 'number',
minimum: 0,
maximum: 1000,
},
stellar_wallet_address: { type: ['string', 'null'], default: '' },
payout_flat_fee: { type: 'number', minimum: 0, maximum: 100000 },
payin_percentage_fee: {
type: 'number',
minimum: 0,
maximum: 1000,
},
payin_flat_fee: { type: 'number', minimum: 0, maximum: 100000 },
evm_wallet_address: { type: 'string' },
virtual_account_set: {
type: ['boolean', 'null'],
default: false,
},
},
required: [
'name',
'payout_percentage_fee',
'payout_flat_fee',
'payin_percentage_fee',
'payin_flat_fee',
'evm_wallet_address',
],
description: 'Create a new blockchain wallet',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/partner-fees',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1InstancesPartnerFeesById',
{
name: 'GetV1InstancesPartnerFeesById',
description: `Retrieve Partner Fee`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id', 'id'],
},
method: 'get',
pathTemplate: '/v1/instances/{instance_id}/partner-fees/{id}',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'DeleteV1InstancesPartnerFeesById',
{
name: 'DeleteV1InstancesPartnerFeesById',
description: `Remove Partner Fee`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
id: { type: 'string', minLength: 15, maxLength: 15 },
},
required: ['instance_id', 'id'],
},
method: 'delete',
pathTemplate: '/v1/instances/{instance_id}/partner-fees/{id}',
executionParameters: [
{ name: 'instance_id', in: 'path' },
{ name: 'id', in: 'path' },
],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1Upload',
{
name: 'PostV1Upload',
description: `Upload File`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string' },
requestBody: {
type: 'string',
description: 'Upload file to instance',
},
},
},
method: 'post',
pathTemplate: '/v1/upload',
executionParameters: [{ name: 'instance_id', in: 'query' }],
requestBodyContentType: 'multipart/form-data',
securityRequirements: [{ Bearer: [] }],
},
],
[
'GetV1AvailableBankDetails',
{
name: 'GetV1AvailableBankDetails',
description: `Bank Details`,
inputSchema: {
type: 'object',
properties: {
rail: {
type: 'string',
enum: [
'wire',
'ach',
'pix',
'pix_safe',
'spei_bitso',
'transfers_bitso',
'ach_cop_bitso',
'international_swift',
'rtp',
],
},
},
required: ['rail'],
},
method: 'get',
pathTemplate: '/v1/available/bank-details',
executionParameters: [{ name: 'rail', in: 'query' }],
requestBodyContentType: undefined,
securityRequirements: [],
},
],
[
'GetV1AvailableRails',
{
name: 'GetV1AvailableRails',
description: `Rails`,
inputSchema: { type: 'object', properties: {} },
method: 'get',
pathTemplate: '/v1/available/rails',
executionParameters: [],
requestBodyContentType: undefined,
securityRequirements: [],
},
],
[
'GetV1AvailableSwiftBySwift',
{
name: 'GetV1AvailableSwiftBySwift',
description: `Swift code bank details`,
inputSchema: {
type: 'object',
properties: {
swift: {
anyOf: [
{
type: 'string',
minLength: 8,
maxLength: 8,
pattern: '^[A-Z0-9]+$',
},
{
type: 'string',
minLength: 11,
maxLength: 11,
pattern: '^[A-Z0-9]+$',
},
],
},
},
required: ['swift'],
},
method: 'get',
pathTemplate: '/v1/available/swift/{swift}',
executionParameters: [{ name: 'swift', in: 'path' }],
requestBodyContentType: undefined,
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesMintUsdbSolana',
{
name: 'PostV1InstancesMintUsdbSolana',
description: `Mint USDB on Solana`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
address: { type: 'string' },
amount: { type: 'string' },
},
required: ['address', 'amount'],
description: 'The JSON request body.',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/mint-usdb-solana',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesPrepareDelegateSolana',
{
name: 'PostV1InstancesPrepareDelegateSolana',
description: `Prepares a delegation transaction for Solana token transfers. You can either provide a \`quote_id\` (recommended) to automatically use the correct token amount and address from the quote, or manually provide \`owner_address\`, \`token_address\`, and \`amount\`.`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
owner_address: {
type: 'string',
description: 'The Solana wallet address that owns the tokens',
},
quote_id: {
type: 'string',
minLength: 15,
maxLength: 15,
description:
'The quote ID. When provided, the API will automatically use the sender_amount and token_address from the quote. This is the recommended approach.',
},
token_address: {
type: 'string',
description: 'The SPL token mint address. Required if quote_id is not provided.',
},
amount: {
type: 'string',
description:
'The token amount to delegate in USDC/USDT units (e.g., "10.5" for 10.5 USDC). Required if quote_id is not provided. Note: This should be the TOKEN amount, not the local currency amount.',
},
},
required: ['owner_address'],
description: 'The JSON request body.',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/prepare-delegate-solana',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesCreateAssetTrustline',
{
name: 'PostV1InstancesCreateAssetTrustline',
description: `Create Asset Trustline`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: { address: { type: 'string' } },
required: ['address'],
description: 'The JSON request body.',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/create-asset-trustline',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
[
'PostV1InstancesMintUsdbStellar',
{
name: 'PostV1InstancesMintUsdbStellar',
description: `Mint USDB on Stellar`,
inputSchema: {
type: 'object',
properties: {
instance_id: { type: 'string', minLength: 15, maxLength: 15 },
requestBody: {
type: 'object',
properties: {
address: { type: 'string' },
amount: { type: 'string' },
signedXdr: { type: 'string' },
},
required: ['address', 'amount'],
description: 'The JSON request body.',
},
},
required: ['instance_id'],
},
method: 'post',
pathTemplate: '/v1/instances/{instance_id}/mint-usdb-stellar',
executionParameters: [{ name: 'instance_id', in: 'path' }],
requestBodyContentType: 'application/json',
securityRequirements: [{ Bearer: [] }],
},
],
]);
/**
* Security schemes from the OpenAPI spec
*/
const securitySchemes = {
Bearer: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT',
},
};
server.setRequestHandler(ListToolsRequestSchema, async () => {
const toolsForClient: Tool[] = Array.from(toolDefinitionMap.values()).map((def) => ({
name: def.name,
description: def.description,
inputSchema: def.inputSchema,
}));
return { tools: toolsForClient };
});
server.setRequestHandler(
CallToolRequestSchema,
async (request: CallToolRequest): Promise<CallToolResult> => {
const { name: toolName, arguments: toolArgs } = request.params;
const toolDefinition = toolDefinitionMap.get(toolName);
if (!toolDefinition) {
console.error(`Error: Unknown tool requested: ${toolName}`);
return {
content: [{ type: 'text', text: `Error: Unknown tool requested: ${toolName}` }],
};
}
return await executeApiTool(toolName, toolDefinition, toolArgs ?? {}, securitySchemes);
}
);
/**
* Type definition for cached OAuth tokens
*/
interface TokenCacheEntry {
token: string;
expiresAt: number;
}
/**
* Declare global __oauthTokenCache property for TypeScript
*/
declare global {
var __oauthTokenCache: Record<string, TokenCacheEntry> | undefined;
}
/**
* Acquires an OAuth2 token using client credentials flow
*
* @param schemeName Name of the security scheme
* @param scheme OAuth2 security scheme
* @returns Acquired token or null if unable to acquire
*/
async function acquireOAuth2Token(
schemeName: string,
scheme: any
): Promise<string | null | undefined> {
try {
// Check if we have the necessary credentials
const clientId = process.env[`OAUTH_CLIENT_ID_SCHEMENAME`];
const clientSecret = process.env[`OAUTH_CLIENT_SECRET_SCHEMENAME`];
const scopes = process.env[`OAUTH_SCOPES_SCHEMENAME`];
if (!clientId || !clientSecret) {
console.error(`Missing client credentials for OAuth2 scheme '${schemeName}'`);
return null;
}
// Initialize token cache if needed
if (typeof global.__oauthTokenCache === 'undefined') {
global.__oauthTokenCache = {};
}
// Check if we have a cached token
const cacheKey = `${schemeName}_${clientId}`;
const cachedToken = global.__oauthTokenCache[cacheKey];
const now = Date.now();
if (cachedToken && cachedToken.expiresAt > now) {
console.error(
`Using cached OAuth2 token for '${schemeName}' (expires in ${Math.floor(
(cachedToken.expiresAt - now) / 1000
)} seconds)`
);
return cachedToken.token;
}
// Determine token URL based on flow type
let tokenUrl = '';
if (scheme.flows?.clientCredentials?.tokenUrl) {
tokenUrl = scheme.flows.clientCredentials.tokenUrl;
console.error(`Using client credentials flow for '${schemeName}'`);
} else if (scheme.flows?.password?.tokenUrl) {
tokenUrl = scheme.flows.password.tokenUrl;
console.error(`Using password flow for '${schemeName}'`);
} else {
console.error(`No supported OAuth2 flow found for '${schemeName}'`);
return null;
}
// Prepare the token request
let formData = new URLSearchParams();
formData.append('grant_type', 'client_credentials');
// Add scopes if specified
if (scopes) {
formData.append('scope', scopes);
}
console.error(`Requesting OAuth2 token from ${tokenUrl}`);
// Make the token request
const response = await axios({
method: 'POST',
url: tokenUrl,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString('base64')}`,
},
data: formData.toString(),
});
// Process the response
if (response.data?.access_token) {
const token = response.data.access_token;
const expiresIn = response.data.expires_in || 3600; // Default to 1 hour
// Cache the token
global.__oauthTokenCache[cacheKey] = {
token,
expiresAt: now + expiresIn * 1000 - 60000, // Expire 1 minute early
};
console.error(
`Successfully acquired OAuth2 token for '${schemeName}' (expires in ${expiresIn} seconds)`
);
return token;
} else {
console.error(
`Failed to acquire OAuth2 token for '${schemeName}': No access_token in response`
);
return null;
}
} catch (error: unknown) {
const errorMessage = error instanceof Error ? error.message : String(error);
console.error(`Error acquiring OAuth2 token for '${schemeName}':`, errorMessage);
return null;
}
}
/**
* Executes an API tool with the provided arguments
*
* @param toolName Name of the tool to execute
* @param definition Tool definition
* @param toolArgs Arguments provided by the user
* @param allSecuritySchemes Security schemes from the OpenAPI spec
* @returns Call tool result
*/
async function executeApiTool(
toolName: string,
definition: McpToolDefinition,
toolArgs: JsonObject,
allSecuritySchemes: Record<string, any>
): Promise<CallToolResult> {
try {
// Auto-inject instance_id from environment if not provided
const defaultInstanceId = process.env.BLINDPAY_INSTANCE_ID;
if (
defaultInstanceId &&
definition.inputSchema?.required?.includes('instance_id') &&
!toolArgs.instance_id
) {
toolArgs.instance_id = defaultInstanceId;
console.error(`Auto-injected instance_id from BLINDPAY_INSTANCE_ID env var`);
}
// Validate arguments against the input schema
let validatedArgs: JsonObject;
try {
const zodSchema = getZodSchemaFromJsonSchema(definition.inputSchema, toolName);
const argsToParse = typeof toolArgs === 'object' && toolArgs !== null ? toolArgs : {};
validatedArgs = zodSchema.parse(argsToParse);
} catch (error: unknown) {
if (error instanceof ZodError) {
const validationErrorMessage = `Invalid arguments for tool '${toolName}': ${error.errors
.map((e) => `${e.path.join('.')} (${e.code}): ${e.message}`)
.join(', ')}`;
return { content: [{ type: 'text', text: validationErrorMessage }] };
} else {
const errorMessage = error instanceof Error ? error.message : String(error);
return {
content: [
{
type: 'text',
text: `Internal error during validation setup: ${errorMessage}`,
},
],
};
}
}
// Prepare URL, query parameters, headers, and request body
let urlPath = definition.pathTemplate;
const queryParams: Record<string, any> = {};
const headers: Record<string, string> = { Accept: 'application/json' };
let requestBodyData: any = undefined;
// Apply parameters to the URL path, query, or headers
definition.executionParameters.forEach((param) => {
const value = validatedArgs[param.name];
if (typeof value !== 'undefined' && value !== null) {
if (param.in === 'path') {
urlPath = urlPath.replace(`{${param.name}}`, encodeURIComponent(String(value)));
} else if (param.in === 'query') {
queryParams[param.name] = value;
} else if (param.in === 'header') {
headers[param.name.toLowerCase()] = String(value);
}
}
});
// Ensure all path parameters are resolved
if (urlPath.includes('{')) {
throw new Error(`Failed to resolve path parameters: ${urlPath}`);
}
// Construct the full URL
const requestUrl = API_BASE_URL ? `${API_BASE_URL}${urlPath}` : urlPath;
// Handle request body if needed
if (definition.requestBodyContentType && typeof validatedArgs['requestBody'] !== 'undefined') {
requestBodyData = validatedArgs['requestBody'];
headers['content-type'] = definition.requestBodyContentType;
}
// Apply security requirements if available
// Security requirements use OR between array items and AND within each object
const appliedSecurity = definition.securityRequirements?.find((req) => {
// Try each security requirement (combined with OR)
return Object.entries(req).every(([schemeName, scopesArray]) => {
const scheme = allSecuritySchemes[schemeName];
if (!scheme) return false;
// API Key security (header, query, cookie)
if (scheme.type === 'apiKey') {
return !!process.env[`API_KEY_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`];
}
// HTTP security (basic, bearer)
if (scheme.type === 'http') {
if (scheme.scheme?.toLowerCase() === 'bearer') {
// Check for BLINDPAY_API_KEY first, then fall back to BEARER_TOKEN_{SCHEME}
return (
!!process.env.BLINDPAY_API_KEY ||
!!process.env[
`BEARER_TOKEN_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`
]
);
} else if (scheme.scheme?.toLowerCase() === 'basic') {
return (
!!process.env[
`BASIC_USERNAME_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`
] &&
!!process.env[
`BASIC_PASSWORD_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`
]
);
}
}
// OAuth2 security
if (scheme.type === 'oauth2') {
// Check for pre-existing token
if (
process.env[`OAUTH_TOKEN_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`]
) {
return true;
}
// Check for client credentials for auto-acquisition
if (
process.env[
`OAUTH_CLIENT_ID_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`
] &&
process.env[
`OAUTH_CLIENT_SECRET_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`
]
) {
// Verify we have a supported flow
if (scheme.flows?.clientCredentials || scheme.flows?.password) {
return true;
}
}
return false;
}
// OpenID Connect
if (scheme.type === 'openIdConnect') {
return !!process.env[
`OPENID_TOKEN_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`
];
}
return false;
});
});
// If we found matching security scheme(s), apply them
if (appliedSecurity) {
// Apply each security scheme from this requirement (combined with AND)
for (const [schemeName, scopesArray] of Object.entries(appliedSecurity)) {
const scheme = allSecuritySchemes[schemeName];
// API Key security
if (scheme?.type === 'apiKey') {
const apiKey =
process.env[`API_KEY_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`];
if (apiKey) {
if (scheme.in === 'header') {
headers[scheme.name.toLowerCase()] = apiKey;
console.error(`Applied API key '${schemeName}' in header '${scheme.name}'`);
} else if (scheme.in === 'query') {
queryParams[scheme.name] = apiKey;
console.error(`Applied API key '${schemeName}' in query parameter '${scheme.name}'`);
} else if (scheme.in === 'cookie') {
// Add the cookie, preserving other cookies if they exist
headers['cookie'] = `${scheme.name}=${apiKey}${
headers['cookie'] ? `; ${headers['cookie']}` : ''
}`;
console.error(`Applied API key '${schemeName}' in cookie '${scheme.name}'`);
}
}
}
// HTTP security (Bearer or Basic)
else if (scheme?.type === 'http') {
if (scheme.scheme?.toLowerCase() === 'bearer') {
// Use BLINDPAY_API_KEY first, then fall back to BEARER_TOKEN_{SCHEME}
const token =
process.env.BLINDPAY_API_KEY ||
process.env[`BEARER_TOKEN_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`];
if (token) {
headers['authorization'] = `Bearer ${token}`;
console.error(`Applied Bearer token for '${schemeName}'`);
}
} else if (scheme.scheme?.toLowerCase() === 'basic') {
const username =
process.env[
`BASIC_USERNAME_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`
];
const password =
process.env[
`BASIC_PASSWORD_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`
];
if (username && password) {
headers['authorization'] = `Basic ${Buffer.from(`${username}:${password}`).toString(
'base64'
)}`;
console.error(`Applied Basic authentication for '${schemeName}'`);
}
}
}
// OAuth2 security
else if (scheme?.type === 'oauth2') {
// First try to use a pre-provided token
let token =
process.env[`OAUTH_TOKEN_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`];
// If no token but we have client credentials, try to acquire a token
if (!token && (scheme.flows?.clientCredentials || scheme.flows?.password)) {
console.error(`Attempting to acquire OAuth token for '${schemeName}'`);
token = (await acquireOAuth2Token(schemeName, scheme)) ?? '';
}
// Apply token if available
if (token) {
headers['authorization'] = `Bearer ${token}`;
console.error(`Applied OAuth2 token for '${schemeName}'`);
// List the scopes that were requested, if any
const scopes = scopesArray as string[];
if (scopes && scopes.length > 0) {
console.error(`Requested scopes: ${scopes.join(', ')}`);
}
}
}
// OpenID Connect
else if (scheme?.type === 'openIdConnect') {
const token =
process.env[`OPENID_TOKEN_${schemeName.replace(/[^a-zA-Z0-9]/g, '_').toUpperCase()}`];
if (token) {
headers['authorization'] = `Bearer ${token}`;
console.error(`Applied OpenID Connect token for '${schemeName}'`);
// List the scopes that were requested, if any
const scopes = scopesArray as string[];
if (scopes && scopes.length > 0) {
console.error(`Requested scopes: ${scopes.join(', ')}`);
}
}
}
}
}
// Log warning if security is required but not available
else if (definition.securityRequirements?.length > 0) {
// First generate a more readable representation of the security requirements
const securityRequirementsString = definition.securityRequirements
.map((req) => {
const parts = Object.entries(req)
.map(([name, scopesArray]) => {
const scopes = scopesArray as string[];
if (scopes.length === 0) return name;
return `${name} (scopes: ${scopes.join(', ')})`;
})
.join(' AND ');
return `[${parts}]`;
})
.join(' OR ');
console.warn(
`Tool '${toolName}' requires security: ${securityRequirementsString}, but no suitable credentials found.`
);
}
// Prepare the axios request configuration
const config: AxiosRequestConfig = {
method: definition.method.toUpperCase(),
url: requestUrl,
params: queryParams,
headers: headers,
...(requestBodyData !== undefined && { data: requestBodyData }),
};
// Log request info to stderr (doesn't affect MCP output)
console.error(`Executing tool "${toolName}": ${config.method} ${config.url}`);
// Execute the request
const response = await axios(config);
// Process and format the response
let responseText = '';
const contentType = response.headers['content-type']?.toLowerCase() || '';
// Handle JSON responses
if (
contentType.includes('application/json') &&
typeof response.data === 'object' &&
response.data !== null
) {
try {
responseText = JSON.stringify(response.data, null, 2);
} catch (e) {
responseText = '[Stringify Error]';
}
}
// Handle string responses
else if (typeof response.data === 'string') {
responseText = response.data;
}
// Handle other response types
else if (response.data !== undefined && response.data !== null) {
responseText = String(response.data);
}
// Handle empty responses
else {
responseText = `(Status: ${response.status} - No body content)`;
}
// Return formatted response
return {
content: [
{
type: 'text',
text: `API Response (Status: ${response.status}):\n${responseText}`,
},
],
};
} catch (error: unknown) {
// Handle errors during execution
let errorMessage: string;
// Format Axios errors specially
if (axios.isAxiosError(error)) {
errorMessage = formatApiError(error);
}
// Handle standard errors
else if (error instanceof Error) {
errorMessage = error.message;
}
// Handle unexpected error types
else {
errorMessage = 'Unexpected error: ' + String(error);
}
// Log error to stderr
console.error(`Error during execution of tool '${toolName}':`, errorMessage);
// Return error message to client
return { content: [{ type: 'text', text: errorMessage }] };
}
}
/**
* Main function to start the server
*/
async function main() {
// Set up stdio transport
try {
const transport = new StdioServerTransport();
await mcpServer.server.connect(transport);
console.error(`${SERVER_NAME} MCP Server (v${SERVER_VERSION}) running on stdio`);
} catch (error) {
console.error('Error during server startup:', error);
process.exit(1);
}
}
/**
* Cleanup function for graceful shutdown
*/
async function cleanup() {
console.error('Shutting down MCP server...');
process.exit(0);
}
// Register signal handlers
process.on('SIGINT', cleanup);
process.on('SIGTERM', cleanup);
// Start the server
main().catch((error) => {
console.error('Fatal error in main execution:', error);
process.exit(1);
});
/**
* Formats API errors for better readability
*
* @param error Axios error
* @returns Formatted error message
*/
function formatApiError(error: AxiosError): string {
let message = 'API request failed.';
if (error.response) {
message = `API Error: Status ${error.response.status} (${
error.response.statusText || 'Status text not available'
}). `;
const responseData = error.response.data;
const MAX_LEN = 200;
if (typeof responseData === 'string') {
message += `Response: ${responseData.substring(0, MAX_LEN)}${
responseData.length > MAX_LEN ? '...' : ''
}`;
} else if (responseData) {
try {
const jsonString = JSON.stringify(responseData);
message += `Response: ${jsonString.substring(0, MAX_LEN)}${
jsonString.length > MAX_LEN ? '...' : ''
}`;
} catch {
message += 'Response: [Could not serialize data]';
}
} else {
message += 'No response body received.';
}
} else if (error.request) {
message = 'API Network Error: No response received from server.';
if (error.code) message += ` (Code: ${error.code})`;
} else {
message += `API Request Setup Error: ${error.message}`;
}
return message;
}
/**
* Converts a JSON Schema to a Zod schema for runtime validation
*
* @param jsonSchema JSON Schema
* @param toolName Tool name for error reporting
* @returns Zod schema
*/
function getZodSchemaFromJsonSchema(jsonSchema: any, toolName: string): z.ZodTypeAny {
if (typeof jsonSchema !== 'object' || jsonSchema === null) {
return z.object({}).passthrough();
}
try {
const zodSchemaString = jsonSchemaToZod(jsonSchema);
const zodSchema = eval(zodSchemaString);
if (typeof zodSchema?.parse !== 'function') {
throw new Error('Eval did not produce a valid Zod schema.');
}
return zodSchema as z.ZodTypeAny;
} catch (err: any) {
console.error(`Failed to generate/evaluate Zod schema for '${toolName}':`, err);
return z.object({}).passthrough();
}
}