Skip to content
Start free

REST API

Open in ClaudeOpen in ChatGPT

Changes to the REST API’s responses, states and limits. Changes to the API clients are listed in each client’s own changelog.

Signature requests for every template type

Section titled “Signature requests for every template type”
  • HTML templates, Word templates and page designs can have signature requests. See how they work.
  • Creating or updating a template takes sync_fields, which is on by default: an HTML template’s code, a Word template’s document and a page design’s layout add a field for each value they read for the first time. Send sync_fields: false to manage the fields yourself. An HTML template’s submissions now check their data against the fields that this adds, so a value the code reads is required unless you make its field optional.
  • Templates have signer_roles, the people who sign their submissions, and a field’s signer_role says which of them fills it in or signs it, or sender for a field that data fills in. Creating or updating a template takes signer_roles, and adding or updating fields takes signer_role. See Signer roles.
  • A signature request’s fields is optional. A signature request with a role gets the fields the template gives that role, and a submission’s only signature request can leave out both: it gets every field without a role that data doesn’t fill in.
  • Templates have signature_request_cc, which creating or updating a template takes too: who gets a copy of the completed document when DocSpring emails a submission’s signers, with the submission’s cc.
  • A Number field printed in comb fields (one character per box) is never cut off. When the number has a digit that no box prints, because it has more digits than the fields have boxes or because the fields’ offsets leave a gap where a digit falls, API v2 returns invalid_data when you create the submission, with an error that names the field, and an API v1 submission ends in the error state when its PDF is generated. Before, the PDF printed the digits that fit and left out the rest. For a signature request created through API v1, the submission fails once every signer has finished, so check the numbers you send against the template’s boxes. See SSN and comb fields.
  • A Number field split across comb fields with offsets prints each field’s own digits. Before, every field printed the number from its first digit.
  • A template’s JSON schema lists the labels of a field’s options as x-option-labels, for options that have labels or that are all lowercase words joined by underscores (head_of_household shows as Head of household). enum is unchanged, and so is the data a submission takes. A field or group without a title is titled from its name with a letter at the end capitalized (list_a is “List A”, where it was “List a”).
  • Accounts on a plan purchased before prepaid credits now have one API rate limit for their live API tokens and one for their test API tokens, each counted across all those tokens and IP addresses. The limit itself hasn’t changed, but it used to be counted separately for each IP address. Requests over it get 429 Too Many Requests. See Credits & Rate Limits.

Template settings when creating a template with API v1

Section titled “Template settings when creating a template with API v1”
  • Creating a template with API v1 now keeps a setting the request sends even when its value equals the setting’s built-in default, such as public_submissions: false or expire_after: 7. Your account’s Template defaults page used to replace it. API v2 already worked this way. Settings the request leaves out still get your account’s template defaults.

Signatures come only from signature requests

Section titled “Signatures come only from signature requests”
  • A value for a signature or initials field, in data or in a field override’s default, makes a submission invalid_data in both API versions, with or without signature requests, in test mode too. Before, only submissions with signature requests were checked. To print a signature image or a name you send, use an Image or Text field. See Create signature requests. DocSpring Enterprise installs keep accepting them.
  • Web forms (Web Forms JS 3.0.0 and the hosted web form) and visual forms (Visual Forms JS 2.22.0 and the hosted visual form) no longer create their submissions through the API. Earlier versions of the embeds still do.
  • Accounts have their own expiry settings, on the Account page’s Data retention tab: one for submissions without signature requests, one for signed documents (submissions with signature requests) and one for combined PDFs. The first two cover the submissions of templates that don’t set their own expiry, and the third covers combined PDFs created without expires_in. New accounts delete submissions after 30 days and combined PDFs after 1 day, and keep signed documents until they’re deleted. Existing accounts have all three off, so their live submissions stay until they turn one on. Test submissions are deleted after 30 days on every account of the hosted service. An account whose template defaults expired new templates’ submissions has that length in the first two instead, so its new templates expire as they did.
  • submission.expired and combined_submission.expired webhooks now arrive for records with a stored file. They weren’t being sent. A changed expiry setting that deletes older records sends one for each.
  • An OAuth app needs the delete scope to shorten a template’s expiry through API v2, since that deletes stored submissions. API tokens are unaffected.
  • A signing page opened with a signature request ID that doesn’t exist answers 410 submission_expired, where it answered 404 not_found.
  • Templates have a new setting, override_account_expiry, in both API versions’ template responses and create and update requests. When it’s true, the template’s expire_submissions, expire_after and expiration_interval decide when all its submissions expire, with or without signature requests, including never. When it’s false, the account’s settings do. Existing templates have it on where expire_submissions is on, and in the accounts whose template defaults expired new templates’ submissions. Turning expire_submissions on also turns it on, unless the same request sets it, so integrations that only set expire_submissions keep working. So does creating a template through either API version with expire_submissions set, on or off: false keeps its submissions until you delete them, as it did before.
  • An account deleted with Delete Account refuses every API request, reads included, with a 403 and "code": "account_suspended" until one of its users signs in to cancel the deletion.
  • A combined PDF created without expires_in follows the account’s setting. Before, it was kept until you deleted it. A request’s expires_in still overrides the template’s and the account’s settings. An expires_in of 0 or less counts as not sent, so the account’s setting decides.
  • Changing an expiry setting now applies to the submissions and combined PDFs already stored. Turning it on or shortening it deletes the ones already older than the new setting, starting 24 hours after we email the account’s owner and whoever made the change. Turning it off or lengthening it moves their expires_at later, or clears it, at once. Before, a change applied only to new ones.
  • A processed submission’s expires_at counts from its processed_at. Before, it counted from a save a few seconds later.
  • When a submission with signature requests expires, its signature requests, their events and its audit trail are deleted along with its data and PDFs, and the API no longer lists the signature requests. We keep a record of the signing’s hashes, described in Signing evidence and retention.
  • API v2 and webhook version 4 list a signed submission’s hash manifest as files.signing_manifest. It’s the audit data that the signing’s record holds hashes of, so keep it with the signed PDF.
  • A signing link for a signature request that no longer exists answers 410 with submission_expired, as a link to an expired submission does. Before, an unknown signature request ID answered 404 with not_found.
  • DocSpring emails the signers of an API v2 signature request a link to sign, and the signed PDF once everyone has signed. Set send_email to false, for the submission or for one signature request, when your app sends the links or embeds the signing form. API v1 never emails signers. See Emails from DocSpring.
  • New parameters for creating a submission: send_email, signing_order, email_subject, email_message, cc, reply_to, notification_emails, notify_when_signed and reminders, and each signature request’s send_email and signing_step. A signature request that DocSpring emails needs an email, and its auth_type is email_link by default.
  • Signature requests have send_email, signing_step, sent_at and email_status, and submissions have signing_order.
  • With signing_order: sequential, a signer can’t sign until everyone in the steps before theirs has: the signing page says so, and Signature Requests JS’s onError gets not_your_turn.
  • New webhook events: signature_request.sent and signature_request.email_bounced (submission_data_request.sent and submission_data_request.email_bounced in version 3). New webhooks get them by default.
  • Creating a submission that DocSpring emails can return 402 with "code": "insufficient_credits_to_send", 429 with "code": "daily_email_limit_reached" when it would go over your account’s daily email limit, and 403 while your account’s emails are paused. Nothing is saved.
  • Templates have settings for these emails: signature_request_from_name, signature_request_from_address, signature_request_signing_url, signature_request_include_signing_token, signature_request_reply_to, signature_request_notification_emails and signature_request_email_attachments.
  • API v2 is the current version of the API, and the 4.x API clients call it. API v1 and the 3.x clients keep working.
  • API v2 calls data requests signature requests. New data requests get IDs that start with srq_ instead of drq_, in both API versions. Existing ones keep their IDs.
  • Signing links expire, in both API versions. A signature request token’s link (api, the default) opens the signing form for 24 hours, and an email token’s for 7 days. A signing page that opened in time keeps working for 7 more days, so the signer can finish later. Before, links never expired, whatever API v1’s expires_at said. Tokens created before this change get the same lifetimes, counted from when they were created: an older link no longer opens the form, but a page the signer opened in the last 7 days still works.
  • Live signature requests (data requests in API v1) work on every plan, including the free Developer plan, once your account has made a payment: a credit pack or a paid plan. Before that, creating one returns 403 Forbidden with "code": "upgrade_required". Test signature requests are free on every plan.
  • A webhook with Include submission data turned off no longer sends any form values: each data request’s (signature request’s) data, ip_address and user_agent, and the submission’s truncated_text, are null.
  • The events of a test submission created with a live API token go to “Test only” webhooks, not “Live only” ones.
  • API v1 changes for signature requests (data requests):
    • A signature or initials value in the data of a submission with data requests makes it an invalid_data submission: only the signer signs. A signed PDF is always static, whatever editable says.
    • On a public template, only the template’s own account can send data_requests, html, css, password, expires_in or editable: other callers get a 422. Their field_overrides only keep hidden, backgroundColor and required.
    • The data request events API only takes send_request events, and a completed, declined or expired data request takes no more updates, tokens or events (422).
    • A test API token gets a 403 when it creates a token or an event for a live data request, or updates one.
    • A submission with data requests can’t be reprocessed, and a published template version’s PDF can’t be replaced.
  • Other API v1 fixes:
    • POST /templates with html and no template_type creates an HTML template.
    • POST /custom_files without a cache_id, and downloading a combined submission that has no PDF, are 422s.
    • EAN-13, EAN-8 and UPC-A barcode fields take the code with its check digit, and a wrong check digit is a data error when you create the submission.

These changes apply to accounts on the current plans (Developer, Starter, Growth and Scale), except the account_suspended change, which applies to every account. Accounts on a plan purchased before prepaid credits keep their existing pricing and API rate limits.

  • Submissions and combined submissions have a new state, insufficient_credits: a live PDF your credit balance can’t cover is saved and resumes automatically when you add credits. Work that is still waiting after 30 days, or that you discard, moves to error, and DocSpring sends the submission.failed or combined_submission.failed webhook. No webhook is sent when work starts waiting.
  • Creating a submission, batch or combined submission that your balance can’t cover returns 402 Payment Required with "code": "insufficient_credits" and the saved submission in the body. Synchronous requests return 402 too.
  • Requests that need a higher plan (adding templates over your plan’s limit, live data requests, the embedded template editor) return 403 Forbidden with "code": "upgrade_required". Nothing is saved.
  • On the Developer plan, creating or turning on a webhook when the account already has 2 active integrations (storage destinations, webhooks and Slack notifications) returns 403 Forbidden with "code": "upgrade_required". Editing, turning off and deleting webhooks keep working. Setting a template’s slack_webhook_url (or, in API v1, webhook_url) to a new URL over the limit returns 422 with the same message.
  • Creating submissions, batches or combined PDFs on a suspended account returns 403 Forbidden with "code": "account_suspended". Nothing is saved.
  • Submissions and combined submissions that were already saved when an account was suspended wait in the account_suspended state instead of moving to error, and are generated when the account is reactivated. As with insufficient_credits, work still waiting after 30 days, or that you discard, moves to error.
  • API requests are limited per account by plan, with separate limits for live and test API tokens. Responses include RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset, and requests over the limit get 429 Too Many Requests with Retry-After.
  • If you use a DocSpring API client, upgrade it to the latest version. Older versions of the Ruby, Python, PHP, Java and C# clients raise an error when they read the insufficient_credits state.

These expiry changes apply to every account:

  • Expiring a submission also clears its metadata, schema errors, overflow text, PDF password, error message, rendered HTML, and the submitter’s IP address, browser and location. An expired submission returns metadata and truncated_text as {}, json_schema_errors as [], and password and error_message as null. A request that was waiting for credits keeps its “Not processed” error message. The submission.expired webhook has the cleared values too, so match it to your records by its id.
  • Expiring a combined submission also clears its metadata, password and error message, and removes the URLs from source_pdfs.
  • The actions of an expired submission or combined submission keep their state, with result_data as {} and error_message as null.
  • A submission that doesn’t process (any state other than processed, such as error or invalid_data) is kept for at least 48 hours before it expires, even when expires_in or the template’s expiry is shorter, so you can debug it and a retry still has its data. Its expires_at shows when. A processed submission keeps your expiry setting, and a failed submission that is later processed expires that long after processing.
  • Submissions saved with invalid data now expire like any other. Before, they were never deleted.
  • A combined submission with expires_in that fails now expires too, after at least 48 hours. Before, failed combined submissions were never deleted.

This processing change applies to every account:

  • A submission or combined submission that hits an unexpected error on our side is retried for about a minute while it stays pending, then moves to error and stays there, with a message saying what happened. Before, it moved to error and could still be retried and reach processed hours or days later.