Closed beta · run Worlds on your machineBrowse worlds →
Docs menu · DocuSign API

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.

bindingmeaning
WORLDS_DOCUSIGN_URLThis world's origin followed by /restapi/v2.1/accounts/{accountId}
WORLDS_API_KEYThe world key, accepted wherever DocuSign expects a credential
WORLDS_WORLD_IDThe isolated world's identity
js · docusign-esign
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
envelopeIdstringEnvelope id
statusstringcreated, sent, delivered, completed or voided
emailSubjectstringEmail subject
sentDateTimestringWhen it was sent
completedDateTimestringWhen 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
recipientIdstringRecipient id
namestringFull name
emailstringEmail address
routingOrderstringOrder of delivery
statusstringsent, 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
documentIdstringDocument id
namestringFile name
orderstringPosition in the envelope
pagesarrayPage 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
templateIdstringTemplate id
namestringTemplate name
descriptionstringWhat it is for
sharedstringWhether it is shared

Test workflow

  1. Prepare. Select the DocuSign setup for your workflow and review its starting records, including envelopes, recipients, documents.
  2. 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.
  3. Define. Describe the task, expected final changes and records that must stay untouched. Keep expected outcomes separate from the agent's instructions.
  4. 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.

yaml · worlds/tasks.yaml
# 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-recipient

See 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.

conditionwhat the agent sees
hourly-limitHOURLY_APIINVOCATION_LIMIT_EXCEEDED on the next call
invalid-stateENVELOPE_INVALID_STATUS when correcting a completed envelope
bad-recipientINVALID_EMAIL_ADDRESS_FOR_RECIPIENT on resend
token-expiredUSER_AUTHENTICATION_FAILED after the access token expires
connect-event-twiceenvelope-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.

RecordsStarting setup
envelopes30 across created, sent, delivered, completed, declined and voided
templatesMSA, Order Form, NDA
recipientsSigners and carbon copies with routing order 1 to 3
remindersEvery 2 days on 10 envelopes
expirations5 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.

FieldTypeMeaning / relationship
envelopeIdstringEnvelope id
statusstringcreated, sent, delivered, completed or voided
emailSubjectstringEmail subject
sentDateTimestringWhen it was sent
completedDateTimestringWhen all recipients finished
json · illustrative record shape
{
  "envelopeId": "<Envelope id>",
  "status": "<created, sent, delivered, completed or voided>",
  "emailSubject": "person@example.test",
  "sentDateTime": "<When it was sent>",
  "completedDateTime": "<When all recipients finished>"
}

See envelopes operations

Recipients records

Recipients

People who sign, approve or receive copies.

FieldTypeMeaning / relationship
recipientIdstringRecipient id
namestringFull name
emailstringEmail address
routingOrderstringOrder of delivery
statusstringsent, delivered or completed
json · illustrative record shape
{
  "recipientId": "<Recipient id>",
  "name": "<Full name>",
  "email": "person@example.test",
  "routingOrder": "<Order of delivery>",
  "status": "<sent, delivered or completed>"
}

See recipients operations

Documents records

Documents

Files inside an envelope.

FieldTypeMeaning / relationship
documentIdstringDocument id
namestringFile name
orderstringPosition in the envelope
pagesarrayPage list
json · illustrative record shape
{
  "documentId": "<Document id>",
  "name": "<File name>",
  "order": "<Position in the envelope>",
  "pages": []
}

See documents operations

Templates records

Templates

Reusable envelope layouts.

FieldTypeMeaning / relationship
templateIdstringTemplate id
namestringTemplate name
descriptionstringWhat it is for
sharedstringWhether it is shared
json · illustrative record shape
{
  "templateId": "<Template id>",
  "name": "<Template name>",
  "description": "<What it is for>",
  "shared": "<Whether it is shared>"
}

See templates operations

See the DocuSign world in the catalog