docustay / docustay-php
Open-source e-signature. One flat price for every user.
0.2.2
2026-10-26 18:20 UTC
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- phpunit/phpunit: ^8.0 || ^9.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
The official PHP client for the Docustay e-signature API: send a document from a template, get a webhook when each person signs, download the sealed PDF.
- API version: 2026-10-07
- Package version: 0.2.2
Install
composer require docustay/docustay-php:0.2.2
PHP 7.4 or newer, with the curl, json and mbstring extensions.
Send your first document
Put your key in DOCUSTAY_API_KEY and a template id in DOCUSTAY_TEMPLATE_ID.
require __DIR__ . '/vendor/autoload.php'; $config = Docustay\Configuration::getDefaultConfiguration()->setAccessToken(getenv('DOCUSTAY_API_KEY')); $api = new Docustay\Api\DocumentsApi(new GuzzleHttp\Client(), $config); $request = new Docustay\Model\SendRequest([ 'template_id' => getenv('DOCUSTAY_TEMPLATE_ID'), 'parties' => [new Docustay\Model\SendRequestPartiesInner([ 'seat' => 'signer_1', 'name' => 'Pat Example', 'email' => 'pat@example.com', ])], ]); $doc = $api->sendDocument(bin2hex(random_bytes(16)), $request);
More: https://docustay.app/docs
API reference
All URIs are relative to https://app.docustay.app
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AccountApi | aiUsage | GET /api/v1/ai/usage | AI drafts used against your plan |
| AccountApi | paymentsStatus | GET /api/v1/payments/status | Is Stripe ready to take a payment? |
| AccountApi | preflight | POST /api/v1/preflight | Ask what an action would do to your plan, before doing it |
| AccountApi | usage | GET /api/v1/usage | Documents, templates and emails used against your plan |
| DocumentsApi | auditLogCsv | GET /api/v1/documents/{id}/audit-log.csv | The document's audit log as CSV |
| DocumentsApi | cancelAiJob | POST /api/v1/documents/ai/jobs/{id}/cancel | Cancel an AI job |
| DocumentsApi | checkDocument | POST /api/v1/documents/check | Check a document's words before making it |
| DocumentsApi | createDocument | POST /api/v1/documents | Make a document from words and people |
| DocumentsApi | deleteDraft | DELETE /api/v1/documents/{id} | Delete a draft that was never sent |
| DocumentsApi | detectFields | POST /api/v1/documents/detect-fields | Find the fields on a PDF |
| DocumentsApi | downloadSignedPdf | GET /api/v1/documents/{id}/signed.pdf | Download the signed copy |
| DocumentsApi | draftWithAi | POST /api/v1/documents/ai/draft | Ask for an AI-written draft |
| DocumentsApi | editWithAi | POST /api/v1/documents/ai/edit | Ask the assistant to change a document |
| DocumentsApi | embedSession | POST /api/v1/documents/{id}/embed-session | Start an embedded signing session for a seat |
| DocumentsApi | getAiDraft | GET /api/v1/documents/ai/jobs/{id} | Read an AI draft job |
| DocumentsApi | getDocument | GET /api/v1/documents/{id} | One document and where each person is |
| DocumentsApi | getDraftSource | GET /api/v1/documents/{id}/source | The words, people and choices of a draft |
| DocumentsApi | getWizard | GET /api/v1/ai/wizard | The wizard's questions |
| DocumentsApi | listDocuments | GET /api/v1/documents | List documents |
| DocumentsApi | listTemplates | GET /api/v1/documents/templates | Templates you can send |
| DocumentsApi | remind | POST /api/v1/documents/{id}/remind | Remind the people who still have to sign |
| DocumentsApi | reviseDocument | POST /api/v1/documents/{id}/revise | Change the words of a draft |
| DocumentsApi | search | GET /api/v1/search | Search documents, templates and people |
| DocumentsApi | sendDocument | POST /api/v1/documents/send | Send a template to people to sign |
| DocumentsApi | sendDraft | POST /api/v1/documents/{id}/send | Send a draft |
| DocumentsApi | testSign | POST /api/v1/documents/{id}/test-sign | Sign a test document (test mode only) |
| DocumentsApi | voidDocument | POST /api/v1/documents/{id}/void | Void a document that is still out for signature |
| EmailApi | listEmails | GET /api/v1/emails | The log of email about your documents |
| EmbeddingApi | builderSession | POST /api/v1/embedded/builder-session | Start an embedded template builder session |
| EmbeddingApi | scribeSession | POST /api/v1/embedded/scribe-session | Start an embedded Scribe session |
| PaymentsApi | listPayments | GET /api/v1/payments | List payments taken through documents |
| PaymentsApi | refundPayment | POST /api/v1/payments/{id}/refund | Refund a payment, in full or in part |
| PlaysApi | answerDraft | POST /api/v1/drafts/{draftRef}/answers | Answer a template's questions |
| PlaysApi | archivePlay | DELETE /api/v1/plays/{name} | Archive a play |
| PlaysApi | duplicatePlay | POST /api/v1/plays/{name}/duplicate | Copy a play under a new name |
| PlaysApi | getPlay | GET /api/v1/plays/{name} | One play |
| PlaysApi | listPlaybooks | GET /api/v1/playbooks | List playbooks (packs) |
| PlaysApi | listPlays | GET /api/v1/plays | List plays |
| PlaysApi | publishPlay | POST /api/v1/plays/{name}/publish | Publish a play version |
| PlaysApi | savePlay | POST /api/v1/plays | Save a play (a new version) |
| PlaysApi | savePlaybook | POST /api/v1/playbooks | Save a playbook (pack) |
| PlaysApi | setPlaybookOn | POST /api/v1/playbooks/{name}/enable | Switch a pack on or off |
| PlaysApi | startDraft | POST /api/v1/drafts | Start a draft from a template |
| PlaysApi | testPlay | POST /api/v1/plays/test | Check a play without saving it |
| TeamsApi | listTeams | GET /api/v1/teams | Teams and their members |
| TemplatesApi | createTemplateFromFile | POST /api/v1/templates/file | Make a template from a file with text tags |
| TemplatesApi | createTemplateFromHtml | POST /api/v1/templates/html | Make a template from HTML with text tags |
| TemplatesApi | createTemplateFromSource | POST /api/v1/templates/source | Make a template from a document source |
| TemplatesApi | customizeLibraryTemplate | POST /api/v1/templates/library/{slug}/customize | Customize a built-in template |
| TemplatesApi | draftFromLibraryTemplate | POST /api/v1/templates/library/{slug}/documents | Make a draft from a built-in template |
| TemplatesApi | getLibraryTemplate | GET /api/v1/templates/library/{slug} | One built-in template |
| TemplatesApi | getTemplate | GET /api/v1/templates/{id} | One template and its seats |
| TemplatesApi | listLibraryTemplates | GET /api/v1/templates/library | List the built-in templates |
| TemplatesApi | setTemplateDefaults | POST /api/v1/templates/{id}/defaults | Set what a document made from a template starts with |
| TemplatesApi | useTemplate | POST /api/v1/templates/{id}/documents | Use a written template for people |
| WebhooksApi | createWebhook | POST /api/v1/webhooks | Add a webhook |
| WebhooksApi | deleteWebhook | DELETE /api/v1/webhooks/{id} | Remove a webhook |
| WebhooksApi | fetchRelayEvents | GET /api/v1/webhooks/{id}/relay | Fetch stored deliveries of a relay webhook |
| WebhooksApi | getWebhook | GET /api/v1/webhooks/{id} | Get a webhook |
| WebhooksApi | listWebhookDeliveries | GET /api/v1/webhooks/{id}/deliveries | Recent deliveries |
| WebhooksApi | listWebhookTopics | GET /api/v1/webhooks/topics | The events a webhook can subscribe to |
| WebhooksApi | listWebhooks | GET /api/v1/webhooks | List webhooks |
| WebhooksApi | rotateWebhookSecret | POST /api/v1/webhooks/{id}/rotate | Rotate the signing secret |
| WebhooksApi | testWebhook | POST /api/v1/webhooks/{id}/test | Send a test event |
Models
- AiDraftJob
- AiUsage
- AiUsageByFeatureValue
- AnswerDraftRequest
- BuilderSession
- BuilderSessionRequest
- CheckDocument200Response
- CheckDocumentRequest
- CreateDocumentRequest
- CreateTemplateFromSource201Response
- CreateTemplateFromSourceRequest
- CreateWebhook201Response
- CreateWebhookRequest
- CustomizeLibraryTemplateRequest
- DeleteDraft200Response
- DeleteWebhook200Response
- DetectFieldsRequest
- DetectFieldsResult
- DetectFieldsResultDocumentsInner
- DetectFieldsResultPagesInner
- DetectFieldsResultSummary
- DetectedField
- Document
- DocumentEventsInner
- DocumentMade
- DocumentSummary
- DraftFromLibraryTemplateRequest
- DraftWithAi202Response
- DraftWithAiRequest
- DuplicatePlayRequest
- EditWithAiRequest
- EditWithAiRequestVariablesInner
- EmailChoice
- EmbedSession200Response
- EmbedSessionRequest
- Error
- ErrorError
- FetchRelayEvents200Response
- FetchRelayEvents200ResponseEventsInner
- FileTemplateRequest
- GetDraftSource200Response
- HtmlTemplateRequest
- ListDocuments200Response
- ListDocuments200ResponsePage
- ListEmails200Response
- ListLibraryTemplates400Response
- ListLibraryTemplates400ResponseError
- ListTeams200Response
- ListTeams200ResponseTeamsInner
- ListTeams200ResponseTeamsInnerMembersInner
- ListTemplates200Response
- ListWebhookDeliveries200Response
- ListWebhookDeliveries200ResponseDeliveriesInner
- ListWebhookTopics200Response
- ListWebhooks200Response
- Party
- Payment
- PaymentFee
- PaymentsStatus200Response
- Person
- PreflightAnswer
- PreflightAnswerCost
- PreflightAnswerPeriod
- PreflightAnswerPlan
- PreflightOption
- PreflightRequest
- PublishPlayRequest
- RefundPaymentRequest
- Remind200Response
- RemindRequest
- ReviseDocument201Response
- ReviseDocumentRequest
- RotateWebhookSecret200Response
- RotateWebhookSecretRequest
- SavePlayRequest
- SavePlaybookRequest
- ScribeSessionRequest
- SendChoices
- SendDocument201Response
- SendDocument201ResponseNotEmailedInner
- SendDraft201Response
- SendDraft202Response
- SendDraft202ResponseApproval
- SendDraftRequest
- SendRequest
- SendRequestPartiesInner
- SetPlaybookOnRequest
- SetTemplateDefaults200Response
- SetTemplateDefaultsRequest
- StartDraftRequest
- StartDraftRequestAnswersValue
- StartDraftRequestPeopleInner
- Template
- TemplateMade
- TemplateMadeDetected
- TemplateMadeWarningsInner
- TemplateSeatsInner
- TestSign200Response
- TestSign200ResponseProgress
- TestSignRequest
- TestWebhook200Response
- TestWebhookRequest
- Usage
- UsageBilling
- UsageDocuments
- UsageDrafts
- UsageEmails
- UsageLimits
- UsagePeriod
- UsageSigners
- UsageTemplates
- UseTemplateRequest
- VoidDocument200Response
- VoidDocumentRequest
- WebhookDocumentsDocumentCreatedRequest
- WebhookDocumentsDocumentSentRequest
- WebhookEndpoint
- WizardBrief
- WizardBriefPayment
Authorization
Send your API key as a bearer token: Authorization: Bearer $DOCUSTAY_API_KEY. A test key (it starts with ds_test_) only ever emails you.
Licence
MIT. See the LICENSE file. The Docustay server is AGPL-3.0; this client is MIT so you can ship it in any project.