### Retrieve Current API Key Info using cURL Source: https://docs.moderntreasury.com/platform/reference/authentication This example shows how to retrieve information about the currently used API key via a GET request using cURL. It also employs HTTP basic authentication with the Organization ID and API Key. ```shell curl --request GET \ -u ORGANIZATION_ID:API_KEY \ --url https://app.moderntreasury.com/api/api_keys/current ``` -------------------------------- ### Payment Configuration Example Source: https://docs.moderntreasury.com/platform/reference/balance-report-object This snippet shows an example of payment configuration, including vendor code type, live mode status, and timestamps for creation and updates. It is a common configuration block for payment processing. ```json { "vendor_code_type": "bai2", "live_mode": true, "created_at": "2019-11-09T00:11:07Z", "updated_at": "2019-11-09T00:11:07Z" } ``` -------------------------------- ### Contact Detail JSON Example Source: https://docs.moderntreasury.com/platform/reference/contact-detail-object An example of a Contact Detail object in JSON format, illustrating its structure and attributes. ```json { "id": "1234da60-405c-44bc-8b33-2bdb9419afe3", "object": "contact_detail", "contact_identifier": "harry@hogwarts.com", "contact_identifier_type": "email", "live_mode": true, "created_at": "2019-11-09T00:11:07Z", "updated_at": "2019-11-09T00:11:07Z" } ``` -------------------------------- ### General Platform Configuration Example Source: https://docs.moderntreasury.com/platform/reference/balance-report-object This snippet illustrates a general platform configuration, specifying the live mode status and timestamps for creation and updates. This configuration is often found at the root level of platform settings. ```json { "live_mode": true, "created_at": "2019-11-09T00:11:07Z", "updated_at": "2019-11-09T00:11:07Z" } ``` -------------------------------- ### Ping API Endpoint using cURL Source: https://docs.moderntreasury.com/platform/reference/authentication This example demonstrates how to send a GET request to the API's ping endpoint using cURL. It utilizes HTTP basic authentication by passing the Organization ID and API Key in the Authorization header. ```shell curl --request GET \ -u ORGANIZATION_ID:API_KEY \ --url https://app.moderntreasury.com/api/ping ``` -------------------------------- ### Successful Bulk Result Example Source: https://docs.moderntreasury.com/platform/reference/bulk-results Example of a successful bulk operation result, showing the details of the processed transaction. ```APIDOC ## Successful Bulk Result Example ### Description This endpoint returns details of a successful bulk operation, including transaction information and associated routing details. ### Method GET ### Endpoint `/api/bulk_results/{id}` ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the bulk result to retrieve. ### Response #### Success Response (200) - **id** (string) - Unique identifier for the bulk result. - **object** (string) - Type of the object, always "bulk_result". - **live_mode** (boolean) - Indicates if the operation was performed in live mode. - **request_id** (string) - Identifier for the specific request. - **request_type** (string) - Type of the bulk request. - **entity_id** (string) - Identifier for the entity associated with the bulk operation. - **entity_type** (string) - Type of the entity. - **entity** (object) - Details of the entity. - **id** (string) - Unique identifier for the entity. - **object** (string) - Type of the entity. - **live_mode** (boolean) - Indicates if the operation was performed in live mode. - **payment_type** (string) - Type of payment. - **routing_details** (array) - Array of routing details. - **id** (string) - Unique identifier for the routing detail. - **object** (string) - Type of the object, always "routing_detail". - **live_mode** (boolean) - Indicates if the operation was performed in live mode. - **payment_type** (string) - Type of payment. - **routing_number** (string) - The routing number. - **routing_number_type** (string) - Type of the routing number. - **bank_name** (string) - Name of the bank. - **bank_address** (object) - Address of the bank. - **id** (string) - Unique identifier for the address. - **object** (string) - Type of the object, always "address". - **live_mode** (boolean) - Indicates if the operation was performed in live mode. - **line1** (string) - First line of the address. - **locality** (string) - City of the address. - **region** (string) - State or region of the address. - **postal_code** (string) - Postal code of the address. - **country** (string) - Country of the address. - **created_at** (string) - Timestamp of creation. - **updated_at** (string) - Timestamp of last update. - **discarded_at** (string) - Timestamp when discarded, if applicable. - **created_at** (string) - Timestamp of creation. - **updated_at** (string) - Timestamp of last update. - **name** (string) - Name associated with the entity. - **metadata** (object) - Key-value pairs for additional information. - **verification_status** (string) - Verification status of the entity. - **contact_details** (array) - Array of contact details. - **ledger_account_id** (string) - ID of the associated ledger account. - **discarded_at** (string) - Timestamp when discarded, if applicable. - **created_at** (string) - Timestamp of creation. - **updated_at** (string) - Timestamp of last update. - **receiving_account_id** (string) - ID of the receiving account. - **receiving_account_type** (string) - Type of the receiving account. - **currency** (string) - Currency of the transaction. - **effective_date** (string) - The effective date of the transaction. - **priority** (string) - Priority of the transaction. - **description** (string) - Description of the transaction. - **statement_descriptor** (string) - Statement descriptor for the transaction. - **remittance_information** (string) - Remittance information for the transaction. - **metadata** (object) - Key-value pairs for additional information. - **status** (string) - Status of the transaction. - **counterparty_id** (string) - ID of the counterparty. - **transaction_ids** (array) - Array of transaction IDs. - **charge_bearer** (string) - Charge bearer information. - **foreign_exchange_indicator** (string) - Foreign exchange indicator. - **foreign_exchange_contract** (string) - Foreign exchange contract details. - **nsf_protected** (boolean) - Indicates if NSF protection is enabled. - **transaction_monitoring_enabled** (boolean) - Indicates if transaction monitoring is enabled. - **originating_party_name** (string) - Name of the originating party. - **ultimate_originating_party_name** (string) - Name of the ultimate originating party. - **ultimate_originating_party_identifier** (string) - Identifier of the ultimate originating party. - **ultimate_receiving_party_name** (string) - Name of the ultimate receiving party. - **ultimate_receiving_party_identifier** (string) - Identifier of the ultimate receiving party. - **current_return** (object) - Details of the current return, if any. - **reference_numbers** (array) - Array of reference numbers. - **send_remittance_advice** (boolean) - Indicates if remittance advice should be sent. - **subtype** (string) - Subtype of the transaction. - **purpose** (string) - Purpose of the transaction. - **vendor_failure_reason** (string) - Reason for vendor failure, if applicable. - **ledger_transaction_id** (string) - ID of the associated ledger transaction. - **decision_id** (string) - ID of the decision made for the transaction. - **created_at** (string) - Timestamp of creation. - **updated_at** (string) - Timestamp of last update. - **accounting** (object) - Accounting details. - **account_id** (string) - ID of the accounting account. - **class_id** (string) - ID of the accounting class. - **expires_at** (string) - Timestamp when the transaction expires. - **compliance_rule_metadata** (object) - Metadata related to compliance rules. - **accounting_category_id** (string) - ID of the accounting category. - **accounting_ledger_class_id** (string) - ID of the accounting ledger class. - **request_params** (object) - Parameters used for the request. - **type** (string) - Type of the request. - **amount** (integer) - Amount of the transaction. - **direction** (string) - Direction of the transaction. - **receiving_account_id** (string) - ID of the receiving account. - **originating_account_id** (string) - ID of the originating account. - **status** (string) - Overall status of the bulk operation. - **created_at** (string) - Timestamp of creation. - **updated_at** (string) - Timestamp of last update. ### Request Example ```json { "id": "e4ead54c-3e76-4954-9171-e5752fd85bdc", "object": "bulk_result", "live_mode": true, "request_id": "9c976385-8a02-42d8-9ffd-009ada3ac604", "request_type": "bulk_request", "entity_id": "4028fca0-7250-4302-8ae1-ebc192e2861f", "entity_type": "bulk_error", "entity": { "id": "4028fca0-7250-4302-8ae1-ebc192e2861f", "object": "bulk_error", "live_mode": true, "request_errors": { "originating_account": [ { "type": "record", "error": "invalid_type" } ] }, "created_at": "2023-08-18T22:27:39Z", "updated_at": "2023-08-18T22:27:39Z" }, "request_params": { "type": "ach", "amount": 1000, "direction": "credit", "currency": "USD", "originating_account_id": "cb16caf3-d822-4067-bd0f-0064bde82862", "receiving_account_id": "e1acda06-f777-4903-bf56-f430673ae27d" }, "status": "failed", "created_at": "2023-08-18T22:27:33Z", "updated_at": "2023-08-18T22:27:39Z" } ``` ``` -------------------------------- ### Failed Bulk Result Example Source: https://docs.moderntreasury.com/platform/reference/bulk-results Example of a failed bulk operation result, highlighting the specific errors encountered. ```APIDOC ## Failed Bulk Result Example ### Description This endpoint returns details of a failed bulk operation, indicating the errors that prevented successful processing. ### Method GET ### Endpoint `/api/bulk_results/{id}` ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the bulk result to retrieve. ### Response #### Success Response (200) - **id** (string) - Unique identifier for the bulk result. - **object** (string) - Type of the object, always "bulk_result". - **live_mode** (boolean) - Indicates if the operation was performed in live mode. - **request_id** (string) - Identifier for the specific request. - **request_type** (string) - Type of the bulk request. - **entity_id** (string) - Identifier for the entity associated with the bulk operation. - **entity_type** (string) - Type of the entity. - **entity** (object) - Details of the entity, including errors. - **id** (string) - Unique identifier for the entity. - **object** (string) - Type of the entity. - **live_mode** (boolean) - Indicates if the operation was performed in live mode. - **request_errors** (object) - Object containing details of request errors. - **originating_account** (array) - Array of errors related to the originating account. - **type** (string) - Type of the error. - **error** (string) - Description of the error. - **created_at** (string) - Timestamp of creation. - **updated_at** (string) - Timestamp of last update. - **receiving_account_id** (string) - ID of the receiving account. - **receiving_account_type** (string) - Type of the receiving account. - **currency** (string) - Currency of the transaction. - **effective_date** (string) - The effective date of the transaction. - **priority** (string) - Priority of the transaction. - **description** (string) - Description of the transaction. - **statement_descriptor** (string) - Statement descriptor for the transaction. - **remittance_information** (string) - Remittance information for the transaction. - **metadata** (object) - Key-value pairs for additional information. - **status** (string) - Status of the transaction. - **counterparty_id** (string) - ID of the counterparty. - **transaction_ids** (array) - Array of transaction IDs. - **charge_bearer** (string) - Charge bearer information. - **foreign_exchange_indicator** (string) - Foreign exchange indicator. - **foreign_exchange_contract** (string) - Foreign exchange contract details. - **nsf_protected** (boolean) - Indicates if NSF protection is enabled. - **transaction_monitoring_enabled** (boolean) - Indicates if transaction monitoring is enabled. - **originating_party_name** (string) - Name of the originating party. - **ultimate_originating_party_name** (string) - Name of the ultimate originating party. - **ultimate_originating_party_identifier** (string) - Identifier of the ultimate originating party. - **ultimate_receiving_party_name** (string) - Name of the ultimate receiving party. - **ultimate_receiving_party_identifier** (string) - Identifier of the ultimate receiving party. - **current_return** (object) - Details of the current return, if any. - **reference_numbers** (array) - Array of reference numbers. - **send_remittance_advice** (boolean) - Indicates if remittance advice should be sent. - **subtype** (string) - Subtype of the transaction. - **purpose** (string) - Purpose of the transaction. - **vendor_failure_reason** (string) - Reason for vendor failure, if applicable. - **ledger_transaction_id** (string) - ID of the associated ledger transaction. - **decision_id** (string) - ID of the decision made for the transaction. - **created_at** (string) - Timestamp of creation. - **updated_at** (string) - Timestamp of last update. - **accounting** (object) - Accounting details. - **account_id** (string) - ID of the accounting account. - **class_id** (string) - ID of the accounting class. - **expires_at** (string) - Timestamp when the transaction expires. - **compliance_rule_metadata** (object) - Metadata related to compliance rules. - **accounting_category_id** (string) - ID of the accounting category. - **accounting_ledger_class_id** (string) - ID of the accounting ledger class. - **request_params** (object) - Parameters used for the request. - **type** (string) - Type of the request. - **amount** (integer) - Amount of the transaction. - **direction** (string) - Direction of the transaction. - **currency** (string) - Currency of the transaction. - **originating_account_id** (string) - ID of the originating account. - **receiving_account_id** (string) - ID of the receiving account. - **status** (string) - Overall status of the bulk operation. - **created_at** (string) - Timestamp of creation. - **updated_at** (string) - Timestamp of last update. ### Request Example ```json { "id": "e4ead54c-3e76-4954-9171-e5752fd85bdc", "object": "bulk_result", "live_mode": true, "request_id": "9c976385-8a02-42d8-9ffd-009ada3ac604", "request_type": "bulk_request", "entity_id": "4028fca0-7250-4302-8ae1-ebc192e2861f", "entity_type": "bulk_error", "entity": { "id": "4028fca0-7250-4302-8ae1-ebc192e2861f", "object": "bulk_error", "live_mode": true, "request_errors": { "originating_account": [ { "type": "record", "error": "invalid_type" } ] }, "created_at": "2023-08-18T22:27:39Z", "updated_at": "2023-08-18T22:27:39Z" }, "request_params": { "type": "ach", "amount": 1000, "direction": "credit", "currency": "USD", "originating_account_id": "cb16caf3-d822-4067-bd0f-0064bde82862", "receiving_account_id": "e1acda06-f777-4903-bf56-f430673ae27d" }, "status": "failed", "created_at": "2023-08-18T22:27:33Z", "updated_at": "2023-08-18T22:27:39Z" } ``` ``` -------------------------------- ### Counterparty Object Example (JSON) Source: https://docs.moderntreasury.com/platform/reference/counterparty-object This JSON object represents a Counterparty, including its unique identifier, name, email, remittance advice preference, metadata, and associated external accounts. It also shows live mode status and creation/update timestamps. ```json { "id": "928db55e-6552-4aaf-96d7-10c693922b1f", "object": "counterparty", "name": "John Smith", "email": "abby@marquardtschuppe.net", "send_remittance_advice": true, "metadata": {}, "accounts": [ { "id": "c8d059bc-e781-4528-9359-d46eaaa7f953", "object": "external_account", "account_type": null, "party_name": "John Smith", "party_type": "business", "party_address": null, "account_details": [ { "id": "3036a533-53ad-4e58-ba30-33c4d75c0c57", "object": "account_detail", "account_number_safe": "1291", "account_number_type": null, "live_mode": true } ], "routing_details": [ { "id": "e8626e0b-2687-4b0d-9f2c-68a4c29ee5f1", "object": "routing_detail", "payment_type": null, "routing_number": "121141822", "routing_number_type": "aba", "live_mode": true } ], "live_mode": true } ], "live_mode": true, "external_id": null, "created_at": "2019-11-09T00:11:07Z", "updated_at": "2019-11-09T00:11:07Z" } ``` -------------------------------- ### Bulk Request Object Structure Source: https://docs.moderntreasury.com/platform/reference/bulk-requests An example representation of a Bulk Request object. It demonstrates the JSON structure including the action type, target resource, and current processing status. ```json { "id": "91c9117f-4855-419c-ad57-0801a58553d4", "object": "bulk_request", "live_mode": true, "action_type": "create", "resource_type": "payment_order", "status": "pending" } ``` -------------------------------- ### Error Response Examples Source: https://docs.moderntreasury.com/platform/reference/add-ledger-entries-to-settlement Examples of common error responses encountered when interacting with the Modern Treasury API. ```APIDOC ## Error Response Examples This section details various error responses that can be returned by the API. ### Invalid Ledger Entry IDs This error occurs when invalid ledger entry IDs are provided for a ledger account settlement. ```json { "errors": { "code": "parameter_invalid", "message": "Invalid ledger entry ids provided for the ledger account settlement.", "parameter": "ledger_entries" } } ``` ### Settlement Not Draft This error indicates that the ledger account settlement must be in a draft state to modify ledger entries, but it is currently in a 'posted' state. ```json { "errors": { "code": "parameter_invalid", "message": "The ledger account settlement must be in a draft state to add or remove ledger entries to it, but is in a 'posted' state.", "parameter": "ledger_account_settlement" } } ``` ### Too Many Ledger Entry IDs This error is returned when the number of ledger entry IDs in a request exceeds the maximum allowed limit (e.g., 500). ```json { "errors": { "code": "parameter_invalid", "message": "The number of ledger entry ids exceeds the maximum allowed in a single request of 500.", "parameter": "ledger_account_settlement" } } ``` ### Discarded Ledger Entry This error occurs if a ledger entry specified in the request has a 'discarded' status. Only 'posted' ledger entries are permitted. ```json { "errors": { "code": "parameter_invalid", "message": "Ledger entry '0baa5574-11c8-46e2-9fd3-bc1265c72004' is discarded. Only posted ledger entries are allowed.", "parameter": "ledger_entries" } } ``` ### Non-Posted Ledger Entry This error is returned when a ledger entry included in the request is not in a 'posted' state. ```json { "errors": { "code": "parameter_invalid", "message": "Ledger entry 'fd95cbf2-a3e8-43d9-b1b4-c2bbe2a593cc' is not posted.", "parameter": "ledger_entries" } } ``` ### Ledger Entry in Different Ledger This error indicates that a ledger entry belongs to a different ledger than the one specified for the settlement. ```json { "errors": { "code": "parameter_invalid", "message": "Ledger entry '...' belongs to a different ledger.", "parameter": "ledger_entries" } } ``` ``` -------------------------------- ### Retrieve Success Bulk Result Example Source: https://docs.moderntreasury.com/platform/reference/bulk-results This JSON object demonstrates a successful bulk result. It includes the entity details, such as a payment order, and confirms the status of the operation. ```json { "id": "4c16a33b-a416-44c5-a39f-843e78c03e50", "object": "bulk_result", "live_mode": true, "request_id": "20e2efa7-6329-48ff-b1e1-50432b6a117d", "request_type": "bulk_request", "entity_id": "5749bfe7-f7ac-4758-a863-7b21b3a3394c", "entity_type": "payment_order", "entity": { "id": "5749bfe7-f7ac-4758-a863-7b21b3a3394c", "object": "payment_order", "live_mode": true, "type": "ach", "amount": 1, "direction": "debit", "originating_account_id": "dedf7a81-ddeb-4525-98ed-2b3db9d07a78", "receiving_account": { "id": "681b2044-1a7b-489e-ad71-a1182af84ebe", "object": "external_account", "live_mode": true, "account_type": "other", "party_name": "Adam Stepniewski", "party_type": "individual", "party_address": { "id": "9a4ad985-9ed6-4a97-acae-e9975e066fba", "object": "address", "live_mode": true, "line1": "4708 SW 129th Street", "line2": null, "locality": "Oklahoma City", "region": "OK", "postal_code": "73173", "country": "US", "created_at": "2021-11-04T19:11:45Z", "updated_at": "2021-11-04T19:11:45Z" }, "account_details": [ { "id": "9e8ff325-94f5-4c53-8134-83012bfe4b47", "object": "account_detail", "live_mode": true, "account_number_safe": "5125", "account_number_type": "other", "discarded_at": null, "created_at": "2021-11-04T19:11:45Z" } ] } } } ``` -------------------------------- ### Balance Report JSON Structure Source: https://docs.moderntreasury.com/platform/reference/balance-report-object An example representation of a Balance Report object, showing the structure of the report and the nested balance objects. ```json { "id": "c570ac34-cade-48d2-87ff-28d7216a8af5", "object": "balance_report", "balance_report_type": "previous_day", "as_of_date": "2019-11-09", "as_of_time": "23:46", "internal_account_id": "0f8e3719-3dfd-4613-9bbf-c0333781b59f", "balances": [ { "id": "1f4b0995-338e-41ed-93c4-a41ed8312312", "object": "balance", "amount": 1033236, "as_of_date": "2019-11-08", "as_of_time": "11:09", "currency": "USD", "balance_type": "opening_ledger", "value_date": "2019-11-09", "vendor_code": "010", "vendor_code_type": "bai2", "live_mode": true, "created_at": "2019-11-09T00:11:07Z", "updated_at": "2019-11-09T00:11:07Z" } ] } ``` -------------------------------- ### Account Collection Flow JSON Example Source: https://docs.moderntreasury.com/platform/reference/account-collection-flow-object This JSON object represents an example of an Account Collection Flow. It includes details such as the flow's ID, status, associated payment types, and timestamps. ```json { "id": "454e874b-ff1d-46e8-9d22-0464615cf1e0", "object": "account_collection_flow", "live_mode": true, "client_token": "ac-live-QVj2yTSt6qRNAzXQGKLHS9qfLF7Gs5JcCYHT5xztgjucGRbS6VfrJBpaNo5SrmfZ", "status": "pending", "payment_types": ["ach"], "counterparty_id": "c03581a8-c948-41a9-889a-e5228390fd80", "external_account_id": null, "created_at": "2023-02-18T03:23:48Z", "updated_at": "2023-02-18T03:23:48Z" } ``` -------------------------------- ### Balance Object JSON Representation Source: https://docs.moderntreasury.com/platform/reference/balance-object An example of a serialized Balance object, showing the structure of fields including ID, amount, currency, and vendor-specific metadata. ```json { "id": "1f4b0995-338e-41ed-93c4-a41ed8312312", "object": "balance", "amount": 1033236, "as_of_date": "2019-11-08", "as_of_time": "21:06", "currency": "USD", "balance_type": "opening_ledger", "value_date": "2019-11-11", "vendor_code": "010", "vendor_code_type": "bai2", "live_mode": true, "created_at": "2019-11-09T00:11:07Z", "updated_at": "2019-11-09T00:11:07Z" } ``` -------------------------------- ### GET /api/api_keys/current Source: https://docs.moderntreasury.com/platform/reference/authentication Retrieves information about the currently authenticated API key. ```APIDOC ## GET /api/api_keys/current ### Description Retrieves information about the API key used for the current request. ### Method GET ### Endpoint `https://app.moderntreasury.com/api/api_keys/current` ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```shell curl --request GET \ -u ORGANIZATION_ID:API_KEY \ --url https://app.moderntreasury.com/api/api_keys/current ``` ### Response #### Success Response (200) - **id** (string) - The ID of the API key. - **prefix** (string) - The prefix of the API key. - **created_at** (string) - The timestamp when the API key was created. - **last_used_at** (string) - The timestamp when the API key was last used. - **name** (string) - The name of the API key. - **organization_id** (string) - The ID of the organization associated with the API key. - **environment** (string) - The environment the API key is for (e.g., "production", "sandbox"). - **revoked_at** (string) - The timestamp when the API key was revoked, if applicable. #### Response Example ```json { "id": "key_1234567890abcdef", "prefix": "key_abc123", "created_at": "2023-01-01T12:00:00Z", "last_used_at": "2023-01-01T12:00:00Z", "name": "My Production Key", "organization_id": "org_abcdef123456", "environment": "production", "revoked_at": null } ``` ``` -------------------------------- ### Create a Connection Source: https://docs.moderntreasury.com/platform/reference/connections Creates a new connection to a bank or vendor. ```APIDOC ## POST /connections ### Description Creates a new connection to a bank or vendor. ### Method POST ### Endpoint /connections ### Parameters #### Request Body - **vendor_id** (string) - Required - Unique identifier for the bank or vendor. - **vendor_customer_id** (string) - Optional - An identifier given to this connection by the bank. - **live_mode** (boolean) - Required - Set to true for live environment, false for test environment. ### Request Example { "vendor_id": "vendor_xyz789", "vendor_customer_id": "cust_456", "live_mode": false } ### Response #### Success Response (201) - **id** (string) - Unique identifier for the newly created connection. - **vendor_id** (string) - Unique identifier for the bank or vendor. - **vendor_name** (string) - A human-friendly name for the bank or vendor. - **vendor_customer_id** (string) - An identifier given to this connection by the bank. - **live_mode** (boolean) - True if the object exists in the live environment, false otherwise. #### Response Example { "id": "conn_def456", "vendor_id": "vendor_xyz789", "vendor_name": "Example Bank", "vendor_customer_id": "cust_456", "live_mode": false } ``` -------------------------------- ### Create a Simple Counterparty Source: https://docs.moderntreasury.com/platform/reference/create-counterparty-examples Use this request to create a counterparty with a name and a single checking account. ```json { "name": "Kenner, Bach & Ledeen", "accounts": [ { "account_type": "checking", "routing_details": [ { "routing_number_type": "aba", "routing_number": "026009593" } ], "account_details": [ { "account_number": "123456789" } ] } ] } ``` -------------------------------- ### POST /connections Source: https://docs.moderntreasury.com/platform/reference/create-connection Creates a new connection in the Modern Treasury sandbox environment. This endpoint is specifically for sandbox mode and cannot be used in live mode. ```APIDOC ## POST /connections ### Description Creates a new connection in the sandbox. This endpoint is only available in sandbox mode (`live_mode: false`). ### Method POST ### Endpoint /connections ### Parameters #### Request Body - **entity_id** (string) - Required - The entity ID of the connection. Currently supported values are `example1`, `example2`, and `modern_treasury`. - **nickname** (string) - Optional - An optional human-friendly nickname for the connection. ### Request Example ```json { "entity_id": "modern_treasury", "nickname": "My Primary Connection" } ``` ### Response #### Success Response (201) - **id** (string) - The unique identifier for the connection. - **object** (string) - The type of object, which is 'connection'. - **live_mode** (boolean) - Indicates if the connection is in live mode (defaults to true). - **vendor_id** (string) - The identifier of the vendor for the connection. - **vendor_name** (string) - The human-readable name of the vendor. - **vendor_customer_id** (any) - The vendor's customer ID, if applicable. - **discarded_at** (any) - The timestamp when the connection was discarded, if applicable. - **created_at** (string) - The timestamp when the connection was created. - **updated_at** (string) - The timestamp when the connection was last updated. #### Response Example ```json { "id": "dac94e63-9f4a-46b9-ba6b-412acfbf4cc1", "object": "connection", "live_mode": false, "vendor_id": "modern_treasury", "vendor_name": "Modern Treasury", "vendor_customer_id": null, "discarded_at": null, "created_at": "2025-07-24T23:43:49Z", "updated_at": "2025-07-24T23:43:49Z" } ``` #### Error Responses - **405 Method Not Allowed**: Returned if the action is only available in sandbox mode. ```json { "errors": { "message": "Action is only available in sandbox." } } ``` - **422 Unprocessable Entity**: Returned if an active connection already exists in the sandbox. ```json { "errors": { "message": "An active modern_treasury connection already exists in the sandbox." } } ``` ``` -------------------------------- ### Sample Created Balance Report Webhook (JSON) Source: https://docs.moderntreasury.com/platform/reference/balance-reports This JSON object represents a sample webhook payload for a newly created balance report. It includes details about the report's creation date, type, associated account, and other relevant metadata. This data can be used to process balance reports programmatically. ```json { "event": "created", "data": { "as_of_date": "2019-12-12", "as_of_time": null, "balance_report_type": "previous_day", "balances": [], "created_at": "2019-12-12T22:51:43Z", "id": "94bdba1d-ef15-4fbf-a213-9a5b342f221c", "internal_account_id": "b9fc1ae0-d493-4f01-a7b3-b39104e802b5", "object": "balance_report", "updated_at": "2019-12-12T22:51:43Z" } } ``` -------------------------------- ### GET /external_accounts Source: https://docs.moderntreasury.com/platform/reference/balance-report-object Retrieves information about external bank accounts associated with the organization. ```APIDOC ## GET /external_accounts ### Description Retrieves a list of external accounts configured for the organization, including their vendor codes and status. ### Method GET ### Endpoint /external_accounts ### Parameters #### Query Parameters - **page** (integer) - Optional - Page number for pagination. ### Request Example GET /external_accounts ### Response #### Success Response (200) - **vendor_code_type** (string) - The type of vendor code (e.g., bai2). - **live_mode** (boolean) - Indicates if the account is in live mode. - **created_at** (string) - ISO 8601 timestamp of account creation. - **updated_at** (string) - ISO 8601 timestamp of last update. #### Response Example { "vendor_code_type": "bai2", "live_mode": true, "created_at": "2019-11-09T00:11:07Z", "updated_at": "2019-11-09T00:11:07Z" } ``` -------------------------------- ### Create Counterparty with Plaid Token Source: https://docs.moderntreasury.com/platform/reference/create-counterparty-examples Pass a Plaid processor token into the `account` object instead of `account_details` and `routing_details` to create a counterparty. ```json { "name": "John Smith", "accounts": [ { "plaid_processor_token": "processor-sandbox-91aafea8-c4d0-4477-b471-e1884989de3a" } ] } ``` -------------------------------- ### GET /api/ping Source: https://docs.moderntreasury.com/platform/reference/authentication The ping endpoint is a simple way to check if the API is available and if your authentication credentials are valid. ```APIDOC ## GET /api/ping ### Description Pings the API to check for availability and valid authentication. ### Method GET ### Endpoint `https://app.moderntreasury.com/api/ping` ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```shell curl --request GET \ -u ORGANIZATION_ID:API_KEY \ --url https://app.moderntreasury.com/api/ping ``` ### Response #### Success Response (200) - **message** (string) - A confirmation message, e.g., "pong" #### Response Example ```json { "message": "pong" } ``` ``` -------------------------------- ### Create Ledger Account Balance Monitor via cURL Source: https://docs.moderntreasury.com/platform/reference/create-ledger-account-balance-monitor Use this request to create a new balance monitor. Ensure the ledger_account_id and alert_condition are provided in the request body. ```Shell curl --request POST \ --url https://app.moderntreasury.com/api/ledger_account_balance_monitors \ --header 'accept: application/json' \ --header 'content-type: application/json' ``` -------------------------------- ### POST /api/counterparties Source: https://docs.moderntreasury.com/platform/reference/create-counterparty Creates a new counterparty record in the system. ```APIDOC ## POST /api/counterparties ### Description Create a new counterparty. ### Method POST ### Endpoint https://app.moderntreasury.com/api/counterparties ### Parameters #### Request Body - **name** (string) - Required - A human friendly name for this counterparty. - **accounts** (array of objects) - Optional - The accounts for this counterparty. - **email** (string) - Optional - An optional email to assign to the counterparty. - **metadata** (json) - Optional - Metadata to be added to the counterparty. Must be a JSON object. - **send_remittance_advice** (boolean) - Optional - Whether to send remittance advice. - **taxpayer_identifier** (string) - Optional - Valid tax payer ID for counterparty's region. - **legal_entity** (object) - Optional - legal_entity object. - **legal_entity_id** (string) - Optional - ID of the associated legal entity. - **external_id** (string) - Optional - An optional user-defined 180 character unique identifier. ### Response #### Success Response (201) - **201** - Counterparty created successfully. ``` -------------------------------- ### Create Balance Report - OpenAPI Definition Source: https://docs.moderntreasury.com/platform/reference/create-balance-report This snippet defines the POST endpoint for creating a balance report for an internal account. It specifies the request body schema, including required fields like 'as_of_date', 'as_of_time', 'balance_report_type', and 'balances'. It also details the parameters and possible responses. ```json { "openapi": "3.1.0", "info": { "title": "modern-treasury-api", "version": "1.0" }, "servers": [ { "url": "https://app.moderntreasury.com/api" } ], "components": { "securitySchemes": { "sec0": { "type": "http", "scheme": "basic" } } }, "security": [ { "sec0": [] } ], "paths": { "/internal_accounts/{internal_account_id}/balance_reports": { "post": { "summary": "Create Balance Report", "description": "Available in Sandbox and as an Early Access feature in Production", "operationId": "create-balance-report", "parameters": [ { "name": "internal_account_id", "in": "path", "description": "The ID of one of your internal accounts.", "schema": { "type": "string" }, "required": true } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "required": [ "as_of_date", "as_of_time", "balance_report_type", "balances" ], "properties": { "as_of_date": { "type": "string", "description": "The date of the balance report in YYYY-MM-DD format.", "format": "date" }, "as_of_time": { "type": "string", "description": "The time of the balance report in HH:MM format." }, "balance_report_type": { "type": "string", "description": "See possible types at [Balance Reports](https://docs.moderntreasury.com/platform/reference/balance-report-object)" }, "balances": { "type": "array", "items": { "properties": { "amount": { "type": "integer", "description": "The amount of the balance.", "format": "int32" }, "vendor_code": { "type": "string", "description": "The code used by the bank when reporting this specific balance. This field is required if balance_type is not provided, defaults to user when left empty" }, "vendor_code_type": { "type": "string", "description": "The type of `vendor_code` being reported. Can be one of `bai2`, `bankprov`, `bnk_dev`, `cleartouch`, `currencycloud`, `cross_river`, `dc_bank`, `dwolla`, `evolve`, `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `signet`, `silvergate`, `swift`, `us_bank` or other values depending on your bank. This field is required if balance_type is not provided, defaults to user when left empty." }, "balance_type": { "type": "string", "description": "The specific type of balance reported. One of `opening_ledger`, `closing_ledger`, `current_ledger`, `opening_available`, `opening_available_next_business_day`, `closing_available, current_available`, or `other`. This field is required when vendor_code and vendor_code_type is not provided, defaults to `other` when left empty." } }, "required": [ "amount" ], "type": "object" } } } } } } }, "responses": { "201": { "description": "201", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } }, "400": { "description": "400", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } } }, "deprecated": false } } }, "x-readme": { "headers": [], "explorer-enabled": true, "proxy-enabled": true }, "x-readme-fauxas": true } ```