SMP eSign: the HTTP API, for integrators
Contract version: /v1
Document revised: 2026-08-18
Companion document: Esign_API_Requirements.md, which is SMP CRM's statement
of what it needs. This document says what exists.
The path version is not the application version. SMP eSign publishes on a calendar scheme and may release on any day.
/v1moves only on a breaking change. A year of releases can pass without this prefix changing, and an integrator watching the release number should not conclude that their contract moved.
1. What exists, at a glance
| Operation | Verdict |
|---|---|
| Authenticate as an application | Exists. Bearer token, issued in the interface. |
| Create a document and attach a correlation identifier | Exists, from a template or from an uploaded file. |
| Add more files to a draft, from a template or an upload | Exists. See §4.5. One email, one completion, one certificate for the packet. |
| Read status as data | Exists. JSON, status as the enum value. |
| Find a document by the caller's own identifier | Exists. |
| List what changed since a timestamp | Exists. |
| Download the executed document | Exists, as one package, and each file's own copy. |
| Download the certificate | Exists. |
| Retry a creation safely | Exists. Idempotency-Key is required on creation. |
| Originate from a saved template | Exists. |
| List templates and read their roles and fields | Exists. |
| Send a document for signature | Exists, for a document originated from a template. |
| Ask what you are connected to | Exists. GET /v1/me. |
| List teams | Exists. |
| Narrow a document sweep to one team | Exists, with a caveat worth reading. See §8a. |
| Lifecycle webhooks | Does not exist. No code emits one. Poll instead. |
Everything in the first block is reachable at https://<your-host>/v1/.
2. Authentication
2.1 The scheme
Authorization: Bearer smpk_live_<43 characters>
Header only. A token is never accepted in a query string, because a query string is written to every access log and proxy log between the caller and this server.
A token belongs to exactly one account. The account is resolved from the token and from nothing else: no endpoint accepts an account identifier in a path, a query string, or a body. See §9.
2.2 Getting one
The owner of an account issues tokens at Settings, then Integrations. Not an
administrator: a token reads every document in the organization, so issuing one
is the owner's decision. See Decisions_Background.md D-177.
Two ways to issue:
- A named integration. SMP CRM appears in the catalogue on that page. Clicking Connect issues a token with the scope that integration needs, labels it, and shows the API address to paste at the other end.
- Your own application. The same page issues a token with a label, a scope, and an optional expiry.
Both produce an ordinary token. There is no capability a catalogued partner has and a hand-issued token does not.
The plaintext is shown once. Only a SHA-256 of it is stored, and there is no code path that can show it again. Losing it means issuing a new one.
2.3 Scopes
| Scope | Permits |
|---|---|
read |
Every GET below. |
write |
Everything read permits, plus creating and sending documents. |
admin |
Everything. |
A scope cannot be widened after issue. Issue a new token and revoke the old one.
2.4 Revocation
Revoking takes effect on the next request. Nothing caches the lookup.
3. Conventions
- JSON in, JSON out,
application/json. Creation from an uploaded file ismultipart/form-data, because it carries a file; creation from a template is ordinary JSON. - Field names are snake case, matching the database.
- Timestamps are RFC 3339 with an explicit offset. Always. Including nulls, which
are
nullrather than an empty string. - Every response, success or failure, carries a
request_idin the body and anX-Request-Idheader. Quote it when reporting a problem: it is in your log and in ours, and a support conversation that starts with one is a single log query.
3.1 The error envelope
Every failure on a /v1 path, including the ones the framework raises, comes
back in this shape:
{
"error": {
"code": "external_id_taken",
"message": "A document with external_id \"contract-4417\" already exists in this account.",
"details": [
{ "field": "file", "issue": "The file field is required." }
],
"request_id": "req_8XM4TR6V3K2N9"
}
}
Branch on code, never on message. The code is stable and documented; the
message may be reworded in any release. details appears only on validation
failures.
3.2 The codes
| Code | Status | Means |
|---|---|---|
unauthenticated |
401 | No token, or a token that is unknown, revoked, or expired. |
insufficient_scope |
403 | The token's scope is too narrow for that operation. |
not_found |
404 | No such record, or it belongs to another account. The two are deliberately indistinguishable. |
file_not_available |
404 | The document exists; the file you asked for has not been produced yet. |
external_id_taken |
409 | This account already has a document with that external_id. Do not retry. |
idempotency_key_reused |
409 | That key was used for a different request body. A client bug, not a retry. |
idempotency_request_in_flight |
409 | A request with that key is still running. Retry shortly. |
idempotency_key_required |
422 | Creation needs an Idempotency-Key header. |
idempotency_key_too_long |
422 | At most 255 characters. |
validation_failed |
422 | See details. |
unknown_status |
422 | The status filter is not one of the document states. |
document_rejected |
422 | The uploaded file cannot become a signable document. The message is fit to show a person. |
origination_source_required |
422 | Creation named both template_id and a file, or neither. |
template_binding_failed |
422 | A role or prefill key that the template does not have, or a required role left unbound. The message names the keys it does have. |
cannot_send |
422 | The draft is not sendable: no fields placed, or the account's allowance is spent. |
already_sent |
409 | The document has already left draft. Do not retry. |
rate_limited |
429 | See Retry-After. |
server_error |
500 | A fault here. The message says nothing about it on purpose; the request identifier is how it is diagnosed. |
3.3 Rate limits
300 requests per minute per token. An unauthenticated request is limited far more tightly, per address.
Spec §20.8 specifies a limit per endpoint class, which is finer than what is built. That is recorded as a known gap rather than claimed.
4. Create a document
One endpoint, two shapes. Send either template_id or a file, never
both and never neither: a request with the wrong number of them is refused with
origination_source_required rather than resolved by precedence.
POST /v1/envelopes
Authorization: Bearer <token> scope: write
Idempotency-Key: <your own key> required
4.0 From a template (the one you want)
Content-Type: application/json
| Field | Type | Required | Notes |
|---|---|---|---|
template_id |
string | yes | TPL-XXXXX-XXXX, from GET /v1/templates. |
recipients[] |
array | yes | Role bindings. See below. |
recipients[].role_key |
string | yes | From the template. Not a free-form name. |
recipients[].placeholder |
boolean | no | true leaves the role to be named in SMP eSign. See below. |
recipients[].name |
string, max 150 | unless placeholder |
|
recipients[].email |
string, max 255 | unless placeholder |
|
recipients[].signing_order |
integer 1-99 | no | Defaults to the template's. |
recipients[].auth_method |
link_only / access_code / email_otp |
no | Defaults to link_only. |
recipients[].access_code |
string, max 40 | no | Required by access_code. |
recipients[].private_message |
string, max 1000 | no | Shown to that recipient only. |
fields |
object | no | Values keyed by field_key, for prefillable fields only. |
title |
string, max 200 | no | Defaults to the template's name. |
message |
string, max 2000 | no | Defaults to the template's. |
external_id |
string, max 255 | no | Your correlation key. See §5. |
A document created this way is complete: the fields are placed, the people are bound, and it can be sent in the next call. That is the difference between a template and an upload, and it is the whole reason templates exist.
A role filled by a team takes no binding. A template role with team set
(see §8) is "anyone on that team": the document gets a seat for the team as it
is on the day, and whoever on it opens the document first signs. Naming
somebody for such a role is refused rather than ignored.
A role can be left to be named in SMP eSign. placeholder: true for a
role makes the document carry a placeholder of that role's name, holding its
fields, which somebody fills in on the prepare page with a person, a team, or
several people who become a signer group. The document cannot be sent until
they do, and POST /v1/envelopes/{id}/send says so by name. The recipient
reads back with placeholder: true and email: null until then.
Roles that form a group (a group on the role, see §8) are bound one
person each, as any role is; the group is formed from whoever you name. A
group needs two: name only one of its roles and that person holds the group's
fields alone.
Both directions of the binding are checked. A missing required role is
refused, because the document would be unsignable. An unknown role_key is also
refused rather than dropped, because dropping it would leave a signer off the
document entirely. The same is true of fields: an unknown key, or a key for a
field that is not prefillable, is refused by name. A typo that quietly does
nothing sends an agreement out with a blank fee schedule.
Refusals here carry template_binding_failed (422), and the message names the
keys the template actually has, since you cannot see the template from your log.
4.1 From an uploaded file
Content-Type: multipart/form-data
| Field | Type | Required | Notes |
|---|---|---|---|
file |
file | yes | PDF or DOCX. Sniffed by content, never by extension or by the name you give it. |
title |
string, max 200 | no | Defaults to the filename without its extension. |
external_id |
string, max 255 | no | Your correlation key. See §5. |
An uploaded document arrives as a draft with no recipients and no fields, and
a person finishes it in SMP eSign. There is no API path that places fields on an
uploaded file, and POST /v1/envelopes/{id}/send will refuse it until somebody
has. Use this shape for a document that has no template; use §4.0 for anything
you send more than once.
201 Created:
{
"envelope": {
"public_id": "ENV-4K2N7-QX8M",
"external_id": "contract-4417",
"title": "Engagement letter",
"status": "draft",
"routing_mode": "parallel",
"page_count": 3,
"state_changed_at": "2026-08-18T14:22:07+00:00",
"created_at": "2026-08-18T14:22:07+00:00",
"sent_at": null,
"completed_at": null,
"expires_at": null,
"signed_document_available": false,
"certificate_available": false,
"signed_document_sha256": null,
"created_by": "api_token",
"teams": [],
"documents": [
{
"public_id": "DOC-7HQ2M-4K9P",
"position": 1,
"title": "Engagement letter",
"original_filename": "engagement-letter.pdf",
"page_count": 3,
"template_id": null,
"signed_document_available": false,
"signed_document_sha256": null
}
],
"recipients": []
},
"request_id": "req_8XM4TR6V3K2N9"
}
documents lists the files in the envelope, in the order a signer reads them.
A document created by either shape above has exactly one. page_count on the
envelope is the total across them.
4.1a Who may send: not a question for a credential
Inside the portal a draft has a send policy: its author alone by default, or a
shared team, or named people. That rule is about colleagues and does not apply
to a credential. A token sends whatever it can see under its own scope. The
document's created_by reads api_token and the certificate's "Sent by" line
names the organization, since there is no person to name.
4.2 Nothing here sends anything
Creation always produces a draft, from either shape. Nothing reaches a signer until you call §4.3. Stated rather than left to be discovered: an integration that assumed creation sent the document would report an agreement as out for signature while it sat in a drafts list.
4.3 Send it
POST /v1/envelopes/{public_id}/send scope: write
No body. Returns the envelope with status: "sent", plus:
{ "undelivered": ["someone@example.com"] }
undelivered is not decoration. The document is genuinely out and the
signing links are live; those addresses did not receive the email. A caller that
treats a 200 as "the signer has it" would be wrong, and this is the only place
that can say otherwise. An empty array is the ordinary case.
A document that has already left draft is refused with 409 already_sent, and
the message names its current status. This is why send is a separate call and
not a flag on creation: a retry after a timeout gets the document's true state
back rather than an ambiguous answer, and it needs no idempotency key to do it.
A draft that cannot be sent yet (an uploaded file with no fields placed, a spent
allowance) is refused with 422 cannot_send and a sentence saying which.
4.4 Idempotency
Idempotency-Key is required, not optional. Derive it from your own record:
the identifier of the thing you are sending plus an attempt counter is the usual
choice.
- The same key with the same request replays the original response, including its
status code, and does no work. The replay carries
Idempotent-Replay: true. - The same key with a different request body returns 409
idempotency_key_reused. That is a client bug, not a retry, and being served the first response would answer a question you did not ask. - A request that failed leaves the key free. Only an outcome is recorded, so a 500 does not pin your key for a day.
- Records are kept 24 hours.
The fingerprint covers the file's content, not the raw body, so a genuine retry of the same upload matches even though the multipart boundary differs.
4.5 Add a file to a draft
POST /v1/envelopes/{public_id}/documents scope: write
Idempotency-Key: <your own key> required
A document can hold several files, sent in one email, signed with one set of
links, completed once and certified once. This adds one. The same two shapes
as creation, and the same rule: send template_id or a file, never both and
never neither.
From an upload (multipart/form-data): file, and an optional title
(how the file is listed for the signer and on the certificate; defaults to the
filename). It arrives with no fields placed, and a person places them in SMP
eSign.
From a template (application/json): template_id, recipients[], an
optional title, and optional fields for prefillable values, exactly as in
§4.0. The fields are placed on the new file for the people bound. Each binding
names the role and either somebody already on the document or somebody new:
| Field | Notes |
|---|---|
recipients[].role_key |
From the template. |
recipients[].recipient_id |
RCP-XXXXX-XXXX, from the envelope's recipients. The role's fields go on that person. |
recipients[].name, recipients[].email |
Instead of recipient_id. An address already on the document resolves to that person rather than adding a second one; anybody else is added with the role's type. |
That is the whole point: a custom agreement pushed as a file and the firm's standard agreement from a template, signed by one client, in one envelope. Somebody who only receives a copy cannot be bound to a role that places fields, and the refusal names them.
201 Created with document (the file added) and envelope (the whole
thing, as in §4). Refusals: 409 already_sent once the document has left
draft, 422 document_rejected for a file that cannot be used or a packet that
would exceed its ceilings (ten files, a hundred pages across them), 422
template_binding_failed for a binding the template does not match, and 422
origination_source_required for the wrong number of shapes.
4.6 Remove a file from a draft
DELETE /v1/envelopes/{public_id}/documents/{document_id} scope: write
Takes the file and everything placed on it. Draft only, and the last file cannot go: delete the draft in SMP eSign instead. Returns the envelope.
5. The correlation identifier
external_id is your key, not ours. It is why this API is worth having.
- Set at creation, and immutable afterwards. There is no endpoint that changes it.
- Returned on every read, in the single-document read and in every list.
- Queryable:
GET /v1/envelopes?external_id=... - Unique per account, enforced by a database index. A second creation with
the same value is refused with 409
external_id_takenrather than creating a duplicate. - Maximum 255 characters. No format constraint beyond that.
- Optional. Documents created in the interface carry
null, which is most of them.
Why the uniqueness matters more than it looks. With the idempotency key it gives you two independent defences against one agreement going out twice. The key catches a retry of the same request; the unique index catches two different requests that mean the same thing, which a key cannot see. Correlating on recipient name, address, or document title is not sufficient: a customer with two agreements in flight cannot be resolved by any of them.
6. Read status
6.1 One document
GET /v1/envelopes/{public_id} scope: read
Returns the same envelope object shown in §4, with recipients and
documents populated.
6.2 A list, and the changed-since sweep
GET /v1/envelopes?state_changed_after=2026-08-18T00:00:00%2B00:00&limit=100
GET /v1/envelopes?external_id=contract-4417
GET /v1/envelopes?status=completed
| Parameter | Notes |
|---|---|
external_id |
Exact match. Returns zero or one. |
state_changed_after |
RFC 3339. Strictly greater than. |
status |
One of the states in §6.3. An unknown value is refused by name. |
team_id |
GRP-XXXXX-XXXX, from GET /v1/teams. Documents shared with that team. An unknown or invisible team returns an empty list, never an error. Absent, everything the token can see is returned. |
limit |
1 to 200. Default 50. |
{
"envelopes": [ ... ],
"has_more": true,
"next_state_changed_after": "2026-08-18T14:31:55+00:00",
"request_id": "req_..."
}
Ordered oldest change first. Feed next_state_changed_after back in to continue.
When has_more is false you are current.
This is the reconciliation mechanism. Until webhooks exist it is the only way
to learn that anything happened, and once they exist it is what keeps a missed
delivery from being a lost agreement. Poll it on whatever interval suits you;
every state change moves state_changed_at.
The cursor carries microseconds (2026-11-16T15:02:11.482913+00:00),
because that is the precision of the clock it reads. Feed it back exactly as
given. A cursor cut to the second would re-admit rows changed later in that
second, which is harmless for a reconciliation but is a page that can repeat.
6.3 The states
draft, sent, in_progress, completed, declined, rejected, voided,
expired.
The status field carries the enum value, never the rendered label. The
interface says "Awaiting signature"; the API says sent. Treat the set as
extensible and tolerate an unknown value rather than crashing on it.
recipients[].status is one of pending, sent, delivered, bounced,
viewed, authenticated, completed, declined, rejected, voided.
6.4 The files, one row each
An envelope is one send; a file inside it is one agreement. An integration that records agreements ("this client has a BAA", "this client has a confidentiality agreement") records files, and a packet of three sent as one envelope is three of them. These endpoints list files flat, each with the envelope it travelled in beside it, so you can sweep and claim them one at a time exactly as you do envelopes.
GET /v1/documents?state_changed_after=...&limit=100 scope: read
GET /v1/documents?envelope_id=ENV-... scope: read
GET /v1/documents?template_id=TPL-...&status=completed scope: read
GET /v1/documents/{document_id} scope: read
GET /v1/documents/{document_id}/signed scope: read
GET /v1/documents/{document_id}/certificate scope: read
Each row is the documents[] entry from §4 plus what the file inherits from
its envelope:
{
"public_id": "DOC-7Q2M4-K9XZ",
"position": 2,
"title": "Confidentiality Agreement - Acme",
"original_filename": "confidentiality-agreement-kansas.pdf",
"page_count": 6,
"template_id": "TPL-4ZPRV-V9W2",
"signed_document_available": true,
"signed_document_sha256": "…",
"envelope_id": "ENV-SJCR5-4765",
"external_id": null,
"status": "completed",
"files_in_envelope": 3,
"state_changed_at": "2026-11-16T15:02:11+00:00",
"created_at": "…",
"sent_at": "…",
"completed_at": "…",
"certificate_available": true
}
The sweep is paged and ordered like §6.2, on the envelope's
state_changed_at: a file has no state of its own, and changes when its
envelope does. Feed next_state_changed_after back to continue. A page
never splits an envelope: a page that would end part-way through one is
extended to that envelope's last file, so it may hold up to nine rows more
than limit, and the cursor can never skip a file. No new scope: read
reads these, as it reads envelopes. A file's
signed copy is its own executed PDF; /certificate on a file returns its
envelope's certificate, which covers every file and lists each one's hash.
Which is which. A file made from a template carries that template's
identifier, which is the stable way to tell a BAA from a confidentiality
agreement. A file uploaded by hand carries only its title. external_id is the
envelope's and is shared by every file in it.
7. Download the executed document and the certificate
GET /v1/envelopes/{public_id}/signed scope: read
GET /v1/envelopes/{public_id}/documents/{document_id}/signed scope: read
GET /v1/envelopes/{public_id}/certificate scope: read
Returns the bytes, Content-Type: application/pdf, as an attachment.
/signed is the package: every file in the envelope, executed, in order, as
one PDF. For an envelope of one file it is that file, byte for byte. The second
form returns one file's own executed copy, and documents[].signed_document_sha256
on the read is its hash. An integration filing three agreements files three
agreements; one that wants the lot files the package.
A 404 with file_not_available while the document has not completed is correct
and expected. Check signed_document_available and certificate_available on
the read first if you would rather not ask.
A certificate is produced for a completion and for a decline, a rejection, and a void. Proving a refusal has real value. An expiry produces none.
signed_document_sha256 on the read is the hash of what /signed returns, so
you can prove later that what you filed is what this server produced. Each
entry in documents carries its own.
Never withheld over billing state. A suspended or past-due account can still retrieve everything it has already executed. A contract's record of authority must not become unreachable over a payment dispute, and that matters more over an API than in the interface, because nobody is watching a screen to notice it failed.
8. Templates
GET /v1/templates scope: read
GET /v1/templates/{public_id} scope: read
The list carries a summary of each template; the single read adds the roles and
fields you bind against.
{
"template": {
"public_id": "TPL-8M4TR-6V3K",
"name": "Engagement letter",
"description": "The standard one.",
"status": "active",
"version": "2026.08.18.01",
"page_count": 3,
"default_routing_mode": "parallel",
"usable": true,
"roles": [
{ "role_key": "the_client", "display_name": "The client", "role_type": "signer",
"signing_order": 1, "required": true }
],
"fields": [
{ "field_key": "the_client_signature", "type": "signature", "role_key": "the_client",
"page": 1, "label": null, "required": true, "prefillable": false, "read_only": false }
]
}
}
role_key and field_key are the contract. They are generated when the
template is first saved and do not change when a new version of the same template
is published, which is the entire point: a revision of the document should not be
a code change on your side.
usable is worth reading. An archived template stays in the list, marked
usable: false, rather than disappearing. A caller holding a stored template
identifier needs to tell "you archived this" apart from "this never existed", and
a 404 says the wrong one of those.
A role may carry team (public_id and name), meaning it is filled by
anyone on that team of the sending organization rather than by somebody you
name. Send no binding for it. On the document, the matching recipient reads
with team set and email null until a member takes the seat; afterwards
name and email are the member's and team.claimed is true.
8.1 Creating a template
Not over the API, and this is deliberate. A template is authored by placing fields on a rendered page, which is a thing a person does with a mouse. An API that could create one would be an API for posting coordinates against a document the caller has never rendered.
Somebody in SMP eSign prepares a document as usual, places the fields, and uses Save as template on it. The people on that document become the roles, and they name each one. If the template your integration needs does not exist yet, that is the answer: somebody creates it in SMP eSign, once.
8.2 Groups in a template
A role may carry group (name and mode): roles of one template sharing a
group name form a signer group of that name on the document, where any one
of them signs (one set of fields, belonging to the group) or all of them do
(each with their own). On the document, each member reads with group set
(public_id, name, mode).
7a. What am I connected to
GET /v1/me scope: read
Call this first. It is the cheapest request on the API, it proves the credential works without listing anything, and it is the only way to learn whether this token has been narrowed to part of the account.
{
"account": { "public_id": "ACC-4K2N7-QX8M", "name": "visuaFUSION Systems Solutions" },
"token": { "public_id": "AKY-W9TC5-RHQA", "label": "SMP CRM",
"scope": "write", "expires_at": null },
"team_scope": { "limited": true,
"teams": [ { "public_id": "GRP-8M4TR-6V3K", "name": "Conveyancing" } ] }
}
Show this on your own integration screen. "Connected to visuaFUSION Systems Solutions, Conveyancing only" is a sentence a customer can check. Without it, "we imported nothing" and "we are scoped to a team with nothing in it" look identical from your side, and the person you are supporting cannot tell you which it is.
Branch on team_scope.limited, not on the length of teams. An unrestricted
credential reports limited: false with an empty array. That is not "restricted
to no teams". That state does not exist, deliberately, because it would be a
credential able to read nothing.
8a. Teams
GET /v1/teams scope: read
{
"teams": [
{
"public_id": "GRP-8M4TR-6V3K",
"name": "Conveyancing",
"description": null,
"member_count": 4,
"shared_document_count": 12,
"created_at": "2026-08-01T09:14:22+00:00"
}
]
}
Every team the credential may see, ordered by name. Ordinarily that is every team in the account: a token acts for the organization rather than for a person, and it is issued by an owner who can already see every team.
Unless the account has narrowed it. An owner can limit an integration to certain teams on the Integrations page, and a narrowed credential lists only those teams. See §8a.3.
Read only. Teams are created and staffed in SMP eSign, where somebody knows which colleagues belong on which one.
8a.1 Read this before narrowing an import by team
A document does not belong to a team. It is shared with zero or more teams, and sharing is a deliberate per-document act.
The consequence is the one that will surprise you: under the default visibility
model, account_wide, nobody has to share anything for colleagues to see a
document. So a busy account can have well-populated teams and
shared_document_count: 0 on every one of them, and ?team_id= will return
nothing at all. That is not a bug and not an empty account.
shared_document_count is on every row of the team list precisely so this is one
call to discover rather than a confusing afternoon. Check it before building a
team-based import. If it is zero across the board, team filtering is not the
partition you want for that account, and the alternatives are external_id for
documents your own system created, or state_changed_after plus a filter of your
own.
8a.2 teams on the envelope object, and why it is not team_id
Every response that returns an envelope now includes:
"teams": [ { "public_id": "GRP-8M4TR-6V3K", "name": "Conveyancing" } ]
An array, and frequently empty. A singular team_id was considered and is
not shipped: it would have to pick arbitrarily when a document is shared with two
teams, and return null when it is shared with none, which reads as "no team"
rather than "teams are not how this document is scoped". Both are the kind of
field an integrator builds a screen around before discovering it was never true.
An empty array is the ordinary case. Treat it as such rather than as missing data.
Revoked shares never appear. Revocation is recorded as a timestamp rather than a deletion, so that "who could see this, and when" stays answerable, but a revoked grant is not access and is not reported as one.
8a.3 A credential can be limited to certain teams
The account owner may narrow an integration on the Integrations page: "every document in this organization", or "only documents belonging to certain teams".
This is a boundary, not a filter. It is not the same thing as the team_id
query parameter, which is your choice about what to ask for. A narrowed
credential is refused everything outside its teams whatever it asks for, on
every endpoint:
GET /v1/envelopesreturns only documents in those teams.GET /v1/envelopes/{id},/signed,/certificateandPOST .../sendreturn 404 for a document outside them. Not 403, because a 403 would confirm the document exists in a part of the account you were deliberately kept out of.GET /v1/teamslists only those teams.- A document you create lands on those teams.
GET /v1/me tells you whether this applies to you and names the teams. Read it
at startup and show it, because the failure mode without it is a customer
reporting an import that "found nothing" when it in fact found everything it was
permitted to.
Every credential issued before this existed is unlimited, and stays that way. Narrowing is something an owner does deliberately.
9. Tenancy
One token, one account. Stated as a rule because it is the control that everything else rests on:
- The account is resolved from the token, before any route runs.
- No endpoint accepts an account identifier in any position. Passing one changes nothing.
- Another account's document is absent, not forbidden. You get 404, so existence itself is not disclosed.
- Two independent mechanisms enforce this: a global query scope, and an explicit check in the controller. Either alone would be sufficient; both is the requirement.
If you are multi-tenant on your side, hold one SMP eSign token per tenant. This
was settled deliberately rather than left to be retrofitted: see
Decisions_Background.md D-176.
10. Attribution and the audit trail
A document created by a token records the token as its creator, not a person.
created_by reads api_token and the audit trail names the credential. The token
is in turn attributable to whoever issued it, which is what makes an API action
traceable to a human without pretending that human was at a keyboard.
Every action a token takes is in the account's activity log.
11. What an integrator still cannot do
Stated plainly.
- Create or edit a template. Templates are authored in SMP eSign. See §8.1.
- Place fields on an uploaded file. A document created from a file arrives empty and a person finishes it. Only a template carries a layout. Adding a templated file to a draft (§4.5) does place that file's fields. 2a. Create a team, or share a document with one. Both are done in SMP eSign. The API reads teams and filters on them; it does not manage them. 2b. Widen your own team scope. If the account has narrowed your credential, only the account owner can widen it, in SMP eSign. 2c. Reorder the files in a draft. Files are read in the order they were added; reordering is done in SMP eSign.
- Change recipients after creation. Role bindings are not editable over the API. Adding a templated file (§4.5) can add a new person for a role, which is the one way the API adds anybody after creation.
- Fill in a placeholder. A role left as
placeholder: trueis named in SMP eSign, not over the API. - Receive a webhook. No code emits one, for any event. Poll §6.2.
- Retrieve a signing link, resend an invitation, or unlock a recipient.
- Void or delete a document.
- Retrieve audit events, request a bulk export, or read account usage.
- Rely on per-endpoint rate limits. One coarse ceiling per token is what is built.
Item 5 is the significant one. Without it, learning that an agreement was signed means polling §6.2, which works and is what the changed-since sweep is for, but means a completion is noticed within minutes rather than instantly.
12. A worked sequence
What an integration does today, end to end, with no person in the middle.
0. Once, by hand: somebody in SMP eSign prepares the agreement, places the
fields, and saves it as a template.
1. GET /v1/templates
-> TPL-8M4TR-6V3K "Engagement letter", role_key "the_client"
2. POST /v1/envelopes Idempotency-Key: contract-4417-1
{ "template_id": "TPL-8M4TR-6V3K",
"external_id": "contract-4417",
"recipients": [ { "role_key": "the_client",
"name": "Jane Okafor",
"email": "jane@client.example" } ] }
-> 201, status "draft", fields already placed
3. POST /v1/envelopes/ENV-4K2N7-QX8M/send
-> 200, status "sent", "undelivered": []
4. GET /v1/envelopes?state_changed_after=<last poll>
-> "in_progress", then "completed"
5. GET /v1/envelopes/ENV-4K2N7-QX8M/signed
GET /v1/envelopes/ENV-4K2N7-QX8M/certificate
-> file them against contract-4417
Step 0 happens once per agreement type. Step 4 is a poll because no webhook exists; everything else is a single call.