# Signing for agents: the agent guide

E-signatures for AI agents at <https://sign.gurify.com>. You upload a PDF, place the fields, and get a signing link for
each person. **This service sends no email at all, to anyone.** You send each link yourself: by email from your
user's own mailbox, by Telegram, WhatsApp, or any channel your user chooses.

- API: Documenso API v2. Base URL `https://sign.gurify.com/api/v2`.
- Auth: header `Authorization: <api token>`. Send the token as is, with no "Bearer".
- OpenAPI 3.0: <https://sign.gurify.com/api/v2/openapi.json>
- MCP server: <https://sign.gurify.com/mcp> (streamable HTTP). The same work as tools, plus `create_account`: see
  [MCP](#mcp) below.
- Free. Built on Documenso (open source, AGPL-3.0).

## 1. The account and the token (once)

**With a browser:**

1. Create an account at <https://sign.gurify.com/signup>. Nothing is sent to the email address, and the account is
   active at once.
2. Sign in, open **Settings → API Tokens**, and create a token. Keep it secret.

**Without a browser:** five HTTP calls. Send `Origin: https://sign.gurify.com` with each, as a browser does, and keep
the cookies between them.

1. `POST /api/auth/email-password/signup` with `{"name": "…", "email": "…", "password": "…"}` answers `201`. The
   password needs 8 to 72 characters with an upper-case letter, a lower-case letter, a digit and a symbol (or more than
   25 characters). The account is active at once.
2. `GET /api/auth/csrf` answers `{"csrfToken": "…"}`.
3. `POST /api/auth/email-password/authorize` with `{"email": "…", "password": "…", "csrfToken": "…"}` sets the
   session cookie.
4. `GET /api/trpc/organisation.getMany` gives your organisation's `id` (in `result.data.json[]`). Then
   `GET /api/trpc/team.find?input={"json":{"organisationId":"<that id>"}}`, URL-encoded, gives your team's `id` (in
   `result.data.json.data[]`).
5. `POST /api/trpc/apiToken.create` with `{"json": {"teamId": <team id>, "tokenName": "my-agent", "expirationDate":
   null}}` gives the token in `result.data.json.token`.

These are the web app's own calls, not the public API, so an upgrade of Documenso can change them. Sign-ups are
limited per address. There is no password reset (it would need email): keep the password, or make a new account.

Everything after this is the public API.

## 2. Create the envelope

`POST /envelope/create`, as `multipart/form-data` with two parts:

- `payload`: the JSON below;
- `files`: the PDF, with `type=application/pdf`.

```json
{
  "title": "Rental agreement: Jenna K.",
  "type": "DOCUMENT",
  "meta": {
    "distributionMethod": "NONE",
    "signingOrder": "PARALLEL",
    "timezone": "America/Phoenix",
    "dateFormat": "MM/dd/yyyy",
    "language": "en",
    "redirectUrl": "https://example.com/thank-you"
  },
  "recipients": [
    {
      "email": "jenna@example.com",
      "name": "Jenna K.",
      "role": "SIGNER",
      "signingOrder": 1,
      "fields": [
        {"type": "SIGNATURE", "page": 3, "positionX": 12.0, "positionY": 78.5, "width": 32, "height": 4.2},
        {"type": "DATE", "page": 3, "positionX": 60.0, "positionY": 80.0, "width": 22, "height": 2.6}
      ]
    }
  ]
}
```

The answer is `{"id": "envelope_…"}`.

- Every recipient needs an email address. It names the person in the audit log. Nothing is ever sent to it.
- `role`: `SIGNER`, `APPROVER`, `VIEWER`, `CC` or `ASSISTANT`.
- Field `type`: `SIGNATURE`, `FREE_SIGNATURE`, `INITIALS`, `NAME`, `EMAIL`, `DATE`, `TEXT`, `NUMBER`, `CHECKBOX`,
  `RADIO` or `DROPDOWN`. The choices of `RADIO`, `CHECKBOX` and `DROPDOWN` go in `fieldMeta` (see the OpenAPI
  description).
- `page` counts from 1. `positionX`, `positionY`, `width` and `height` are percentages of the page, measured from its
  top-left corner.
- `signingOrder`: `PARALLEL` (everyone at once) or `SEQUENTIAL` (in the recipients' `signingOrder`).
- `redirectUrl` is optional: the page a person sees after signing.

## 3. Get the signing links

`POST /envelope/distribute`, as JSON:

```json
{"envelopeId": "envelope_…", "meta": {"distributionMethod": "NONE"}}
```

The answer has a link for each recipient:

```json
{
  "success": true,
  "id": "envelope_…",
  "recipients": [
    {"id": 101, "name": "Jenna K.", "email": "jenna@example.com", "role": "SIGNER",
     "signingOrder": 1, "token": "…", "signingUrl": "https://sign.gurify.com/sign/…"}
  ]
}
```

Send each `signingUrl` to its own person and to no one else: the link is that person's key. They open it in any
browser and sign. They need no account.

With `SEQUENTIAL`, send the next person's link after the one before has signed (step 4).

## 4. Follow the status

`GET /envelope/{envelopeId}` returns:

- `status`: `DRAFT`, `PENDING`, `COMPLETED`, `REJECTED` or `CANCELLED`;
- for each recipient, `signingStatus` (`NOT_SIGNED`, `SIGNED` or `REJECTED`) and `readStatus` (`NOT_OPENED` or
  `OPENED`).

Poll at most once a minute per envelope. `GET /envelope?perPage=20` lists your envelopes. A webhook is the other
way: add one in the web app's settings, under Webhooks, for the "signed" and "completed" events.

## 5. Get the signed PDF

When `status` is `COMPLETED`, take the item id from `envelopeItems[].id` in `GET /envelope/{envelopeId}`. Then:

- `GET /envelope/item/{envelopeItemId}/download?version=signed`: the signed PDF;
- `GET /envelope/{envelopeId}/certificate/download`: the signing certificate, as a PDF;
- `GET /envelope/{envelopeId}/audit-log/download`: the audit log, as a PDF.

Send the signed copy to the people who signed, yourself, if they should have it.

## MCP

For a client that speaks MCP: `https://sign.gurify.com/mcp`, streamable HTTP. Send `Authorization: Bearer <api token>`
on the connection. `create_account` works without one.

- `create_account`: an account and an API token in one call, with no email and no human. Give a name and an email
  address (nothing is sent to it). It answers with `api_token`, and a password for the web app when you gave none.
- `send_for_signing`: the PDF (`pdf_base64`, or a public `pdf_url`), the people and their fields (the same `type`,
  `page`, `positionX`, `positionY`, `width`, `height` as above). It answers with a `signing_url` for each person.
  Nothing is emailed.
- `get_envelope`: the status, each person's signing and read status, and the link of each person who has not signed.
- `list_envelopes`; `download_document` (the signed PDF once `COMPLETED`, the original, the certificate or the audit
  log, as an embedded PDF); `cancel_envelope`; `delete_envelope`.

## Placing the fields

Put each field where the PDF asks for it ("Signature", "Date"). One way: `pdftotext -bbox file.pdf -` prints every
word's box in points. For a word at `xMin`, `yMin` on a page `W` points wide and `H` points high:
`positionX = xMin / W * 100` and `positionY = yMin / H * 100`. Draw the boxes on a rendered page and look at it
before you distribute.

## Rules

- **No email, to anyone.** Create and distribute with `"distributionMethod": "NONE"`, so the answer carries the links.
  The service has no way to deliver mail: whatever an envelope asks for, nothing is sent.
- Send a link only to the person it belongs to.
- The finished PDF is sealed with this service's own certificate, "Signing for agents". PDF readers show the seal as
  valid but not issued by a trusted authority. The audit log records who signed, when, and from which address.
- Collecting signatures under false pretenses, or in someone else's name, closes the account.
- Every request is logged for 90 days: the address, the user agent, the path and the status. Tokens, cookies and
  request bodies are not logged, and the tokens in signing links are cut to their first 4 characters.
