All connectors

Mercury

Official

Mercury

Connect your Mercury business account so your agents can check current and available balances, review transactions, follow SAFE signing and payment progress, and download statements and SAFE documents.

Read access also includes treasury and credit accounts, recipients, approval requests, customers, invoices, categories, cards, users, events and webhooks.

With write access, agents can send money, transfer funds, request payment approvals, manage recipients and invoices, update transaction notes and categories, upload receipts and tax documents, issue and manage virtual cards, and configure webhooks. Your Mercury token permissions and approval policies still apply.

SAFE access covers the information and documents Mercury exposes. Creating, editing and signing SAFEs remain in Mercury. Agent card numbers and CVCs are available only when you explicitly enable that connection setting.

Connect your Mercury account.

Setup instructions

Connect Mercury

  1. Create a Read Only token under Settings → Tokens. Ask your organization admin if this page is unavailable.
  2. Paste the complete token, including secret-token:, into Houston's API token.
  3. Choose Read for Access and save, or configure writes as described below.

Token guide.

Advanced

Payments and changes

Choose Write for Access and grant only the needed Mercury scopes. Mercury write tokens require an IP allowlist containing Houston's server egress addresses, obtained from your Houston operator. A Custom token with RequestSendMoney can queue payments for approval without an IP allowlist. Approvals happen in Mercury.

Enable Allow revealing agent card numbers and CVCs only when agents need those sensitive agent-card details; ordinary cards are not supported.

Token maintenance

This connector supports production Mercury, not sandbox or OAuth connections. Mercury may remove inactive tokens or downgrade unused write permissions after 45 days. Check scopes and IP restrictions if access stops.

Token policies.

Files

  • connector.luau
    -- Preserve Mercury's native field names, amounts, nulls and pagination.
    type Options = {[string]: any}
    type Query = {type: string, minimum: number?, maximum: number?, enum: {any}?}
    type Endpoint = {
    	method: string, path: string, write: boolean, body: boolean, query: {[string]: Query},
    	required: {string}, kind: string, response: string, list: string, empty: boolean, vault: boolean, help: string,
    }
    local endpoints: {[string]: Endpoint} = require("lib/endpoints.luau")
    local NULL = json.decode("null")
    
    local function text(value: any, field: string): string
    	assert(type(value) == "string" and value ~= "", field .. " must be a nonempty string")
    	return value
    end
    
    local function options(input: Options?): Options
    	if input == nil then return {} end
    	assert(type(input) == "table", "opts must be an object")
    	for key in input do assert(type(key) == "string", "opts must have named fields") end
    	return table.clone(input)
    end
    
    local function identifier(value: any, field: string): string
    	local id = text(value, field)
    	assert(string.match(id, "^[%w%-_]+$"), field .. " must be an ID, not a URL or path")
    	return id
    end
    
    local function queryValue(value: any, field: string, spec: Query): string
    	if spec.type == "integer" then
    		assert(type(value) == "number" and value % 1 == 0 and math.abs(value) <= 9007199254740991, field .. " must be a safe integer")
    		assert(spec.minimum == nil or value >= spec.minimum, field .. " is below the allowed minimum")
    		assert(spec.maximum == nil or value <= spec.maximum, field .. " exceeds the allowed maximum")
    	elseif spec.type == "boolean" then
    		assert(type(value) == "boolean", field .. " must be a boolean")
    	else
    		text(value, field)
    	end
    	if spec.enum then assert(table.find(spec.enum, value), field .. " has an unsupported value") end
    	return url.encode(value)
    end
    
    local function fail(name: string, response: HttpResponse): never
    	local ok, value = pcall(json.decode, await(response.body:readPrefix(4096)))
    	local message = "Mercury HTTP " .. tostring(response.statusCode)
    	if ok and type(value) == "table" then
    		local detail = value.message or value.error
    		if type(detail) == "string" then message ..= ": " .. string.sub(detail, 1, 600) end
    	end
    	local retry = response.headers["retry-after"]
    	if retry and retry[1] then message ..= "; Retry-After: " .. retry[1] end
    	return houston.fail({operation = name, layer = "upstream", upstream_status = response.statusCode,
    		retryable = response.statusCode == 429 or response.statusCode >= 500, message = message})
    end
    
    local function invalidResponse(name: string, status: number): never
    	return houston.fail({operation = name, layer = "upstream", upstream_status = status,
    		retryable = false, message = "Mercury returned an invalid response"})
    end
    
    local function responseJSON(name: string, endpoint: Endpoint, response: HttpResponse): any
    	if response.statusCode < 200 or response.statusCode >= 300 then fail(name, response) end
    	if response.statusCode == 204 then
    		response.body:close()
    		if not endpoint.empty then invalidResponse(name, response.statusCode) end
    		return {success = true}
    	end
    	local raw = await(response.body:readAll())
    	if endpoint.empty and string.match(raw, "^%s*$") then return {success = true} end
    	local ok, value = pcall(json.decode, raw)
    	if ok and endpoint.empty and value == NULL then return {success = true} end
    	local array = string.match(raw, "^%s*%[") ~= nil
    	if not ok or type(value) ~= "table" or (not endpoint.empty and (endpoint.response == "array") ~= array)
    		or (not array and not string.match(raw, "^%s*{")) then
    		invalidResponse(name, response.statusCode)
    	end
    	if value.error ~= nil or value.errors ~= nil then invalidResponse(name, response.statusCode) end
    	if endpoint.list ~= "" then
    		local items = value[endpoint.list]
    		if type(items) ~= "table" or not string.match(json.encode(items), "^%[") then invalidResponse(name, response.statusCode) end
    	end
    	return value
    end
    
    local function uploadBody(name: string, args: Options): (Reader, string)
    	local path = text(args.path, "path")
    	local filename = text(args.filename or string.match(path, "[^/]+$"), "filename")
    	assert(#filename <= 299 and not string.find(filename, "[\r\n]"), "filename must be at most 299 bytes without newlines")
    	local contentType = text(args.contentType or "application/octet-stream", "contentType")
    	assert(not string.find(contentType, "[\r\n]"), "contentType must not contain newlines")
    	args.path, args.filename, args.contentType = nil, nil, nil
    	local parts: {MultipartPart} = {}
    	if name == "uploadTransactionAttachment" and args.attachmentType ~= nil then
    		assert(table.find({"receipt", "bill", "other"}, args.attachmentType), "attachmentType must be receipt, bill or other")
    		table.insert(parts, {name = "attachmentType", body = args.attachmentType})
    		args.attachmentType = nil
    	end
    	assert(next(args) == nil, name .. " received an unknown option")
    	assert(await(fs.stat(path)).size <= 32 * 1024 * 1024, "Mercury uploads must not exceed 32 MB")
    	table.insert(parts, {name = "file", filename = filename, contentType = contentType, body = fs.open(path, "r")})
    	local form = multipart.create(parts)
    	return form.body, form.contentType
    end
    
    local function request(name: string, endpoint: Endpoint, input: Options?): any
    	local args = options(input)
    	local path = string.gsub(endpoint.path, "{([%w_]+)}", function(field: string)
    		local value = identifier(args[field], field)
    		args[field] = nil
    		return value
    	end)
    	assert(not (args.start_after ~= nil and args.end_before ~= nil), "start_after and end_before cannot be combined")
    	local query: {string} = {}
    	for field, spec in endpoint.query do
    		if args[field] ~= nil then
    			table.insert(query, url.encode(field) .. "=" .. queryValue(args[field], field, spec))
    			args[field] = nil
    		end
    	end
    	table.sort(query)
    	if #query > 0 then path ..= "?" .. table.concat(query, "&") end
    	local headers: HttpHeaders = {Accept = {if endpoint.kind == "download" then "application/pdf" else "application/json"}}
    	local body: any = nil
    	local destination: string? = nil
    	if endpoint.kind == "download" then
    		destination = text(args.path, "path")
    		args.path = nil
    		assert(next(args) == nil, name .. " received an unknown option")
    	elseif endpoint.kind == "upload" then
    		local contentType: string
    		body, contentType = uploadBody(name, args)
    		headers["Content-Type"] = {contentType}
    	elseif endpoint.body then
    		for _, field in endpoint.required do
    			assert(args[field] ~= nil and args[field] ~= NULL, field .. " is required")
    		end
    		if args.amount ~= nil then
    			assert(type(args.amount) == "number" and args.amount > 0 and args.amount < math.huge, "amount must be a positive finite dollar amount")
    		end
    		if args.idempotencyKey ~= nil then text(args.idempotencyKey, "idempotencyKey") end
    		if name == "createCard" then assert(args.type == "virtual", "Mercury only issues virtual cards through the API") end
    		headers["Content-Type"] = {"application/json"}
    		body = json.encode(args)
    	else
    		assert(next(args) == nil, name .. " received an unknown option")
    	end
    	local origin = if endpoint.vault then "https://vault-api.mercury.com" else "https://api.mercury.com"
    	local response = await(http.request({method = endpoint.method, url = origin .. path, headers = headers, body = body}))
    	if destination then
    		if response.statusCode ~= 200 then fail(name, response) end
    		local contentType = response.headers["content-type"]
    		local mediaType = if contentType then string.lower(string.match(contentType[1] or "", "^%s*([^;]+)") or "") else ""
    		mediaType = string.gsub(mediaType, "%s+$", "")
    		if mediaType ~= "application/pdf" then
    			response.body:close()
    			invalidResponse(name, response.statusCode)
    		end
    		local file = fs.open(destination, "w")
    		file:write(response.body)
    		await(file:close())
    		return {path = destination, size = await(fs.stat(destination)).size, url = await(fs.signedGetUrl(destination))}
    	end
    	return responseJSON(name, endpoint, response)
    end
    
    local exports: {[string]: any} = {}
    for name, endpoint in endpoints do
    	if (not endpoint.write or houston.allows("data:write")) and (not endpoint.vault or config.reveal_card_details == true) then
    		exports[name] = function(args: Options?): any return request(name, endpoint, args) end
    	end
    end
    exports.help = function(): string
    	local names: {string} = {}
    	for name in exports do if name ~= "help" then table.insert(names, name) end end
    	table.sort(names)
    	local lines = {
    		"Mercury API v1. Each function takes one named options object with Mercury's native field names; ? marks optional fields. Path and query options are removed from the JSON body; remaining body fields, nested objects, nulls and arrays pass through unchanged. Responses preserve all native fields. Empty successful mutations return {success=true}.",
    		"getAccounts() returns accounts with currentBalance and availableBalance in dollars; getTreasury() and listCredit() return separate account types. Do not sum accounts of different kinds without checking what their balances represent.",
    		"getSafeRequests() returns an array, not an envelope. getSafeRequest({safeRequestId=...}) includes signedByInvestorAt, signedByOwnerAt, paidAt, canceledAt and expiresAt. Missing/null timestamps do not imply completion. There is no synthetic SAFE status and no documented SAFE creation, editing or signing endpoint. getSafeRequestDocument({safeRequestId=...,path='safe.pdf'}) downloads the PDF.",
    		"Lists fetch one page only. For cursor lists pass response.page.nextPage as start_after until absent; end_before navigates backwards and cannot be combined with start_after. getTreasuryTransactions uses response.cursor as opts.cursor; listAccountTransactions uses offset/limit and total. getSafeRequests, getAccountCards, listCredit and listInvoiceAttachments are unpaginated. Limits and query enums follow the linked API reference; most limits are 1..1000.",
    		"Pass json.decode('null') to clear nullable body fields and json.decode('[]') for empty arrays. updateTransaction({transactionId=...,note=json.decode('null'),categoryId=json.decode('null')}) clears metadata. Amounts are dollars, not cents. Never invent idempotencyKey: supply and retain one unique key per intended payment/transfer; reuse it only for the same intended request after checking its outcome.",
    		"Writes are omitted without write access. Mercury token scopes, account eligibility, IP allowlists and approval policies also apply. createTransaction and createInternalTransfer move money; requestSendMoney and requestTransferMoney create approval requests. There are no API approval/denial operations. verifyWebhook sends an external test event; recipient invites and invoices can send email according to their body options. No automatic retries, paging or polling; after an ambiguous write failure inspect Mercury before repeating it. 429/5xx errors include retryability and Retry-After when provided.",
    		"PDF downloads stream to a session file and return {path,url,size}; url is Houston's signed download URL. A failed transfer leaves the path as it was. Uploads stream a session file as multipart, with optional filename/contentType; maximum 32 MB and filename 299 bytes. uploadTransactionAttachment accepts attachmentType receipt/bill/other. getAttachment and listInvoiceAttachments return expiring signed attachment URLs; fetch a fresh URL before using it. Arbitrary external downloads are not connector operations.",
    		"Cards can be issued only as virtual cards for existing users; physical issuance and user creation use the Mercury dashboard. revealCardPan appears only when Allow revealing agent card numbers and CVCs is enabled; it uses Mercury's dedicated Vault host and only supports agent cards. Its response and webhook signing secrets are sensitive: do not log or save them in shared actions or memories.",
    		"Connect using a Mercury API token; Houston injects it privately. OAuth client onboarding requires Mercury approval and is not part of this token connector. Complete nested request schemas, feature eligibility and response definitions are in each operation's reference link.",
    	}
    	for _, name in names do table.insert(lines, name .. "(opts): " .. endpoints[name].help) end
    	return table.concat(lines, "\n")
    end
    return exports
    
  • houston.json
    {
      "schema_version": 2,
      "name": "Mercury",
      "files": [
        "connector.luau"
      ],
      "icon": "icon.svg",
      "access": [
        {
          "name": "data",
          "label": "Access",
          "levels": [
            {
              "value": "read",
              "label": "Read"
            },
            {
              "value": "write",
              "label": "Write"
            }
          ],
          "default": "read"
        }
      ],
      "config": {
        "reveal_card_details": {
          "default": false,
          "label": "Allow revealing agent card numbers and CVCs",
          "type": "boolean"
        }
      },
      "auth": {
        "token": {
          "config": {
            "token": {
              "label": "API token (including secret-token: prefix)",
              "required": true,
              "type": "secret"
            }
          },
          "label": "Mercury API token",
          "type": "manual"
        }
      },
      "proxy": [
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.data \"write\" }}",
          "match": {
            "host": [
              "api.mercury.com"
            ],
            "method": [
              "DELETE"
            ],
            "path": [
              "/api/v1/ar/customers/{customerId}",
              "/api/v1/categories/{expenseCategoryId}",
              "/api/v1/recipient/{recipientId}",
              "/api/v1/recipients/invites/{inviteId}",
              "/api/v1/webhooks/{webhookEndpointId}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token}}"
              }
            }
          },
          "match": {
            "host": [
              "api.mercury.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/api/v1/account/{accountId}/cards",
              "/api/v1/account/{accountId}/statements",
              "/api/v1/account/{accountId}/transaction/{transactionId}",
              "/api/v1/account/{accountId}/transactions",
              "/api/v1/accounts",
              "/api/v1/ar/attachments/{attachmentId}",
              "/api/v1/ar/customers",
              "/api/v1/ar/customers/{customerId}",
              "/api/v1/ar/invoices",
              "/api/v1/ar/invoices/{invoiceId}",
              "/api/v1/ar/invoices/{invoiceId}/attachments",
              "/api/v1/ar/invoices/{invoiceId}/pdf",
              "/api/v1/cards",
              "/api/v1/cards/{cardId}",
              "/api/v1/categories",
              "/api/v1/credit",
              "/api/v1/events",
              "/api/v1/events/{eventId}",
              "/api/v1/merchants",
              "/api/v1/organization",
              "/api/v1/recipient/{recipientId}",
              "/api/v1/recipients",
              "/api/v1/recipients/attachments",
              "/api/v1/recipients/invites",
              "/api/v1/recipients/invites/{inviteId}",
              "/api/v1/request-send-money",
              "/api/v1/request-send-money/{requestId}",
              "/api/v1/request-transfer",
              "/api/v1/request-transfer/{requestId}",
              "/api/v1/safes",
              "/api/v1/safes/{safeRequestId}",
              "/api/v1/safes/{safeRequestId}/document",
              "/api/v1/statements/{statementId}/pdf",
              "/api/v1/transaction/{transactionId}",
              "/api/v1/transactions",
              "/api/v1/treasury",
              "/api/v1/treasury/{treasuryId}/statements",
              "/api/v1/treasury/{treasuryId}/transactions",
              "/api/v1/users",
              "/api/v1/users/{userId}",
              "/api/v1/webhooks",
              "/api/v1/webhooks/{webhookEndpointId}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.data \"write\" }}",
          "match": {
            "host": [
              "api.mercury.com"
            ],
            "method": [
              "PATCH"
            ],
            "path": [
              "/api/v1/transaction/{transactionId}"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token}}"
              }
            }
          },
          "if": "{{ allows access.data \"write\" }}",
          "match": {
            "host": [
              "api.mercury.com"
            ],
            "method": [
              "POST"
            ],
            "path": [
              "/api/v1/account/{accountId}/request-send-money",
              "/api/v1/account/{accountId}/transactions",
              "/api/v1/ar/customers",
              "/api/v1/ar/customers/{customerId}",
              "/api/v1/ar/invoices",
              "/api/v1/ar/invoices/{invoiceId}",
              "/api/v1/ar/invoices/{invoiceId}/cancel",
              "/api/v1/cards",
              "/api/v1/cards/{cardId}",
              "/api/v1/cards/{cardId}/cancel",
              "/api/v1/cards/{cardId}/freeze",
              "/api/v1/cards/{cardId}/unfreeze",
              "/api/v1/categories",
              "/api/v1/categories/{expenseCategoryId}",
              "/api/v1/recipient/{recipientId}",
              "/api/v1/recipient/{recipientId}/attachments",
              "/api/v1/recipients",
              "/api/v1/recipients/invites",
              "/api/v1/request-transfer",
              "/api/v1/transaction/{transactionId}/attachments",
              "/api/v1/transfer",
              "/api/v1/webhooks",
              "/api/v1/webhooks/{webhookEndpointId}",
              "/api/v1/webhooks/{webhookEndpointId}/verify"
            ],
            "protocol": "http"
          }
        },
        {
          "action": {
            "headers": {
              "set": {
                "Authorization": "Bearer {{auth.token.token}}"
              }
            }
          },
          "if": "{{ is config.reveal_card_details true }}",
          "match": {
            "host": [
              "vault-api.mercury.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/api/v1/cards/{cardId}/reveal"
            ],
            "protocol": "http"
          }
        }
      ]
    }
    
  • icon.svgicon.svg
  • lib
    • endpoints.luau
      -- Mercury's published OpenAPI operations, reviewed 2026-10-10.
      -- Keep paths, query names and native response fields aligned with the linked reference.
      return {
      	cancelCard = {body = false, empty = false, help = "Cancel a card. {cardId}. https://docs.mercury.com/reference/cancelcard", kind = "json", list = "", method = "POST", path = "/api/v1/cards/{cardId}/cancel", query = {}, required = {}, response = "object", vault = false, write = true},
      	cancelInvoice = {body = false, empty = true, help = "Cancel an invoice. {invoiceId}. https://docs.mercury.com/reference/cancelinvoice", kind = "json", list = "", method = "POST", path = "/api/v1/ar/invoices/{invoiceId}/cancel", query = {}, required = {}, response = "object", vault = false, write = true},
      	createCard = {body = true, empty = false, help = "Create a card. {accountId?, kind, nickname?, spendLimit?, type, userId}. https://docs.mercury.com/reference/createcard", kind = "json", list = "", method = "POST", path = "/api/v1/cards", query = {}, required = {"kind", "type", "userId"}, response = "object", vault = false, write = true},
      	createCategory = {body = true, empty = false, help = "Create a new category. {name, visibleForCardSpend, visibleForOther, visibleForReimbursements}. https://docs.mercury.com/reference/createcategory", kind = "json", list = "", method = "POST", path = "/api/v1/categories", query = {}, required = {"name", "visibleForCardSpend", "visibleForOther", "visibleForReimbursements"}, response = "object", vault = false, write = true},
      	createCustomer = {body = true, empty = false, help = "Create a customer. {address?, email, name}. https://docs.mercury.com/reference/createcustomer", kind = "json", list = "", method = "POST", path = "/api/v1/ar/customers", query = {}, required = {"email", "name"}, response = "object", vault = false, write = true},
      	createInternalTransfer = {body = true, empty = false, help = "Create an internal transfer. {amount, destinationAccountId, idempotencyKey, note?, sourceAccountId}. https://docs.mercury.com/reference/createinternaltransfer", kind = "json", list = "", method = "POST", path = "/api/v1/transfer", query = {}, required = {"amount", "destinationAccountId", "idempotencyKey", "sourceAccountId"}, response = "object", vault = false, write = true},
      	createInvoice = {body = true, empty = false, help = "Create an invoice. {achDebitEnabled, ccEmails, creditCardEnabled, currencyCode?, customerId, destinationAccountId, dueDate, internalNote?, invoiceDate, invoiceNumber?, lineItems, payerMemo?, poNumber?, sendEmailOption?, servicePeriodEndDate?, servicePeriodStartDate?, useRealAccountNumber}. https://docs.mercury.com/reference/createinvoice", kind = "json", list = "", method = "POST", path = "/api/v1/ar/invoices", query = {}, required = {"achDebitEnabled", "ccEmails", "creditCardEnabled", "customerId", "destinationAccountId", "dueDate", "invoiceDate", "lineItems", "useRealAccountNumber"}, response = "object", vault = false, write = true},
      	createRecipient = {body = true, empty = false, help = "Add a new recipient. {address?, checkInfo?, contactEmail?, domesticWireRoutingInfo?, electronicRoutingInfo?, emails, name, nickname?, realTimePaymentRoutingInfo?}. https://docs.mercury.com/reference/createrecipient", kind = "json", list = "", method = "POST", path = "/api/v1/recipients", query = {}, required = {"emails", "name"}, response = "object", vault = false, write = true},
      	createRecipientInvite = {body = true, empty = false, help = "Create a recipient invite. {contactEmail, name?, notes?, organizationNameOnRequest?, paymentMethods, recipientId?, requireTaxDocument, sendEmail}. https://docs.mercury.com/reference/createrecipientinvite", kind = "json", list = "", method = "POST", path = "/api/v1/recipients/invites", query = {}, required = {"contactEmail", "paymentMethods", "requireTaxDocument", "sendEmail"}, response = "object", vault = false, write = true},
      	createTransaction = {body = true, empty = false, help = "Send money to a recipient. {accountId, amount, externalMemo?, idempotencyKey, note?, paymentMethod, purpose?, recipientId}. https://docs.mercury.com/reference/createtransaction", kind = "json", list = "", method = "POST", path = "/api/v1/account/{accountId}/transactions", query = {}, required = {"amount", "idempotencyKey", "paymentMethod", "recipientId"}, response = "object", vault = false, write = true},
      	createWebhook = {body = true, empty = false, help = "Create a new webhook endpoint. {eventTypes?, filterPaths?, url}. https://docs.mercury.com/reference/createwebhook", kind = "json", list = "", method = "POST", path = "/api/v1/webhooks", query = {}, required = {"url"}, response = "object", vault = false, write = true},
      	deleteCategory = {body = false, empty = true, help = "Delete a category. {expenseCategoryId}. https://docs.mercury.com/reference/deletecategory", kind = "json", list = "", method = "DELETE", path = "/api/v1/categories/{expenseCategoryId}", query = {}, required = {}, response = "object", vault = false, write = true},
      	deleteCustomer = {body = false, empty = true, help = "Delete a customer. {customerId}. https://docs.mercury.com/reference/deletecustomer", kind = "json", list = "", method = "DELETE", path = "/api/v1/ar/customers/{customerId}", query = {}, required = {}, response = "object", vault = false, write = true},
      	deleteRecipient = {body = false, empty = true, help = "Delete a recipient. {recipientId}. https://docs.mercury.com/reference/deleterecipient", kind = "json", list = "", method = "DELETE", path = "/api/v1/recipient/{recipientId}", query = {}, required = {}, response = "object", vault = false, write = true},
      	deleteRecipientInvite = {body = false, empty = true, help = "Delete a recipient invite. {inviteId}. https://docs.mercury.com/reference/deleterecipientinvite", kind = "json", list = "", method = "DELETE", path = "/api/v1/recipients/invites/{inviteId}", query = {}, required = {}, response = "object", vault = false, write = true},
      	deleteWebhook = {body = false, empty = true, help = "Delete a webhook endpoint. {webhookEndpointId}. https://docs.mercury.com/reference/deletewebhook", kind = "json", list = "", method = "DELETE", path = "/api/v1/webhooks/{webhookEndpointId}", query = {}, required = {}, response = "object", vault = false, write = true},
      	editCategory = {body = true, empty = false, help = "Edit a category. {expenseCategoryId, name?, visibleForCardSpend?, visibleForOther?, visibleForReimbursements?}. https://docs.mercury.com/reference/editcategory", kind = "json", list = "", method = "POST", path = "/api/v1/categories/{expenseCategoryId}", query = {}, required = {}, response = "object", vault = false, write = true},
      	freezeCard = {body = false, empty = false, help = "Freeze a card. {cardId}. https://docs.mercury.com/reference/freezecard", kind = "json", list = "", method = "POST", path = "/api/v1/cards/{cardId}/freeze", query = {}, required = {}, response = "object", vault = false, write = true},
      	getAccountCards = {body = false, empty = false, help = "Get cards for account. {accountId}. Returns {cards, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/getaccountcards", kind = "json", list = "cards", method = "GET", path = "/api/v1/account/{accountId}/cards", query = {}, required = {}, response = "object", vault = false, write = false},
      	getAccounts = {body = false, empty = false, help = "Get all accounts. {limit?, order?, start_after?, end_before?}. Returns {accounts, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/getaccounts", kind = "json", list = "accounts", method = "GET", path = "/api/v1/accounts", query = {end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, start_after = {type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	getAccountStatements = {body = false, empty = false, help = "Get account statements. {accountId, limit?, order?, start_after?, end_before?, start?, end?}. Returns {statements, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/getaccountstatements", kind = "json", list = "statements", method = "GET", path = "/api/v1/account/{accountId}/statements", query = {["end"] = {type = "string"}, end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, start = {type = "string"}, start_after = {type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	getAttachment = {body = false, empty = false, help = "Get an attachment. {attachmentId}. https://docs.mercury.com/reference/getattachment", kind = "json", list = "", method = "GET", path = "/api/v1/ar/attachments/{attachmentId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getCard = {body = false, empty = false, help = "Get a card. {cardId}. https://docs.mercury.com/reference/getcard", kind = "json", list = "", method = "GET", path = "/api/v1/cards/{cardId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getCustomer = {body = false, empty = false, help = "Get a customer. {customerId}. https://docs.mercury.com/reference/getcustomer", kind = "json", list = "", method = "GET", path = "/api/v1/ar/customers/{customerId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getEvent = {body = false, empty = false, help = "Get event by ID. {eventId}. https://docs.mercury.com/reference/getevent", kind = "json", list = "", method = "GET", path = "/api/v1/events/{eventId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getEvents = {body = false, empty = false, help = "Get all events. {limit?, start_after?, end_before?, order?, resourceType?, resourceId?}. Returns {events, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/getevents", kind = "json", list = "events", method = "GET", path = "/api/v1/events", query = {end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, resourceId = {type = "string"}, resourceType = {enum = {"transaction", "checkingAccount", "savingsAccount", "treasuryAccount", "investmentAccount", "creditAccount"}, type = "string"}, start_after = {type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	getInvoice = {body = false, empty = false, help = "Get an invoice. {invoiceId}. https://docs.mercury.com/reference/getinvoice", kind = "json", list = "", method = "GET", path = "/api/v1/ar/invoices/{invoiceId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getInvoicePdf = {body = false, empty = false, help = "Download invoice PDF. {invoiceId, path}. Returns {path, url, size} for a streamed session PDF. https://docs.mercury.com/reference/getinvoicepdf", kind = "download", list = "", method = "GET", path = "/api/v1/ar/invoices/{invoiceId}/pdf", query = {}, required = {}, response = "object", vault = false, write = false},
      	getOrganization = {body = false, empty = false, help = "Get organization information. {}. https://docs.mercury.com/reference/getorganization", kind = "json", list = "", method = "GET", path = "/api/v1/organization", query = {}, required = {}, response = "object", vault = false, write = false},
      	getRecipient = {body = false, empty = false, help = "Get recipient by ID. {recipientId}. https://docs.mercury.com/reference/getrecipient", kind = "json", list = "", method = "GET", path = "/api/v1/recipient/{recipientId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getRecipientInvite = {body = false, empty = false, help = "Get recipient invite by ID. {inviteId}. https://docs.mercury.com/reference/getrecipientinvite", kind = "json", list = "", method = "GET", path = "/api/v1/recipients/invites/{inviteId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getRecipients = {body = false, empty = false, help = "Get all recipients. {limit?, start_after?, end_before?, order?}. Returns {recipients, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/getrecipients", kind = "json", list = "recipients", method = "GET", path = "/api/v1/recipients", query = {end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, start_after = {type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	getSafeRequest = {body = false, empty = false, help = "Get SAFE by ID. {safeRequestId}. https://docs.mercury.com/reference/getsaferequest", kind = "json", list = "", method = "GET", path = "/api/v1/safes/{safeRequestId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getSafeRequestDocument = {body = false, empty = false, help = "Download SAFE document. {safeRequestId, path}. Returns {path, url, size} for a streamed session PDF. https://docs.mercury.com/reference/getsaferequestdocument", kind = "download", list = "", method = "GET", path = "/api/v1/safes/{safeRequestId}/document", query = {}, required = {}, response = "object", vault = false, write = false},
      	getSafeRequests = {body = false, empty = false, help = "Get all SAFEs. {}. Returns a native SAFE array (no pagination). https://docs.mercury.com/reference/getsaferequests", kind = "json", list = "", method = "GET", path = "/api/v1/safes", query = {}, required = {}, response = "array", vault = false, write = false},
      	getSendMoneyApprovalRequest = {body = false, empty = false, help = "Get send money approval request by ID. {requestId}. https://docs.mercury.com/reference/getsendmoneyapprovalrequest", kind = "json", list = "", method = "GET", path = "/api/v1/request-send-money/{requestId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getStatementPdf = {body = false, empty = false, help = "Download account statement PDF. {statementId, path}. Returns {path, url, size} for a streamed session PDF. https://docs.mercury.com/reference/getstatementpdf", kind = "download", list = "", method = "GET", path = "/api/v1/statements/{statementId}/pdf", query = {}, required = {}, response = "object", vault = false, write = false},
      	getTransaction = {body = false, empty = false, help = "Get transaction by ID. {accountId, transactionId}. https://docs.mercury.com/reference/gettransaction", kind = "json", list = "", method = "GET", path = "/api/v1/account/{accountId}/transaction/{transactionId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getTransactionById = {body = false, empty = false, help = "Get a transaction by ID. {transactionId}. https://docs.mercury.com/reference/gettransactionbyid", kind = "json", list = "", method = "GET", path = "/api/v1/transaction/{transactionId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getTransferMoneyApprovalRequest = {body = false, empty = false, help = "Get transfer approval request by ID. {requestId}. https://docs.mercury.com/reference/gettransfermoneyapprovalrequest", kind = "json", list = "", method = "GET", path = "/api/v1/request-transfer/{requestId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getTreasury = {body = false, empty = false, help = "Get all treasury accounts. {limit?, start_after?, end_before?, order?}. Returns {accounts, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/gettreasury", kind = "json", list = "accounts", method = "GET", path = "/api/v1/treasury", query = {end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, start_after = {type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	getTreasuryStatements = {body = false, empty = false, help = "Get treasury account statements. {treasuryId, limit?, order?, start_after?, end_before?, documentType?}. Returns {statements, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/gettreasurystatements", kind = "json", list = "statements", method = "GET", path = "/api/v1/treasury/{treasuryId}/statements", query = {documentType = {enum = {"MonthlyStatement", "TradeConfirmation", "1099", "1099R", "1042S", "5498", "5498ESA", "1099Q", "FMV", "SDIRA"}, type = "string"}, end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, start_after = {type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	getTreasuryTransactions = {body = false, empty = false, help = "Get treasury transactions. {treasuryId, limit?, order?, cursor?}. Returns {transactions, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/gettreasurytransactions", kind = "json", list = "transactions", method = "GET", path = "/api/v1/treasury/{treasuryId}/transactions", query = {cursor = {minimum = 0, type = "integer"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	getUser = {body = false, empty = false, help = "Get user by ID. {userId}. https://docs.mercury.com/reference/getuser", kind = "json", list = "", method = "GET", path = "/api/v1/users/{userId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getUsers = {body = false, empty = false, help = "Get all users. {limit?, start_after?, end_before?, order?}. Returns {users, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/getusers", kind = "json", list = "users", method = "GET", path = "/api/v1/users", query = {end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, start_after = {type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	getWebhook = {body = false, empty = false, help = "Get webhook endpoint by ID. {webhookEndpointId}. https://docs.mercury.com/reference/getwebhook", kind = "json", list = "", method = "GET", path = "/api/v1/webhooks/{webhookEndpointId}", query = {}, required = {}, response = "object", vault = false, write = false},
      	getWebhooks = {body = false, empty = false, help = "Get webhook endpoints. {status?, limit?, start_after?, end_before?, order?}. Returns {webhooks, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/getwebhooks", kind = "json", list = "webhooks", method = "GET", path = "/api/v1/webhooks", query = {end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, start_after = {type = "string"}, status = {type = "array"}}, required = {}, response = "object", vault = false, write = false},
      	listAccountTransactions = {body = false, empty = false, help = "List account transactions. {accountId, limit?, start?, end?, search?, status?, offset?, order?, requestId?, mercuryCategory?, categoryId?}. Returns {transactions, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/listaccounttransactions", kind = "json", list = "transactions", method = "GET", path = "/api/v1/account/{accountId}/transactions", query = {categoryId = {type = "string"}, ["end"] = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, mercuryCategory = {type = "string"}, offset = {minimum = 0, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, requestId = {type = "string"}, search = {type = "string"}, start = {type = "string"}, status = {enum = {"pending", "sent", "cancelled", "failed", "reversed", "blocked"}, type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	listCards = {body = false, empty = false, help = "List cards. {accountId?, status?, type?, kind?, userId?, isAgentCard?, limit?, order?, start_after?, end_before?}. Returns {cards, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/listcards", kind = "json", list = "cards", method = "GET", path = "/api/v1/cards", query = {accountId = {type = "array"}, end_before = {type = "string"}, isAgentCard = {type = "boolean"}, kind = {type = "array"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, start_after = {type = "string"}, status = {type = "array"}, type = {type = "array"}, userId = {type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	listCategories = {body = false, empty = false, help = "List all categories. {limit?, order?, start_after?, end_before?}. Returns {categories, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/listcategories", kind = "json", list = "categories", method = "GET", path = "/api/v1/categories", query = {end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, start_after = {type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	listCredit = {body = false, empty = false, help = "List all credit accounts. {}. Returns {accounts, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/listcredit", kind = "json", list = "accounts", method = "GET", path = "/api/v1/credit", query = {}, required = {}, response = "object", vault = false, write = false},
      	listCustomers = {body = false, empty = false, help = "List all customers. {limit?, start_after?, end_before?, order?}. Returns {customers, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/listcustomers", kind = "json", list = "customers", method = "GET", path = "/api/v1/ar/customers", query = {end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, start_after = {type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	listInvoiceAttachments = {body = false, empty = false, help = "List invoice attachments. {invoiceId}. Returns {attachments, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/listinvoiceattachments", kind = "json", list = "attachments", method = "GET", path = "/api/v1/ar/invoices/{invoiceId}/attachments", query = {}, required = {}, response = "object", vault = false, write = false},
      	listInvoices = {body = false, empty = false, help = "List all invoices. {limit?, order?, start_after?, end_before?}. Returns {invoices, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/listinvoices", kind = "json", list = "invoices", method = "GET", path = "/api/v1/ar/invoices", query = {end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, start_after = {type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	listMerchants = {body = false, empty = false, help = "List merchants. {limit?, order?, start_after?, end_before?, search?}. Returns {data, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/listmerchants", kind = "json", list = "data", method = "GET", path = "/api/v1/merchants", query = {end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, search = {type = "string"}, start_after = {type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	listRecipientInvites = {body = false, empty = false, help = "List recipient invites. {limit?, start_after?, end_before?, order?, status?}. Returns {invites, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/listrecipientinvites", kind = "json", list = "invites", method = "GET", path = "/api/v1/recipients/invites", query = {end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, start_after = {type = "string"}, status = {enum = {"created", "completed", "expired", "declined"}, type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	listRecipientsAttachments = {body = false, empty = false, help = "List all recipient attachments. {limit?, start_after?, end_before?, order?}. Returns {attachments, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/listrecipientsattachments", kind = "json", list = "attachments", method = "GET", path = "/api/v1/recipients/attachments", query = {end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, start_after = {type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	listSendMoneyApprovalRequests = {body = false, empty = false, help = "List send money approval requests. {accountId?, status?, start_after?, end_before?, limit?}. Returns {requests, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/listsendmoneyapprovalrequests", kind = "json", list = "requests", method = "GET", path = "/api/v1/request-send-money", query = {accountId = {type = "string"}, end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, start_after = {type = "string"}, status = {enum = {"pendingApproval", "approved", "rejected", "cancelled"}, type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	listTransactions = {body = false, empty = false, help = "List all transactions. {status?, search?, start?, end?, postedStart?, postedEnd?, accountId?, cardId?, mercuryCategory?, categoryId?, start_at?, start_after?, end_before?, limit?, order?}. Returns {transactions, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/listtransactions", kind = "json", list = "transactions", method = "GET", path = "/api/v1/transactions", query = {accountId = {type = "array"}, cardId = {type = "array"}, categoryId = {type = "string"}, ["end"] = {type = "string"}, end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, mercuryCategory = {type = "string"}, order = {enum = {"asc", "desc"}, type = "string"}, postedEnd = {type = "string"}, postedStart = {type = "string"}, search = {type = "string"}, start = {type = "string"}, start_after = {type = "string"}, start_at = {type = "string"}, status = {type = "array"}}, required = {}, response = "object", vault = false, write = false},
      	listTransferMoneyApprovalRequests = {body = false, empty = false, help = "List transfer approval requests. {sourceAccountId?, destinationAccountId?, status?, start_at?, start_after?, end_before?, limit?, order?}. Returns {requests, ...} with Mercury's pagination fields. https://docs.mercury.com/reference/listtransfermoneyapprovalrequests", kind = "json", list = "requests", method = "GET", path = "/api/v1/request-transfer", query = {destinationAccountId = {type = "string"}, end_before = {type = "string"}, limit = {maximum = 1000, minimum = 1, type = "integer"}, order = {enum = {"asc", "desc"}, type = "string"}, sourceAccountId = {type = "string"}, start_after = {type = "string"}, start_at = {type = "string"}, status = {enum = {"pendingApproval", "approved", "rejected", "cancelled"}, type = "string"}}, required = {}, response = "object", vault = false, write = false},
      	requestSendMoney = {body = true, empty = false, help = "Request to send money. {accountId, amount, chargeType?, externalMemo?, idempotencyKey, note?, paymentMethod, purpose?, recipientId}. https://docs.mercury.com/reference/requestsendmoney", kind = "json", list = "", method = "POST", path = "/api/v1/account/{accountId}/request-send-money", query = {}, required = {"amount", "idempotencyKey", "paymentMethod", "recipientId"}, response = "object", vault = false, write = true},
      	requestTransferMoney = {body = true, empty = false, help = "Request to transfer money. {amount, destinationAccountId, idempotencyKey, note?, sourceAccountId}. https://docs.mercury.com/reference/requesttransfermoney", kind = "json", list = "", method = "POST", path = "/api/v1/request-transfer", query = {}, required = {"amount", "destinationAccountId", "idempotencyKey", "sourceAccountId"}, response = "object", vault = false, write = true},
      	revealCardPan = {body = false, empty = false, help = "Reveal card details. {cardId}. https://docs.mercury.com/reference/revealcardpan", kind = "json", list = "", method = "GET", path = "/api/v1/cards/{cardId}/reveal", query = {}, required = {}, response = "object", vault = true, write = false},
      	unfreezeCard = {body = false, empty = false, help = "Unfreeze a card. {cardId}. https://docs.mercury.com/reference/unfreezecard", kind = "json", list = "", method = "POST", path = "/api/v1/cards/{cardId}/unfreeze", query = {}, required = {}, response = "object", vault = false, write = true},
      	updateCard = {body = true, empty = false, help = "Update a card. {cardId, nickname?, spendLimit?}. https://docs.mercury.com/reference/updatecard", kind = "json", list = "", method = "POST", path = "/api/v1/cards/{cardId}", query = {}, required = {}, response = "object", vault = false, write = true},
      	updateCustomer = {body = true, empty = false, help = "Update a customer. {customerId, address?, email, name, resendOpenInvoices}. https://docs.mercury.com/reference/updatecustomer", kind = "json", list = "", method = "POST", path = "/api/v1/ar/customers/{customerId}", query = {}, required = {"email", "name", "resendOpenInvoices"}, response = "object", vault = false, write = true},
      	updateInvoice = {body = true, empty = false, help = "Update an invoice. {invoiceId, achDebitEnabled, ccEmails, creditCardEnabled, dueDate, internalNote?, invoiceDate, invoiceNumber, lineItems, payerMemo?, poNumber?, servicePeriodEndDate?, servicePeriodStartDate?, useRealAccountNumber}. https://docs.mercury.com/reference/updateinvoice", kind = "json", list = "", method = "POST", path = "/api/v1/ar/invoices/{invoiceId}", query = {}, required = {"achDebitEnabled", "ccEmails", "creditCardEnabled", "dueDate", "invoiceDate", "invoiceNumber", "lineItems", "useRealAccountNumber"}, response = "object", vault = false, write = true},
      	updateRecipient = {body = true, empty = false, help = "Edit information about a specific recipient. {recipientId, address?, checkInfo?, contactEmail?, domesticWireRoutingInfo?, electronicRoutingInfo?, emails?, name?, nickname?, realTimePaymentRoutingInfo?}. https://docs.mercury.com/reference/updaterecipient", kind = "json", list = "", method = "POST", path = "/api/v1/recipient/{recipientId}", query = {}, required = {}, response = "object", vault = false, write = true},
      	updateTransaction = {body = true, empty = false, help = "Update transaction metadata. {transactionId, categoryId?, note?}. https://docs.mercury.com/reference/updatetransaction", kind = "json", list = "", method = "PATCH", path = "/api/v1/transaction/{transactionId}", query = {}, required = {}, response = "object", vault = false, write = true},
      	updateWebhook = {body = true, empty = false, help = "Update an existing webhook endpoint. {webhookEndpointId, eventTypes?, filterPaths?, status?, url?}. https://docs.mercury.com/reference/updatewebhook", kind = "json", list = "", method = "POST", path = "/api/v1/webhooks/{webhookEndpointId}", query = {}, required = {}, response = "object", vault = false, write = true},
      	uploadRecipientAttachment = {body = false, empty = false, help = "Upload a recipient attachment. {recipientId, path, filename?, contentType?}. https://docs.mercury.com/reference/uploadrecipientattachment", kind = "upload", list = "", method = "POST", path = "/api/v1/recipient/{recipientId}/attachments", query = {}, required = {}, response = "object", vault = false, write = true},
      	uploadTransactionAttachment = {body = false, empty = false, help = "Upload a transaction attachment. {transactionId, path, filename?, contentType?, attachmentType?}. https://docs.mercury.com/reference/uploadtransactionattachment", kind = "upload", list = "", method = "POST", path = "/api/v1/transaction/{transactionId}/attachments", query = {}, required = {}, response = "object", vault = false, write = true},
      	verifyWebhook = {body = true, empty = true, help = "Verify a webhook endpoint. {webhookEndpointId, eventType?}. https://docs.mercury.com/reference/verifywebhook", kind = "json", list = "", method = "POST", path = "/api/v1/webhooks/{webhookEndpointId}/verify", query = {}, required = {}, response = "object", vault = false, write = true},
      }
      
  • README.md
    ---
    description: Check Mercury balances, transactions and SAFEs, and manage payments, cards and invoices.
    ---
    
    # Mercury
    
    Connect your Mercury business account so your agents can check current and
    available balances, review transactions, follow SAFE signing and payment progress,
    and download statements and SAFE documents.
    
    Read access also includes treasury and credit accounts, recipients, approval
    requests, customers, invoices, categories, cards, users, events and webhooks.
    
    With write access, agents can send money, transfer funds, request payment
    approvals, manage recipients and invoices, update transaction notes and categories,
    upload receipts and tax documents, issue and manage virtual cards, and configure
    webhooks. Your Mercury token permissions and approval policies still apply.
    
    SAFE access covers the information and documents Mercury exposes. Creating,
    editing and signing SAFEs remain in Mercury. Agent card numbers and CVCs are
    available only when you explicitly enable that connection setting.
    
    [Connect your Mercury account](SETUP.md).
    
  • SETUP.md
    # Connect Mercury
    
    1. Create a **Read Only** token under [Settings → Tokens](https://app.mercury.com/settings/tokens).
       Ask your organization admin if this page is unavailable.
    2. Paste the complete token, including `secret-token:`, into Houston's **API token**.
    3. Choose **Read** for **Access** and save, or configure writes as described below.
    
    [Token guide](https://docs.mercury.com/docs/getting-started).
    
    ## Advanced
    
    ### Payments and changes
    
    Choose **Write** for **Access** and grant only the needed Mercury scopes. Mercury write
    tokens require an IP allowlist containing Houston's server egress addresses,
    obtained from your Houston operator. A **Custom** token with `RequestSendMoney`
    can queue payments for approval without an IP allowlist. Approvals happen in Mercury.
    
    > Enable **Allow revealing agent card numbers and CVCs** only when agents need
    > those sensitive agent-card details; ordinary cards are not supported.
    
    ### Token maintenance
    
    This connector supports production Mercury, not sandbox or OAuth connections.
    Mercury may remove inactive tokens or downgrade unused write permissions after
    45 days. Check scopes and IP restrictions if access stops.
    
    [Token policies](https://docs.mercury.com/docs/api-token-security-policies).
    
  • tests
    • authentication.luau
      return {
      	contract = function(m)
      		m.authentication({
      			{
      				auth = { token = "synthetic-method-secret" },
      				config = {},
      				endpoint = { "GET", "https://api.mercury.com/api/v1/accounts" },
      				expected = "Bearer synthetic-method-secret",
      				header = "Authorization",
      				method = "token",
      				publisher = {},
      			},
      		})
      	end,
      }
      
    • behavior.luau
      return {
       scenario = {publisher = {}, access = {data = "write"}, config = {}, auth_method = "token", auth_config = {token = "fixture-private-mercury-token"}},
       configure = function()
        calls = 0
        status = 200
        payload = '{}'
        responseHeaders = {}
        fs = fixture.files()
        local f = fs.open("receipt.pdf", "w"); f:write("%PDF-receipt"); await(f:close())
        http = {request = function(req)
         calls += 1
         request = req
         if type(req.body) == "userdata" then uploaded = await(req.body:readAll()) end
         return fixture.operation({statusCode = status, headers = responseHeaders, body = fixture.reader(payload)})
        end}
       end,
       run = function(c)
        local function rejected(fn, expected)
         local before = calls
         local ok, err = pcall(fn)
         assert(not ok and string.find(tostring(err), expected, 1, true), "wrong validation error: " .. tostring(err))
         assert(calls == before, "invalid input reached Mercury")
        end
        assert(c.revealCardPan == nil)
        for _, limit in {0, 1001, 1.5, "10", json.decode("null")} do
         rejected(function() c.getAccounts({limit = limit}) end, "limit")
        end
        rejected(function() c.getAccounts({start_after = "a", end_before = "b"}) end, "cannot be combined")
        rejected(function() c.getAccounts({order = "newest"}) end, "unsupported value")
        rejected(function() c.getAccounts({unknown = true}) end, "unknown option")
        rejected(function() c.listCards({isAgentCard = "false"}) end, "boolean")
        rejected(function() c.getSafeRequest({safeRequestId = "../accounts"}) end, "must be an ID")
        rejected(function() c.getSafeRequest({safeRequestId = ""}) end, "nonempty")
        rejected(function() c.getSafeRequest() end, "nonempty")
        rejected(function() c.getSafeRequestDocument({safeRequestId = "s"}) end, "path")
        rejected(function() c.createTransaction({accountId = "a"}) end, "required")
        rejected(function() c.createTransaction({accountId = "a", recipientId = "r", amount = -1, paymentMethod = "ach", idempotencyKey = "key"}) end, "positive")
        rejected(function() c.createCard({userId = "u", kind = "debit", type = "physical"}) end, "virtual")
        rejected(function() c.uploadTransactionAttachment({transactionId = "t", path = "receipt.pdf", attachmentType = "tax"}) end, "attachmentType")
        rejected(function() c.uploadRecipientAttachment({recipientId = "r", path = "receipt.pdf", filename = "bad\r\nname"}) end, "filename")
      
        payload = '{"transactions":[],"page":{"nextPage":"next-id"},"future":{"field":null}}'
        local opts = {limit = 2, start_after = "cursor-a", search = "Invoice & #1/2", status = "pending"}
        local page = c.listTransactions(opts)
        assert(request.url == "https://api.mercury.com/api/v1/transactions?limit=2&search=Invoice%20%26%20%231%2F2&start_after=cursor-a&status=pending")
        assert(opts.search == "Invoice & #1/2" and page.page.nextPage == "next-id")
        assert(json.encode(page.transactions) == "[]" and page.future.field == json.decode("null"))
        payload = '{"transactions":[{"id":"tx","amount":-123.45}],"page":{}}'
        local nextPage = c.listTransactions({start_after = page.page.nextPage, limit = 2})
        assert(nextPage.transactions[1].amount == -123.45)
        assert(string.find(request.url, "start_after=next-id", 1, true))
        payload = '{"transactions":[],"total":10}'
        c.listAccountTransactions({accountId = "a", offset = 2, limit = 2})
        assert(request.url == "https://api.mercury.com/api/v1/account/a/transactions?limit=2&offset=2")
        payload = '{"transactions":[],"cursor":17}'
        assert(c.getTreasuryTransactions({treasuryId = "tr", cursor = 12}).cursor == 17)
        assert(request.url == "https://api.mercury.com/api/v1/treasury/tr/transactions?cursor=12")
        payload = '{"cards":[],"page":{}}'
        c.listCards({isAgentCard = false})
        assert(string.find(request.url, "isAgentCard=false", 1, true))
      
        payload = '{"id":"tx","note":null,"categoryData":null}'
        c.updateTransaction({transactionId = "tx", note = json.decode("null"), categoryId = json.decode("null")})
        local body = json.decode(request.body)
        assert(body.note == json.decode("null") and body.categoryId == json.decode("null") and body.transactionId == nil)
        payload = '{"id":"recipient","emails":[]}'
        c.createRecipient({name = "Vendor", emails = json.decode("[]"), electronicRoutingInfo = {accountNumber = "synthetic", routingNumber = "synthetic"}})
        body = json.decode(request.body)
        assert(json.encode(body.emails) == "[]" and body.electronicRoutingInfo.accountNumber == "synthetic")
        payload = '{"id":"tx","status":"pending"}'
        local payment = {accountId = "a", recipientId = "r", amount = 12.34, paymentMethod = "ach", idempotencyKey = "same-intended-payment"}
        c.createTransaction(payment)
        body = json.decode(request.body)
        assert(body.amount == 12.34 and body.idempotencyKey == payment.idempotencyKey and body.accountId == nil)
      
        payload = '{"attachmentId":"attachment-1","downloadUrl":"https://example.invalid/signed"}'
        c.uploadTransactionAttachment({transactionId = "t", path = "receipt.pdf", filename = "bill.pdf", contentType = "application/pdf", attachmentType = "bill"})
        assert(string.find(uploaded, 'name="attachmentType"', 1, true) and string.find(uploaded, "\r\nbill\r\n", 1, true))
        assert(string.find(uploaded, 'filename="bill.pdf"', 1, true) and string.find(uploaded, "%PDF-receipt", 1, true))
      
        for _, raw in {"", "null", "\n null \n"} do
         payload = raw
         assert(c.cancelInvoice({invoiceId = "i"}).success)
        end
        for _, raw in {"{}", "[]"} do
         payload = raw
         assert(json.encode(c.cancelInvoice({invoiceId = "i"})) == raw)
        end
        status = 204
        assert(c.deleteRecipient({recipientId = "r"}).success)
        status = 200
        for _, bad in {"not-json", "null", "[]", '{"error":"failed"}', '{"accounts":{}}', '{}'} do
         payload = bad
         local before = calls
         local ok = pcall(c.getAccounts)
         assert(not ok and calls == before + 1, "malformed upstream response accepted/retried")
        end
        payload = '{}'
        assert(not pcall(c.getSafeRequests), "SAFE object accepted as an array")
        for _, code in {401, 403, 404, 422, 429, 500} do
         status = code
         payload = '{"error":"synthetic provider rejection"}'
         responseHeaders = {["retry-after"] = {"15"}}
         local before = calls
         local ok, err = pcall(function() c.createTransaction(payment) end)
         assert(not ok and calls == before + 1, "failed payment retried")
         assert(string.find(tostring(err), tostring(code), 1, true), "provider status lost")
        end
        status = 200
        payload = '{"error":"not a PDF"}'
        responseHeaders = {["content-type"] = {"application/json"}}
        assert(not pcall(function() c.getSafeRequestDocument({safeRequestId = "s", path = "not-created.pdf"}) end))
        assert(not await(fs.exists("not-created.pdf")), "error document was saved")
       end,
      }
      
    • endpoint_matrix.luau
      -- Expected requests and responses taken from Mercury's published OpenAPI definitions.
      return {
       scenario = {publisher = {}, access = {data = "write"}, config = {reveal_card_details = true}, auth_method = "token", auth_config = {token = "fixture-private-mercury-token"}},
       configure = function()
        requests = {}
        fs = fixture.files()
        local f = fs.open("upload.bin", "w"); f:write("receipt" .. string.char(0, 255)); await(f:close())
        http = {request = function(req)
         table.insert(requests, req)
         if type(req.body) == "userdata" then req.uploaded = await(req.body:readAll()) end
         return fixture.operation({statusCode = status, headers = {["content-type"] = {media}}, body = fixture.reader(payload)})
        end}
       end,
       run = function(c)
        local cases = json.decode([==[
      [
      {"args":{"cardId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"POST","name":"cancelCard","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/cards/00000000-0000-4000-8000-000000000001/cancel","vault":false,"write":true},
      {"args":{"invoiceId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"POST","name":"cancelInvoice","response":null,"status":"200","url":"https://api.mercury.com/api/v1/ar/invoices/00000000-0000-4000-8000-000000000001/cancel","vault":false,"write":true},
      {"args":{"futureField":{"preserve":true},"kind":"debit","type":"virtual","userId":"fixture"},"body":true,"kind":"json","method":"POST","name":"createCard","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/cards","vault":false,"write":true},
      {"args":{"futureField":{"preserve":true},"name":"fixture","visibleForCardSpend":false,"visibleForOther":false,"visibleForReimbursements":false},"body":true,"kind":"json","method":"POST","name":"createCategory","response":{"futureField":true},"status":"201","url":"https://api.mercury.com/api/v1/categories","vault":false,"write":true},
      {"args":{"email":"fixture","futureField":{"preserve":true},"name":"fixture"},"body":true,"kind":"json","method":"POST","name":"createCustomer","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/ar/customers","vault":false,"write":true},
      {"args":{"amount":12.34,"destinationAccountId":"fixture","futureField":{"preserve":true},"idempotencyKey":"fixture","sourceAccountId":"fixture"},"body":true,"kind":"json","method":"POST","name":"createInternalTransfer","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/transfer","vault":false,"write":true},
      {"args":{"achDebitEnabled":false,"ccEmails":[],"creditCardEnabled":false,"customerId":"fixture","destinationAccountId":"fixture","dueDate":"fixture","futureField":{"preserve":true},"invoiceDate":"fixture","lineItems":[],"useRealAccountNumber":false},"body":true,"kind":"json","method":"POST","name":"createInvoice","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/ar/invoices","vault":false,"write":true},
      {"args":{"emails":[],"futureField":{"preserve":true},"name":"fixture"},"body":true,"kind":"json","method":"POST","name":"createRecipient","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/recipients","vault":false,"write":true},
      {"args":{"contactEmail":"fixture","futureField":{"preserve":true},"paymentMethods":[],"requireTaxDocument":false,"sendEmail":false},"body":true,"kind":"json","method":"POST","name":"createRecipientInvite","response":{"futureField":true},"status":"201","url":"https://api.mercury.com/api/v1/recipients/invites","vault":false,"write":true},
      {"args":{"accountId":"00000000-0000-4000-8000-000000000001","amount":12.34,"futureField":{"preserve":true},"idempotencyKey":"fixture","paymentMethod":"ach","recipientId":"fixture"},"body":true,"kind":"json","method":"POST","name":"createTransaction","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/account/00000000-0000-4000-8000-000000000001/transactions","vault":false,"write":true},
      {"args":{"futureField":{"preserve":true},"url":"fixture"},"body":true,"kind":"json","method":"POST","name":"createWebhook","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/webhooks","vault":false,"write":true},
      {"args":{"expenseCategoryId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"DELETE","name":"deleteCategory","response":null,"status":"204","url":"https://api.mercury.com/api/v1/categories/00000000-0000-4000-8000-000000000001","vault":false,"write":true},
      {"args":{"customerId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"DELETE","name":"deleteCustomer","response":null,"status":"200","url":"https://api.mercury.com/api/v1/ar/customers/00000000-0000-4000-8000-000000000001","vault":false,"write":true},
      {"args":{"recipientId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"DELETE","name":"deleteRecipient","response":null,"status":"204","url":"https://api.mercury.com/api/v1/recipient/00000000-0000-4000-8000-000000000001","vault":false,"write":true},
      {"args":{"inviteId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"DELETE","name":"deleteRecipientInvite","response":null,"status":"204","url":"https://api.mercury.com/api/v1/recipients/invites/00000000-0000-4000-8000-000000000001","vault":false,"write":true},
      {"args":{"webhookEndpointId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"DELETE","name":"deleteWebhook","response":null,"status":"204","url":"https://api.mercury.com/api/v1/webhooks/00000000-0000-4000-8000-000000000001","vault":false,"write":true},
      {"args":{"expenseCategoryId":"00000000-0000-4000-8000-000000000001","futureField":{"preserve":true}},"body":true,"kind":"json","method":"POST","name":"editCategory","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/categories/00000000-0000-4000-8000-000000000001","vault":false,"write":true},
      {"args":{"cardId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"POST","name":"freezeCard","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/cards/00000000-0000-4000-8000-000000000001/freeze","vault":false,"write":true},
      {"args":{"accountId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getAccountCards","response":{"cards":[],"futureField":true,"page":{"nextPage":"cursor-next"}},"status":"200","url":"https://api.mercury.com/api/v1/account/00000000-0000-4000-8000-000000000001/cards","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"getAccounts","response":{"accounts":[],"futureField":true,"page":{"nextPage":"cursor-next"}},"status":"200","url":"https://api.mercury.com/api/v1/accounts","vault":false,"write":false},
      {"args":{"accountId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getAccountStatements","response":{"futureField":true,"page":{"nextPage":"cursor-next"},"statements":[]},"status":"200","url":"https://api.mercury.com/api/v1/account/00000000-0000-4000-8000-000000000001/statements","vault":false,"write":false},
      {"args":{"attachmentId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getAttachment","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/ar/attachments/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{"cardId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getCard","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/cards/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{"customerId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getCustomer","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/ar/customers/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{"eventId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getEvent","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/events/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"getEvents","response":{"events":[],"futureField":true,"page":{"nextPage":"cursor-next"}},"status":"200","url":"https://api.mercury.com/api/v1/events","vault":false,"write":false},
      {"args":{"invoiceId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getInvoice","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/ar/invoices/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{"invoiceId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"download","method":"GET","name":"getInvoicePdf","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/ar/invoices/00000000-0000-4000-8000-000000000001/pdf","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"getOrganization","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/organization","vault":false,"write":false},
      {"args":{"recipientId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getRecipient","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/recipient/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{"inviteId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getRecipientInvite","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/recipients/invites/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"getRecipients","response":{"futureField":true,"page":{"nextPage":"cursor-next"},"recipients":[]},"status":"200","url":"https://api.mercury.com/api/v1/recipients","vault":false,"write":false},
      {"args":{"safeRequestId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getSafeRequest","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/safes/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{"safeRequestId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"download","method":"GET","name":"getSafeRequestDocument","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/safes/00000000-0000-4000-8000-000000000001/document","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"getSafeRequests","response":[{"id":"safe-1","paidAt":null}],"status":"200","url":"https://api.mercury.com/api/v1/safes","vault":false,"write":false},
      {"args":{"requestId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getSendMoneyApprovalRequest","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/request-send-money/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{"statementId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"download","method":"GET","name":"getStatementPdf","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/statements/00000000-0000-4000-8000-000000000001/pdf","vault":false,"write":false},
      {"args":{"accountId":"00000000-0000-4000-8000-000000000001","transactionId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getTransaction","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/account/00000000-0000-4000-8000-000000000001/transaction/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{"transactionId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getTransactionById","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/transaction/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{"requestId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getTransferMoneyApprovalRequest","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/request-transfer/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"getTreasury","response":{"accounts":[],"futureField":true,"page":{"nextPage":"cursor-next"}},"status":"200","url":"https://api.mercury.com/api/v1/treasury","vault":false,"write":false},
      {"args":{"treasuryId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getTreasuryStatements","response":{"futureField":true,"page":{"nextPage":"cursor-next"},"statements":[]},"status":"200","url":"https://api.mercury.com/api/v1/treasury/00000000-0000-4000-8000-000000000001/statements","vault":false,"write":false},
      {"args":{"treasuryId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getTreasuryTransactions","response":{"futureField":true,"page":{"nextPage":"cursor-next"},"transactions":[]},"status":"200","url":"https://api.mercury.com/api/v1/treasury/00000000-0000-4000-8000-000000000001/transactions","vault":false,"write":false},
      {"args":{"userId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getUser","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/users/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"getUsers","response":{"futureField":true,"page":{"nextPage":"cursor-next"},"users":[]},"status":"200","url":"https://api.mercury.com/api/v1/users","vault":false,"write":false},
      {"args":{"webhookEndpointId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"getWebhook","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/webhooks/00000000-0000-4000-8000-000000000001","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"getWebhooks","response":{"futureField":true,"page":{"nextPage":"cursor-next"},"webhooks":[]},"status":"200","url":"https://api.mercury.com/api/v1/webhooks","vault":false,"write":false},
      {"args":{"accountId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"listAccountTransactions","response":{"futureField":true,"page":{"nextPage":"cursor-next"},"transactions":[]},"status":"200","url":"https://api.mercury.com/api/v1/account/00000000-0000-4000-8000-000000000001/transactions","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"listCards","response":{"cards":[],"futureField":true,"page":{"nextPage":"cursor-next"}},"status":"200","url":"https://api.mercury.com/api/v1/cards","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"listCategories","response":{"categories":[],"futureField":true,"page":{"nextPage":"cursor-next"}},"status":"200","url":"https://api.mercury.com/api/v1/categories","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"listCredit","response":{"accounts":[],"futureField":true,"page":{"nextPage":"cursor-next"}},"status":"200","url":"https://api.mercury.com/api/v1/credit","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"listCustomers","response":{"customers":[],"futureField":true,"page":{"nextPage":"cursor-next"}},"status":"200","url":"https://api.mercury.com/api/v1/ar/customers","vault":false,"write":false},
      {"args":{"invoiceId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"listInvoiceAttachments","response":{"attachments":[],"futureField":true,"page":{"nextPage":"cursor-next"}},"status":"200","url":"https://api.mercury.com/api/v1/ar/invoices/00000000-0000-4000-8000-000000000001/attachments","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"listInvoices","response":{"futureField":true,"invoices":[],"page":{"nextPage":"cursor-next"}},"status":"200","url":"https://api.mercury.com/api/v1/ar/invoices","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"listMerchants","response":{"data":[],"futureField":true,"page":{"nextPage":"cursor-next"}},"status":"200","url":"https://api.mercury.com/api/v1/merchants","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"listRecipientInvites","response":{"futureField":true,"invites":[],"page":{"nextPage":"cursor-next"}},"status":"200","url":"https://api.mercury.com/api/v1/recipients/invites","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"listRecipientsAttachments","response":{"attachments":[],"futureField":true,"page":{"nextPage":"cursor-next"}},"status":"200","url":"https://api.mercury.com/api/v1/recipients/attachments","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"listSendMoneyApprovalRequests","response":{"futureField":true,"page":{"nextPage":"cursor-next"},"requests":[]},"status":"200","url":"https://api.mercury.com/api/v1/request-send-money","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"listTransactions","response":{"futureField":true,"page":{"nextPage":"cursor-next"},"transactions":[]},"status":"200","url":"https://api.mercury.com/api/v1/transactions","vault":false,"write":false},
      {"args":{},"body":false,"kind":"json","method":"GET","name":"listTransferMoneyApprovalRequests","response":{"futureField":true,"page":{"nextPage":"cursor-next"},"requests":[]},"status":"200","url":"https://api.mercury.com/api/v1/request-transfer","vault":false,"write":false},
      {"args":{"accountId":"00000000-0000-4000-8000-000000000001","amount":12.34,"futureField":{"preserve":true},"idempotencyKey":"fixture","paymentMethod":"ach","recipientId":"fixture"},"body":true,"kind":"json","method":"POST","name":"requestSendMoney","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/account/00000000-0000-4000-8000-000000000001/request-send-money","vault":false,"write":true},
      {"args":{"amount":12.34,"destinationAccountId":"fixture","futureField":{"preserve":true},"idempotencyKey":"fixture","sourceAccountId":"fixture"},"body":true,"kind":"json","method":"POST","name":"requestTransferMoney","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/request-transfer","vault":false,"write":true},
      {"args":{"cardId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"GET","name":"revealCardPan","response":{"futureField":true},"status":"200","url":"https://vault-api.mercury.com/api/v1/cards/00000000-0000-4000-8000-000000000001/reveal","vault":true,"write":false},
      {"args":{"cardId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"json","method":"POST","name":"unfreezeCard","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/cards/00000000-0000-4000-8000-000000000001/unfreeze","vault":false,"write":true},
      {"args":{"cardId":"00000000-0000-4000-8000-000000000001","futureField":{"preserve":true}},"body":true,"kind":"json","method":"POST","name":"updateCard","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/cards/00000000-0000-4000-8000-000000000001","vault":false,"write":true},
      {"args":{"customerId":"00000000-0000-4000-8000-000000000001","email":"fixture","futureField":{"preserve":true},"name":"fixture","resendOpenInvoices":false},"body":true,"kind":"json","method":"POST","name":"updateCustomer","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/ar/customers/00000000-0000-4000-8000-000000000001","vault":false,"write":true},
      {"args":{"achDebitEnabled":false,"ccEmails":[],"creditCardEnabled":false,"dueDate":"fixture","futureField":{"preserve":true},"invoiceDate":"fixture","invoiceId":"00000000-0000-4000-8000-000000000001","invoiceNumber":"fixture","lineItems":[],"useRealAccountNumber":false},"body":true,"kind":"json","method":"POST","name":"updateInvoice","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/ar/invoices/00000000-0000-4000-8000-000000000001","vault":false,"write":true},
      {"args":{"futureField":{"preserve":true},"recipientId":"00000000-0000-4000-8000-000000000001"},"body":true,"kind":"json","method":"POST","name":"updateRecipient","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/recipient/00000000-0000-4000-8000-000000000001","vault":false,"write":true},
      {"args":{"futureField":{"preserve":true},"transactionId":"00000000-0000-4000-8000-000000000001"},"body":true,"kind":"json","method":"PATCH","name":"updateTransaction","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/transaction/00000000-0000-4000-8000-000000000001","vault":false,"write":true},
      {"args":{"futureField":{"preserve":true},"webhookEndpointId":"00000000-0000-4000-8000-000000000001"},"body":true,"kind":"json","method":"POST","name":"updateWebhook","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/webhooks/00000000-0000-4000-8000-000000000001","vault":false,"write":true},
      {"args":{"recipientId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"upload","method":"POST","name":"uploadRecipientAttachment","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/recipient/00000000-0000-4000-8000-000000000001/attachments","vault":false,"write":true},
      {"args":{"transactionId":"00000000-0000-4000-8000-000000000001"},"body":false,"kind":"upload","method":"POST","name":"uploadTransactionAttachment","response":{"futureField":true},"status":"200","url":"https://api.mercury.com/api/v1/transaction/00000000-0000-4000-8000-000000000001/attachments","vault":false,"write":true},
      {"args":{"futureField":{"preserve":true},"webhookEndpointId":"00000000-0000-4000-8000-000000000001"},"body":true,"kind":"json","method":"POST","name":"verifyWebhook","response":null,"status":"204","url":"https://api.mercury.com/api/v1/webhooks/00000000-0000-4000-8000-000000000001/verify","vault":false,"write":true}
      ]
      ]==])
        local count = 0
        for name in c do if name ~= "help" then count += 1 end end
        assert(count == #cases and count == 73, "documented API surface missing")
        for _, case in cases do
         status = tonumber(case.status)
         media = if case.kind == "download" then "application/pdf" else "application/json"
         payload = if case.kind == "download" then "%PDF-1.7\nfixture" else if status == 204 then "" else json.encode(case.response)
         local input = case.args
         if case.kind == "download" then input.path = case.name .. ".pdf" end
         if case.kind == "upload" then input.path = "upload.bin" end
         local before = json.encode(input)
         local previous = #requests
         local result = c[case.name](input)
         assert(#requests == previous + 1, "unexpected paging/retry: " .. case.name)
         local req = requests[#requests]
         assert(req.method == case.method and req.url == case.url, "wrong request: " .. case.name)
         assert(req.headers.Authorization == nil, "credentials entered Lua")
         assert(json.encode(input) == before, "mutated caller arguments")
         if case.kind == "download" then
          assert(result.path == input.path and result.size == #payload and result.url ~= nil)
          local f = fs.open(result.path, "r"); assert(await(f:readAll()) == payload); f:close()
         elseif status == 204 or case.response == json.decode("null") then
          assert(result.success == true)
         else
          assert(json.encode(result) == json.encode(case.response), "lost response data: " .. case.name)
         end
         if case.body then
          local body = json.decode(req.body)
          assert(body.futureField.preserve, "lost future/nested JSON fields")
          for field in input do
           if string.find(case.url, tostring(input[field]), 1, true) and field ~= "futureField" then
            assert(body[field] == nil, "path field leaked into body")
           end
          end
         elseif case.kind == "upload" then
          assert(string.find(req.headers["Content-Type"][1], "multipart/form-data; boundary=", 1, true))
          assert(string.find(req.uploaded, 'name="file"', 1, true))
          assert(string.find(req.uploaded, "receipt" .. string.char(0, 255), 1, true))
         else
          assert(req.body == nil, "unexpected body")
         end
        end
       end,
      }
      
    • manifest.luau
      return {
      	contract = function(m)
      		-- TestMercuryAuthenticationAndTransportBoundaries
      		do
      			do
      				local _, err = m.resolve(nil, nil, nil, "token")
      				if err == nil then
      					m.fail("accepted missing token")
      				end
      			end
      			for _, access in { "read", "write" } do
      				for _, reveal in { false, true } do
      					local r, err = m.resolve(
      						nil,
      						{ reveal_card_details = reveal },
      						{ token = "secret-token:fixture-private" },
      						"token",
      						{ data = access }
      					)
      					assert(not err, tostring(err))
      					do
      						local err = m.credentials(r.Context)
      						assert(not err, tostring(err))
      					end
      					for key, value in r.PublicConfig do
      						if
      							(
      								(string.find(key, "token", 1, true) ~= nil)
      								or (string.find(string.lower(key), "secret", 1, true) ~= nil)
      							) or (value == "secret-token:fixture-private")
      						then
      							m.fail("credential leaked into Lua public config")
      						end
      					end
      					local rules = r.Proxy
      					local assertRoute = function(method, url, allowed)
      						local caller = { Authorization = { "forged" } }
      						local recipe, err = m.recipe(rules, method, url, caller)
      						if not allowed then
      							if err == nil then
      								m.fail("access=%s reveal=%s allowed %s %s", access, reveal, method, url)
      							end
      							return
      						end
      						assert(not err, tostring(err))
      						local headers, err = m.prepare(recipe, r.Context, caller)
      						if
      							(
      								(err ~= nil)
      								or (
      									m.header(headers, "Authorization")
      									~= "Bearer secret-token:fixture-private"
      								)
      							) or (m.header(caller, "Authorization") ~= "forged")
      						then
      							m.fail("incorrect credential injection: %s", err)
      						end
      					end
      					for _, path in
      						{
      							"/accounts?limit=10",
      							"/account/a/statements",
      							"/account/a/transactions?offset=2",
      							"/transactions?search=invoice%20%26%20rent",
      							"/transaction/t",
      							"/treasury",
      							"/treasury/t/statements",
      							"/statements/s/pdf",
      							"/credit",
      							"/safes",
      							"/safes/s",
      							"/safes/s/document",
      							"/ar/invoices/i/pdf",
      							"/ar/attachments/a",
      							"/cards/c",
      							"/users/u",
      							"/webhooks/w",
      						}
      					do
      						assertRoute("GET", "https://api.mercury.com/api/v1" .. path, true)
      					end
      					for _, route in
      						{
      							{ "POST", "/account/a/transactions" },
      							{ "POST", "/account/a/request-send-money" },
      							{ "POST", "/transfer" },
      							{ "POST", "/request-transfer" },
      							{ "POST", "/recipients" },
      							{ "POST", "/recipients/invites" },
      							{ "DELETE", "/recipient/r" },
      							{ "PATCH", "/transaction/t" },
      							{ "POST", "/transaction/t/attachments" },
      							{ "POST", "/recipient/r/attachments" },
      							{ "POST", "/ar/invoices" },
      							{ "POST", "/ar/invoices/i/cancel" },
      							{ "DELETE", "/ar/customers/c" },
      							{ "POST", "/cards" },
      							{ "POST", "/cards/c/freeze" },
      							{ "POST", "/cards/c/unfreeze" },
      							{ "POST", "/cards/c/cancel" },
      							{ "POST", "/webhooks/w/verify" },
      							{ "DELETE", "/webhooks/w" },
      						}
      					do
      						assertRoute(
      							route[1],
      							"https://api.mercury.com/api/v1" .. route[2],
      							(access == "write")
      						)
      					end
      					assertRoute("GET", "https://vault-api.mercury.com/api/v1/cards/c/reveal", reveal)
      					for _, route in
      						{
      							{ "GET", "https://api.mercury.com/api/v1/cards/c/reveal" },
      							{ "POST", "https://vault-api.mercury.com/api/v1/cards/c/reveal" },
      							{ "GET", "https://vault-api.mercury.com/api/v1/accounts" },
      							{ "GET", "https://api.mercury.com.attacker.test/api/v1/accounts" },
      							{ "GET", "http://api.mercury.com/api/v1/accounts" },
      							{ "GET", "https://api.mercury.com:8443/api/v1/accounts" },
      							{ "GET", "https://api-sandbox.mercury.com/api/v1/accounts" },
      							{ "GET", "https://untrusted.s3.amazonaws.com/file" },
      							{ "POST", "https://api.mercury.com/api/v1/safes" },
      							{ "POST", "https://api.mercury.com/api/v1/safes/s/sign" },
      							{ "POST", "https://api.mercury.com/api/v1/request-send-money/r/approve" },
      							{ "POST", "https://api.mercury.com/api/v1/users" },
      							{ "GET", "https://api.mercury.com/api/v1/account/a" },
      							{ "GET", "https://api.mercury.com/api/v1/safes/%2e%2e/accounts" },
      							{ "POST", "https://api.mercury.com/oauth2/token" },
      						}
      					do
      						assertRoute(route[1], route[2], false)
      					end
      				end
      			end
      			local r, err = m.resolve(nil, nil, { token = "fixture" }, "token")
      			if
      				((err ~= nil) or (r.Access["data"] ~= "read"))
      				or (r.PublicConfig["reveal_card_details"] ~= false)
      			then
      				m.fail("wrong defaults: %s, %s", r, err)
      			end
      		end
      	end,
      }
      
    • read_only.luau
      return {
       scenario = {publisher = {}, config = {}, auth_method = "token", auth_config = {token = "fixture-private-mercury-token"}},
       configure = function()
        calls = 0
        http = {request = function(req)
         calls += 1
         assert(req.method == "GET")
         local body
         if string.find(req.url, "/accounts", 1, true) then
          body = '{"accounts":[{"id":"account-1","currentBalance":1234.56,"availableBalance":1200}],"page":{}}'
         elseif string.find(req.url, "/safes/", 1, true) then
          body = '{"id":"safe-1","signedByInvestorAt":"2026-10-01T12:00:00Z","signedByOwnerAt":null,"paidAt":null,"canceledAt":null}'
         else
          body = '[]'
         end
         return fixture.operation({statusCode = 200, headers = {}, body = fixture.reader(body)})
        end}
       end,
       run = function(c)
        local count = 0
        for name in c do
         if name ~= "help" then
          count += 1
         end
        end
        assert(count == 42, "wrong read-only surface")
        for _, name in {"createTransaction", "requestSendMoney", "createInternalTransfer", "requestTransferMoney", "createRecipient", "updateTransaction", "createCard", "freezeCard", "deleteCustomer", "cancelInvoice", "verifyWebhook", "uploadRecipientAttachment", "revealCardPan"} do
         assert(c[name] == nil, "read-only leaked " .. name)
        end
        local account = c.getAccounts().accounts[1]
        assert(account.currentBalance == 1234.56 and account.availableBalance == 1200)
        local safe = c.getSafeRequest({safeRequestId = "safe-1"})
        assert(safe.signedByInvestorAt == "2026-10-01T12:00:00Z" and safe.paidAt == json.decode("null"))
        assert(safe.status == nil, "invented SAFE status")
        assert(json.encode(c.getSafeRequests()) == "[]", "empty SAFE array lost")
        assert(calls == 3)
       end,
      }