{
    "info": {
        "_postman_id": "b7e4f2a1-9c3d-4a8e-bf12-6d0a5c7e91f4",
        "name": "Online Notary Center API",
        "description": "REST API for remote online notarization (RON) and electronic signatures.\n\n## Getting started\n\n1. Set the `base_url` variable (defaults to the production host).\n2. Run **Authentication → Get Access Token** with your `client_id` / `client_secret`; the\n   access token is stored automatically and used by every other request.\n3. Optionally run **Request Long-Lived Token** to extend it to 365 days.\n\nRequests inside a folder are ordered so they can be run top to bottom — each one saves\nthe ids the next one needs (`notary_id`, `esign_id`, `template_id`).\n\nFull documentation: https://docs.onlinenotarycenter.com/",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "auth": {
        "type": "bearer",
        "bearer": [
            {
                "key": "token",
                "value": "{{access_token}}",
                "type": "string"
            }
        ]
    },
    "variable": [
        {
            "key": "base_url",
            "value": "https://app.onlinenotarycenter.com",
            "type": "string"
        },
        {
            "key": "client_id",
            "value": "",
            "type": "string"
        },
        {
            "key": "client_secret",
            "value": "",
            "type": "string"
        },
        {
            "key": "access_token",
            "value": "",
            "type": "string"
        },
        {
            "key": "refresh_token",
            "value": "",
            "type": "string"
        },
        {
            "key": "auth_code",
            "value": "",
            "type": "string"
        },
        {
            "key": "notary_id",
            "value": "",
            "type": "string"
        },
        {
            "key": "esign_id",
            "value": "",
            "type": "string"
        },
        {
            "key": "template_id",
            "value": "",
            "type": "string"
        },
        {
            "key": "session_id",
            "value": "",
            "type": "string"
        },
        {
            "key": "user_id",
            "value": "",
            "type": "string"
        },
        {
            "key": "file_id",
            "value": "",
            "type": "string"
        }
    ],
    "item": [
        {
            "name": "1. Authentication",
            "description": "OAuth 2.0 authorization-code flow. Run these first.",
            "item": [
                {
                    "name": "Authorize (open in browser)",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/oauth/authorize?response_type=code&client_id={{client_id}}&state=xyz",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "oauth",
                                "authorize"
                            ],
                            "query": [
                                {
                                    "key": "response_type",
                                    "value": "code"
                                },
                                {
                                    "key": "client_id",
                                    "value": "{{client_id}}"
                                },
                                {
                                    "key": "state",
                                    "value": "xyz"
                                }
                            ]
                        },
                        "description": "Open this URL in a browser and sign in to approve the client. Copy the returned\nauthorization code into the `auth_code` collection variable.",
                        "auth": {
                            "type": "noauth"
                        }
                    },
                    "response": []
                },
                {
                    "name": "Get Access Token",
                    "request": {
                        "method": "POST",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/oauth/token",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "oauth",
                                "token"
                            ]
                        },
                        "description": "Exchanges the authorization code for an access token. Stores `access_token` and `refresh_token` automatically.",
                        "body": {
                            "mode": "urlencoded",
                            "urlencoded": [
                                {
                                    "key": "grant_type",
                                    "value": "authorization_code",
                                    "type": "text"
                                },
                                {
                                    "key": "code",
                                    "value": "{{auth_code}}",
                                    "type": "text"
                                }
                            ]
                        },
                        "auth": {
                            "type": "basic",
                            "basic": [
                                {
                                    "key": "username",
                                    "value": "{{client_id}}",
                                    "type": "string"
                                },
                                {
                                    "key": "password",
                                    "value": "{{client_secret}}",
                                    "type": "string"
                                }
                            ]
                        }
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);",
                                    "",
                                    "if (body.access_token) {",
                                    "    pm.collectionVariables.set(\"access_token\", body.access_token);",
                                    "    pm.collectionVariables.set(\"refresh_token\", body.refresh_token || \"\");",
                                    "    console.log(\"access_token saved\");",
                                    "}",
                                    "",
                                    "pm.test(\"returned an access token\", () => pm.expect(body.access_token).to.be.a(\"string\"));"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Refresh Access Token",
                    "request": {
                        "method": "POST",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/oauth/token",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "oauth",
                                "token"
                            ]
                        },
                        "description": "Gets a fresh access token without re-authorizing.",
                        "body": {
                            "mode": "urlencoded",
                            "urlencoded": [
                                {
                                    "key": "grant_type",
                                    "value": "refresh_token",
                                    "type": "text"
                                },
                                {
                                    "key": "refresh_token",
                                    "value": "{{refresh_token}}",
                                    "type": "text"
                                }
                            ]
                        },
                        "auth": {
                            "type": "basic",
                            "basic": [
                                {
                                    "key": "username",
                                    "value": "{{client_id}}",
                                    "type": "string"
                                },
                                {
                                    "key": "password",
                                    "value": "{{client_secret}}",
                                    "type": "string"
                                }
                            ]
                        }
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);",
                                    "",
                                    "if (body.access_token) pm.collectionVariables.set(\"access_token\", body.access_token);"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Request Long-Lived Token",
                    "request": {
                        "method": "POST",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/request-long-live-token",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "request-long-live-token"
                            ]
                        },
                        "description": "Extends the lifetime of the current access token to 365 days."
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);",
                                    "",
                                    "pm.test(\"token extended\", () => pm.expect(body.msg || \"\").to.include(\"extended\"));"
                                ]
                            }
                        }
                    ]
                }
            ]
        },
        {
            "name": "2. Notary Sessions",
            "description": "Remote online notarization. Run in order: create → update signers → prepare.",
            "item": [
                {
                    "name": "Create Notary Session",
                    "request": {
                        "method": "POST",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/create-notary-session",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "create-notary-session"
                            ]
                        },
                        "description": "Uploads one or more PDF documents and opens a notary session.\n\nPick a file for `files[]` in the Body tab before sending. Add the key again to upload several documents.",
                        "body": {
                            "mode": "formdata",
                            "formdata": [
                                {
                                    "key": "files[]",
                                    "type": "file",
                                    "src": [],
                                    "description": "Select a PDF document"
                                }
                            ]
                        }
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);",
                                    "",
                                    "if (body.notary_id) {",
                                    "    pm.collectionVariables.set(\"notary_id\", body.notary_id);",
                                    "    console.log(\"notary_id = \" + body.notary_id);",
                                    "}",
                                    "",
                                    "pm.test(\"returned a notary_id\", () => pm.expect(body.notary_id).to.be.a(\"string\"));"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Update Notary Signers",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/api/update-notary-signers",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "update-notary-signers"
                            ]
                        },
                        "description": "Replaces the signer list. The main signer is described by the top-level fields.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"notary_id\": \"{{notary_id}}\",\n    \"contact_type\": \"self\",\n    \"first_name\": \"John\",\n    \"last_name\": \"Doe\",\n    \"email\": \"john.doe@example.com\",\n    \"phone\": \"5551234567\",\n    \"other_signers\": [\n        {\n            \"contact_type\": \"signer\",\n            \"first_name\": \"Jane\",\n            \"last_name\": \"Doe\",\n            \"email\": \"jane.doe@example.com\",\n            \"active\": 1,\n            \"share_room\": 1\n        }\n    ]\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Prepare Notary Session",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/api/prepare-notary-session",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "prepare-notary-session"
                            ]
                        },
                        "description": "Finalizes the session and returns the signer join link plus passcode.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"notary_id\": \"{{notary_id}}\",\n    \"business_pay\": true,\n    \"redirect_uri\": \"https://yourapp.example.com/notary/complete\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);",
                                    "",
                                    "pm.test(\"returned a join link\", () => pm.expect(body.session_link).to.include(\"/notary/client-join/\"));",
                                    "pm.test(\"returned a passcode\", () => pm.expect(body.passcode).to.be.a(\"string\"));"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Check Session Status",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/check-session-status/{{notary_id}}",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "check-session-status",
                                "{{notary_id}}"
                            ]
                        },
                        "description": "Returns the current room state of a session."
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);",
                                    "",
                                    "pm.test(\"returned a status\", () => pm.expect(body.status).to.be.a(\"string\"));"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Send New Room Push",
                    "request": {
                        "method": "POST",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/send-new-room-push",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "send-new-room-push"
                            ]
                        },
                        "description": "Broadcasts a real-time notification telling online notaries a session is waiting.\n\nSet `display_ringer` to 1 to ring notaries' dashboards.",
                        "body": {
                            "mode": "urlencoded",
                            "urlencoded": [
                                {
                                    "key": "notary_id",
                                    "value": "{{notary_id}}",
                                    "type": "text"
                                },
                                {
                                    "key": "file_title",
                                    "value": "Power of Attorney",
                                    "type": "text"
                                },
                                {
                                    "key": "session_state",
                                    "value": "pending",
                                    "type": "text"
                                },
                                {
                                    "key": "display_ringer",
                                    "value": "0",
                                    "type": "text"
                                }
                            ]
                        }
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Download Notarized Files",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/download-notarized-files/{{notary_id}}",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "download-notarized-files",
                                "{{notary_id}}"
                            ]
                        },
                        "description": "Downloads all notarized documents as a ZIP archive. Use \"Save Response → Save to a file\"."
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "pm.test(\"response is a ZIP\", () => pm.expect(pm.response.text().slice(0, 2)).to.eql(\"PK\"));"
                                ]
                            }
                        }
                    ]
                }
            ]
        },
        {
            "name": "3. eSign Sessions",
            "description": "Electronic signatures without a notary meeting.",
            "item": [
                {
                    "name": "Create eSign Session",
                    "request": {
                        "method": "POST",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/create-esign-session",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "create-esign-session"
                            ]
                        },
                        "description": "Uploads one or more PDF documents and opens an eSign session.",
                        "body": {
                            "mode": "formdata",
                            "formdata": [
                                {
                                    "key": "files[]",
                                    "type": "file",
                                    "src": [],
                                    "description": "Select a PDF document"
                                }
                            ]
                        }
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);",
                                    "",
                                    "if (body.notary_id) {",
                                    "    pm.collectionVariables.set(\"esign_id\", body.notary_id);",
                                    "    console.log(\"esign_id = \" + body.notary_id);",
                                    "}",
                                    "",
                                    "pm.test(\"returned a notary_id\", () => pm.expect(body.notary_id).to.be.a(\"string\"));"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Update eSign Signers",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/api/update-esign-signers",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "update-esign-signers"
                            ]
                        },
                        "description": "Replaces the signer list of an eSign session.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"notary_id\": \"{{esign_id}}\",\n    \"contact_type\": \"self\",\n    \"first_name\": \"John\",\n    \"last_name\": \"Doe\",\n    \"email\": \"john.doe@example.com\",\n    \"other_signers\": [\n        {\n            \"contact_type\": \"signer\",\n            \"first_name\": \"Jane\",\n            \"last_name\": \"Doe\",\n            \"email\": \"jane.doe@example.com\",\n            \"phone\": \"5559876543\",\n            \"address\": \"123 Main St\",\n            \"city\": \"Houston\",\n            \"state\": \"TX\",\n            \"zipcode\": \"77001\",\n            \"role_id\": 0,\n            \"active\": 1,\n            \"share_room\": 1\n        }\n    ]\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Prepare eSign Session",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/api/prepare-esign-session",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "prepare-esign-session"
                            ]
                        },
                        "description": "Activates the session files and returns the field-editor link plus a direct signing\nlink for every signer.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"notary_id\": \"{{esign_id}}\",\n    \"business_pay\": true,\n    \"redirect_uri\": \"https://yourapp.example.com/esign/complete\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);",
                                    "",
                                    "pm.test(\"returned a preparation link\", () => pm.expect(body.session_ot_link).to.include(\"/esign/api-prepare/\"));",
                                    "pm.test(\"returned signer links\", () => pm.expect(Object.keys(body.contacts || {})).to.not.be.empty);"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Create eSign Session from Template",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/api/create-esign-template-session",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "create-esign-template-session"
                            ]
                        },
                        "description": "Builds a ready-to-sign session from a saved document-library template in one call.\n\n`file_id` is the numeric id of a document in your library — not a `notary_id` from\nList Templates. Signers are given in template-role order; index 0 is the main signer.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"file_id\": \"{{file_id}}\",\n    \"signers\": [\n        {\n            \"first_name\": \"John\",\n            \"last_name\": \"Doe\",\n            \"email\": \"john.doe@example.com\"\n        },\n        {\n            \"first_name\": \"Jane\",\n            \"last_name\": \"Doe\",\n            \"email\": \"jane.doe@example.com\",\n            \"role_id\": 2\n        }\n    ],\n    \"var_data\": {\n        \"company_name\": \"Acme LLC\",\n        \"effective_date\": \"2026-08-03\"\n    },\n    \"business_pay\": true\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);",
                                    "",
                                    "if (body.notary_id) pm.collectionVariables.set(\"esign_id\", body.notary_id);",
                                    "",
                                    "pm.test(\"returned signer links\", () => pm.expect(Object.keys(body.contacts || {})).to.not.be.empty);"
                                ]
                            }
                        }
                    ]
                }
            ]
        },
        {
            "name": "4. Templates & Partner Sessions",
            "description": "Reusable documents with predefined signature fields, roles and custom fields.",
            "item": [
                {
                    "name": "List Templates",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/templates/{{user_id}}",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "templates",
                                "{{user_id}}"
                            ]
                        },
                        "description": "Returns all active templates created by the given user, keyed by notary_id."
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);",
                                    "",
                                    "const ids = Object.keys(body.templates || {});",
                                    "if (ids.length) {",
                                    "    pm.collectionVariables.set(\"template_id\", ids[0]);",
                                    "    console.log(\"template_id = \" + ids[0]);",
                                    "}",
                                    "",
                                    "pm.test(\"returned a templates object\", () => pm.expect(body.templates).to.be.an(\"object\"));"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Template Contacts",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/template-contacts/{{template_id}}",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "template-contacts",
                                "{{template_id}}"
                            ]
                        },
                        "description": "Returns the signer roles of a template. Use these ids as keys in Build Template Session."
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Template Items (custom fields)",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/template-items/{{template_id}}",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "template-items",
                                "{{template_id}}"
                            ]
                        },
                        "description": "Returns the custom fields defined on a template."
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Partner Sessions",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/partner-sessions/{{user_id}}",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "partner-sessions",
                                "{{user_id}}"
                            ]
                        },
                        "description": "Lists all template sessions of a user, newest first, with a Pending/Completed status.\n\nSaves the newest `session_id` and `file_id` so the download request below can run as-is."
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);",
                                    "",
                                    "const first = (body.sessions || [])[0];",
                                    "if (first) {",
                                    "    pm.collectionVariables.set(\"session_id\", first.session_id);",
                                    "    pm.collectionVariables.set(\"file_id\", first.file_id);",
                                    "    console.log(\"session_id = \" + first.session_id);",
                                    "} else {",
                                    "    console.log(\"no template sessions yet — set session_id manually\");",
                                    "}"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Build Template Session",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/api/build-template-session/{{template_id}}",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "build-template-session",
                                "{{template_id}}"
                            ]
                        },
                        "description": "Sends a template out for signature. Every signer in `contact_info` is emailed a join\nlink and passcode, so only send this when you mean to deliver real email.\n\nKeys of `contact_info` are template contact ids from Template Contacts.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"contact_info\": {\n        \"501\": {\n            \"first_name\": \"John\",\n            \"last_name\": \"Doe\",\n            \"email\": \"john.doe@example.com\"\n        }\n    },\n    \"custom_fields\": {\n        \"company_name\": \"Acme LLC\",\n        \"effective_date\": \"2026-08-03\"\n    },\n    \"company_name\": \"Acme LLC\",\n    \"fromAddress\": \"docs@acme.example.com\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Download Session File",
                    "request": {
                        "method": "GET",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/download-session-file/{{file_id}}/{{session_id}}",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "download-session-file",
                                "{{file_id}}",
                                "{{session_id}}"
                            ]
                        },
                        "description": "Downloads the signed document of a completed template session."
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Delete Template Session",
                    "request": {
                        "method": "POST",
                        "header": [],
                        "url": {
                            "raw": "{{base_url}}/api/delete-template-session/{{session_id}}",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "api",
                                "delete-template-session",
                                "{{session_id}}"
                            ]
                        },
                        "description": "Permanently removes a template session and its contacts.\n\nNeeds a real `session_id` — run Partner Sessions first, or set the variable yourself.\nThis is destructive, so it is not meant to be part of a top-to-bottom folder run."
                    },
                    "response": [],
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "pm.test(\"status is 200\", () => pm.response.to.have.status(200));",
                                    "",
                                    "let body = {};",
                                    "try { body = pm.response.json(); } catch (e) { /* binary or html response */ }",
                                    "",
                                    "pm.test(\"no API error\", () => pm.expect(body.error, body.error).to.be.undefined);"
                                ]
                            }
                        }
                    ]
                }
            ]
        }
    ]
}
