Worlds / Sales and crm
DocuSign API
A local DocuSign account with envelopes, recipients, routing order, templates, reminders and expirations. Test the agent that sends, corrects, resends and voids envelopes.
- Base path
/restapi/v2.1/accounts/{accountId}- Auth
- OAuth 2.0 bearer token, the world key
- Endpoints
- 13
- Status
- Active today
This reference previews the surface the DocuSign world serves in the closed beta. Paths mirror the public DocuSign API; the exact subset is confirmed when your workflow is scoped.
Connect
The run gives your agent these bindings. Keep your SDK; change only where it sends requests.
| binding | meaning |
|---|---|
WORLDS_DOCUSIGN_URL | This world's origin followed by /restapi/v2.1/accounts/{accountId} |
WORLDS_API_KEY | The world key, accepted wherever DocuSign expects a credential |
WORLDS_WORLD_ID | The isolated world's identity |
import docusign from "docusign-esign";
const client = new docusign.ApiClient();
client.setBasePath(process.env.WORLDS_DOCUSIGN_URL);
client.addDefaultHeader("Authorization", "Bearer " + process.env.WORLDS_API_KEY);
const api = new docusign.EnvelopesApi(client);
const list = await api.listStatusChanges("acct-1", { fromDate: "2025-01-01" });API reference
Envelopes
Packages of documents sent to recipients.
- GET
/restapi/v2.1/accounts/{accountId}/envelopesList envelopes - POST
/restapi/v2.1/accounts/{accountId}/envelopesCreate an envelope - GET
/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}Get an envelope - PUT
/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}Update or void an envelope
Fields · 5
envelopeId | string | Envelope id |
status | string | created, sent, delivered, completed or voided |
emailSubject | string | Email subject |
sentDateTime | string | When it was sent |
completedDateTime | string | When all recipients finished |
Recipients
People who sign, approve or receive copies.
- GET
/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/recipientsList recipients - PUT
/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/recipientsUpdate recipients - POST
/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/recipientsAdd recipients
Fields · 5
recipientId | string | Recipient id |
name | string | Full name |
email | string | Email address |
routingOrder | string | Order of delivery |
status | string | sent, delivered or completed |
Documents
Files inside an envelope.
- GET
/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documentsList documents - GET
/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}Download a document - PUT
/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}Replace a document
Fields · 4
documentId | string | Document id |
name | string | File name |
order | string | Position in the envelope |
pages | array | Page list |
Templates
Reusable envelope layouts.
- GET
/restapi/v2.1/accounts/{accountId}/templatesList templates - GET
/restapi/v2.1/accounts/{accountId}/templates/{templateId}Get a template - POST
/restapi/v2.1/accounts/{accountId}/templatesCreate a template
Fields · 4
templateId | string | Template id |
name | string | Template name |
description | string | What it is for |
shared | string | Whether it is shared |
Test workflow
- Prepare. Select the DocuSign setup for your workflow and review its starting records, including envelopes, recipients, documents.
- Connect. Configure your agent with this world's URL and key using the SDK example. Check that it reaches the intended API before running a test.
- Define. Describe the task, expected final changes and records that must stay untouched. Keep expected outcomes separate from the agent's instructions.
- Run and inspect. Use the dashboard or your workflow's generated CLI setup. Review final records and changes, then rerun from the same starting setup with the relevant failure conditions. Use Deployment and CI to automate the same workflow.
What to verify
- env 7a1 recipient email corrected and resent
- env 7a3 still delivered, not voided
- Only the duplicate Ortiz Labs MSA voided, with a reason
- Routing order unchanged on env 7a2
- Expiring envelopes extended by 7 days
Test file
A task file names the jobs, the policy your agent is given and what the grader reads back from the world's final state. The agent never sees the expected outcomes.
# worlds/tasks.yaml · DocuSign
version: 2
connector: docusign
seed: docusign-starter
mode: isolated
policy: >
Fix this week's envelopes. The Moss & Co order form went to a typo address,
correct it and resend. Void only the duplicate Ortiz Labs MSA. Extend
anything expiring this week by 7 days.
tasks:
- id: send-an-envelope-from-a-template-to-the-right-recipients
prompt: Send an envelope from a template to the right recipients
- id: correct-a-recipient-email-and-resend
prompt: Correct a recipient email and resend
- id: void-an-envelope-that-was-sent-in-error
prompt: Void an envelope that was sent in error
expected:
- env 7a1 recipient email corrected and resent
- "env 7a3 still delivered, not voided"
- "Only the duplicate Ortiz Labs MSA voided, with a reason"
- Routing order unchanged on env 7a2
- Expiring envelopes extended by 7 days
scenarios:
- hourly-limit
- invalid-state
- bad-recipientSee Tasks and outcomes for every field, and Deployment and CI to run the file on every pull request.
Failure conditions
Each one fires before the handler, at the same step on every run.
| condition | what the agent sees |
|---|---|
hourly-limit | HOURLY_APIINVOCATION_LIMIT_EXCEEDED on the next call |
invalid-state | ENVELOPE_INVALID_STATUS when correcting a completed envelope |
bad-recipient | INVALID_EMAIL_ADDRESS_FOR_RECIPIENT on resend |
token-expired | USER_AUTHENTICATION_FAILED after the access token expires |
connect-event-twice | envelope-completed is delivered two times |
Starting data
Start each run from the same records and relationships. The overview below describes the DocuSign starter; use the setup supplied for your workflow when preparing your own snapshot.
| Records | Starting setup |
|---|---|
| envelopes | 30 across created, sent, delivered, completed, declined and voided |
| templates | MSA, Order Form, NDA |
| recipients | Signers and carbon copies with routing order 1 to 3 |
| reminders | Every 2 days on 10 envelopes |
| expirations | 5 envelopes expiring this week |
The record shapes below reuse this world's API field definitions. They show illustrative values and placeholders, not an importable seed. API responses and seed input can differ; include all required records and references in the accepted import format for your workflow.
Envelopes records
Envelopes
Packages of documents sent to recipients.
| Field | Type | Meaning / relationship |
|---|---|---|
envelopeId | string | Envelope id |
status | string | created, sent, delivered, completed or voided |
emailSubject | string | Email subject |
sentDateTime | string | When it was sent |
completedDateTime | string | When all recipients finished |
{
"envelopeId": "<Envelope id>",
"status": "<created, sent, delivered, completed or voided>",
"emailSubject": "person@example.test",
"sentDateTime": "<When it was sent>",
"completedDateTime": "<When all recipients finished>"
}Recipients records
Recipients
People who sign, approve or receive copies.
| Field | Type | Meaning / relationship |
|---|---|---|
recipientId | string | Recipient id |
name | string | Full name |
email | string | Email address |
routingOrder | string | Order of delivery |
status | string | sent, delivered or completed |
{
"recipientId": "<Recipient id>",
"name": "<Full name>",
"email": "person@example.test",
"routingOrder": "<Order of delivery>",
"status": "<sent, delivered or completed>"
}Documents records
Documents
Files inside an envelope.
| Field | Type | Meaning / relationship |
|---|---|---|
documentId | string | Document id |
name | string | File name |
order | string | Position in the envelope |
pages | array | Page list |
{
"documentId": "<Document id>",
"name": "<File name>",
"order": "<Position in the envelope>",
"pages": []
}Templates records
Templates
Reusable envelope layouts.
| Field | Type | Meaning / relationship |
|---|---|---|
templateId | string | Template id |
name | string | Template name |
description | string | What it is for |
shared | string | Whether it is shared |
{
"templateId": "<Template id>",
"name": "<Template name>",
"description": "<What it is for>",
"shared": "<Whether it is shared>"
}