Docspring.Api.Client (docspring v4.2.0)

API calls for all endpoints tagged Client.

Summary

Functions

Add fields to a template Adds fields to a template's draft and returns all of its fields. Publish a version for submissions of published versions to have them.

Copy a template Copies a template (its draft, or a published version) into a new template.

Combine PDFs Merges PDFs into one: submissions, other combined PDFs, templates, custom files (POST /custom_files) and PDFs from URLs, in the order of source_pdfs. The PDF is generated in the background: on sync.api hosts the request waits for it (unless you pass wait=false), otherwise poll GET /combined_pdfs/{combined_pdf_id} until state isn't pending. A template source merges the template's processed PDF by default: the PDF submissions are filled in on, decrypted and with its form fields removed. Pass processed: false to merge the PDF as it was uploaded.

Create a custom file from an upload Creates a custom file from a PDF you uploaded, so you can merge it with other PDFs. Upload the file with the presigned upload (GET /uploads/presign) first, then pass its fields.key as cache_id.

Create a folder Creates a folder for organizing templates. Pass parent_folder_id to create it inside another folder. Folder names are unique within their parent folder.

Record a signature request event Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (send_request). The audit trail shows it as reported by your account. A finished (completed, declined or expired) signature request's audit trail takes no more events, and a test API token can't record one for a live signature request.

Create a signature request token Creates a token that opens the signature request without signing in, in a form embedded in your app or from a link you send. The response is the only time the token's secret is returned. The link works for 24 hours, or 7 days for an email token, and a signing page that opened in time keeps working for 7 more days. A test API token can't create a token for a live signature request.

Generate a PDF Creates a submission: fills in a template with your data and generates a PDF. The PDF is generated in the background: on sync.api hosts the request waits for it (unless you pass wait=false), otherwise poll GET /submissions/{submission_id} until state isn't pending. Data that doesn't match the template's fields returns a 422 with an invalid_data error. The submission is still saved, with its errors, so you can find it in DocSpring: the error's submission_id is its ID.

Generate PDFs in a batch Creates up to 50 submissions in one request, from one template or several. The PDFs are only generated when every submission is valid. On sync.api hosts the request waits until every PDF has been generated (unless you pass wait=false), otherwise poll GET /submissions/batches/{submission_batch_id} until processed_at is set. When any submission is invalid, nothing is generated and the request returns a 422. Submissions whose data doesn't match their template's fields are still saved with their errors (an invalid_data error, with each one's submission_id in its details), so you can find them in DocSpring. The other submissions aren't saved.

Create a template Creates an HTML template, or a PDF template from a PDF you uploaded with the presigned upload (GET /uploads/presign): pass its fields.key as cache_id. To send the PDF with the request instead, use POST /templates/upload. A PDF template is ready to generate PDFs once DocSpring has processed its PDF (ready is true). On sync.api hosts the request waits for that unless you pass wait=false.

Preview a template with data Makes PNG images of a template's pages filled in with the data you send (not a PDF), so you can check how an HTML or PDF template prints with your data before you publish a version or send live data. It renders the template's draft, or the published version you ask for. A preview makes no submission and uses no credits, and its pages are watermarked like a test submission's PDF. It's pending while it renders: get it with GET /templates/{template_id}/previews/{preview_id} until it's processed, with an image of each page, or error.

Create a webhook Creates a webhook that sends a POST request to your endpoint whenever a subscribed event happens. Scope it to API tokens, templates or folders to receive only their events.

Delete a custom file Deletes a custom file and returns it. Use a live API token: test tokens can't delete custom files.

Delete a folder Deletes an empty folder and returns it. A folder that still has templates or folders in it can't be deleted.

Delete a template Deletes a template's draft and all of its published versions, or one published version (version). Returns the template as it was before it was deleted.

Delete a webhook Deletes a webhook so it stops receiving events, and returns it.

Expire a combined PDF Deletes a combined PDF's PDF and returns the expired combined PDF.

Expire a submission Deletes a submission's data and PDF now, and returns the expired submission.

Generate more files Adds formats to a processed submission's files, in the background: png, a PNG image of each page of the PDF (up to 100 pages). To make them with the submission, add them to output_formats when you create it. Each new file is listed in files while it's made: on sync.api hosts the request waits for them (unless you pass wait=false), otherwise poll GET /submissions/{submission_id} until none of their state is pending. A file that couldn't be made has the state error and an error_message, and the submission stays processed. Asking for a format the submission already has (or is making) changes nothing.

Generate a preview PDF Generates a preview of a submission's PDF in the background, such as for a submission still waiting for its signature requests. It's in files.preview once preview_generated_at changes.

Get a combined PDF Returns a combined PDF, with a temporary link to download it once it has been generated.

Get a custom file Returns a custom file, with a temporary URL to download it.

Get a folder Returns a folder.

Get a presigned URL to upload a file Returns a presigned S3 form for uploading a file directly to DocSpring, for files too large to send in a request body. POST the fields and the file (as file) to url as multipart/form-data, then pass fields.key as the cache_id when you create a custom file.

Get a signature request Returns a signature request, with the values the person has entered so far.

Get a submission Returns a submission, with its data and links to download its PDF.

Get a batch Returns a batch with its submissions. The batch has finished once processed_at is set: its state is processed when every PDF was generated, or error when any submission failed.

Get a template Returns a template: its draft, or one of its published versions.

Compare a version of a template with the one before it Returns what changed in the template's draft since its latest published version (or in a published version since the one before it): fields added, removed, changed and moved, the settings that changed, and whether the document was replaced. Check it before you publish a version.

Generate typed code for a template's submission data Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir or Go, so your app catches mistakes before it calls the API. root_type_name is the type of the whole data object, and just_types=true leaves out the code that converts JSON to and from the types. Java returns every class in code, each under a // ClassName.java comment. A template with no named fields returns 422.

Get images of a template's pages Returns a JPEG image of each page of a PDF template's PDF, with temporary links to download them: the draft's PDF, or a published version's. Use them to see the pages that fields are placed on.

Get a template preview Returns a preview made with POST /templates/{template_id}/previews. Once it's processed, pages has a PNG image of each page with a temporary link to download it: a preview has no PDF. Previews are deleted an hour after they're created.

Get the JSON Schema of a template's submission data Returns the JSON Schema that a submission's data must match. Use it to check data before you create submissions, or to build a form for the template's fields.

Get a webhook Returns a webhook.

List combined PDFs Returns the combined PDFs in your account, newest first, one page at a time.

List custom files Returns the custom files in your account, newest first, one page at a time.

List folders Returns the folders in your account, newest first, one page at a time. Pass parent_folder_id to list the folders in one folder.

List submissions Returns the submissions in your account, newest first, one page at a time. Each one is a summary: its data is null unless you pass include_data=true, and its files are empty unless you pass include_files=true. Get a submission by its ID for its signature requests, uploads and page images.

List a template's fields Returns a template's fields with all of their settings, page by page: the draft's fields, or a published version's. A PDF template's fields are placed on its pages: GET /templates/{template_id}/page_images has images of the pages.

List a template's submissions Returns a template's submissions (from every version of the template), newest first.

List templates Returns the templates in your account (their drafts), newest first, one page at a time. Each one is a summary: get a template by its ID for its settings, its PDF in full, its HTML, defaults and published versions.

List webhooks Returns the webhooks in your account, newest first, one page at a time. Filter them by event type, mode, or the API token, template or folder they're scoped to.

Move a folder Moves a folder into another folder, or to the root with parent_folder_id: null. Its templates and folders move with it. A folder can't move into itself or one of its own folders.

Move a template to a folder Moves a template and all of its published versions to a folder, or to the root (null).

Publish a template version Publishes the template's draft as a new version that doesn't change. version_type says which part of the latest version number goes up. While the template's PDF is downloading or being processed, or DocSpring is setting up its fields, it returns a 409 that says so.

Remove fields from a template Removes fields from a template's draft and returns the fields that are left. Conditional logic that used only the removed fields is removed too.

Rename a folder Renames a folder. The name must be unique within its parent folder.

Reorder a template's fields Changes the order of the fields in a template's draft and returns them in their new order. Send every field's ID: each field stays on its page, and a page's fields are printed in this order, so a later field prints over an earlier one where they overlap. Their values are in this order in the template's data schema and forms.

Restore a template version Replaces the template's draft with a copy of one of its published versions.

Test authentication Checks whether your API token is valid by making an authenticated request. This endpoint is useful for verifying credentials during setup or troubleshooting issues.

Update a signature request Changes a pending signature request's metadata, or how your app authenticated the person (for the audit trail). Once the person has opened it, only its metadata can be changed, and a completed or declined signature request can't be changed.

Update a template Changes a template's draft. Properties left out keep their values. defaults and html_engine_options replace the whole object, and field_groups changes only the groups it lists. Setting parent_folder_id moves the template and all of its published versions.

Replace a template's PDF Replaces a PDF template's PDF with one you uploaded with the presigned upload (GET /uploads/presign) (cache_id), a link to download it from (document_url), or the file in base64 (document_base64). The fields stay where they are, unless reimport_fields replaces them with the new PDF's fillable fields. To send the PDF as multipart/form-data instead, use PUT /templates/{template_id}/document/upload.

Update a template's fields Changes fields of a template's draft and returns all of its fields. Settings left out keep their values. A shared setting (type, required, default, ...) changes for every field with the same name.

Update a webhook Updates a webhook. Only the properties you send change.

Create a PDF template from an uploaded PDF Creates a PDF template from a PDF sent with the request (multipart/form-data). For large files, upload the PDF with the presigned upload (GET /uploads/presign) and create the template with POST /templates.

Replace a template's PDF with an uploaded PDF Replaces a PDF template's PDF with one sent with the request (multipart/form-data). The fields stay where they are, unless reimport_fields replaces them with the new PDF's fillable fields.

Check a submission without creating it Checks a submission as creating it would (its data against the template's fields, its settings and signature requests) without saving it, generating anything or using credits. It doesn't check your account's credits. The response says whether the submission is valid, and if not, has the error that creating it would return.

Functions

add_template_fields(connection, template_id, body, opts \\ [])

Add fields to a template Adds fields to a template's draft and returns all of its fields. Publish a version for submissions of published versions to have them.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • body (AddTemplateFieldsRequest): The fields to add to the template's draft.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.TemplateFields.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

copy_template(connection, template_id, opts \\ [])

@spec copy_template(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.Template.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Copy a template Copies a template (its draft, or a published version) into a new template.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • opts (keyword): Optional parameters
    • :body (CopyTemplateRequest): Settings for the copy.

Returns

  • {:ok, Docspring.Model.Template.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

create_combined_pdf(connection, body, opts \\ [])

Combine PDFs Merges PDFs into one: submissions, other combined PDFs, templates, custom files (POST /custom_files) and PDFs from URLs, in the order of source_pdfs. The PDF is generated in the background: on sync.api hosts the request waits for it (unless you pass wait=false), otherwise poll GET /combined_pdfs/{combined_pdf_id} until state isn't pending. A template source merges the template's processed PDF by default: the PDF submissions are filled in on, decrypted and with its form fields removed. Pass processed: false to merge the PDF as it was uploaded.

Parameters

  • connection (Docspring.Connection): Connection to server
  • body (CreateCombinedPdfRequest): The PDFs to merge, and the combined PDF's settings.
  • opts (keyword): Optional parameters
    • :wait (boolean()): Wait until the PDF has been generated before responding. Default true on sync.api hosts.
    • :"Idempotency-Key" (String.t): A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an Idempotent-Replayed: true header) instead of creating another combined PDF. Send a new key with each new combined PDF, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 idempotency_key_reused. A 409 idempotency_key_in_use means the first request is still being processed: send the request again in a few seconds.

Returns

  • {:ok, Docspring.Model.CombinedPdf.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

create_custom_file_from_upload(connection, body, opts \\ [])

Create a custom file from an upload Creates a custom file from a PDF you uploaded, so you can merge it with other PDFs. Upload the file with the presigned upload (GET /uploads/presign) first, then pass its fields.key as cache_id.

Parameters

  • connection (Docspring.Connection): Connection to server
  • body (CreateCustomFileFromUploadRequest): The uploaded file to create the custom file from.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.CustomFile.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

create_folder(connection, body, opts \\ [])

Create a folder Creates a folder for organizing templates. Pass parent_folder_id to create it inside another folder. Folder names are unique within their parent folder.

Parameters

  • connection (Docspring.Connection): Connection to server
  • body (CreateFolderRequest): The folder to create.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Folder.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

create_signature_request_event(connection, signature_request_id, body, opts \\ [])

Record a signature request event Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (send_request). The audit trail shows it as reported by your account. A finished (completed, declined or expired) signature request's audit trail takes no more events, and a test API token can't record one for a live signature request.

Parameters

  • connection (Docspring.Connection): Connection to server
  • signature_request_id (String.t): The signature request's ID.
  • body (CreateSignatureRequestEventRequest): The event to record.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.SignatureRequestEvent.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

create_signature_request_token(connection, signature_request_id, opts \\ [])

@spec create_signature_request_token(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.SignatureRequestToken.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Create a signature request token Creates a token that opens the signature request without signing in, in a form embedded in your app or from a link you send. The response is the only time the token's secret is returned. The link works for 24 hours, or 7 days for an email token, and a signing page that opened in time keeps working for 7 more days. A test API token can't create a token for a live signature request.

Parameters

  • connection (Docspring.Connection): Connection to server
  • signature_request_id (String.t): The signature request's ID.
  • opts (keyword): Optional parameters
    • :body (CreateSignatureRequestTokenRequest): The kind of link to make. Send no body for an api token.

Returns

  • {:ok, Docspring.Model.SignatureRequestToken.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

create_submission(connection, template_id, body, opts \\ [])

Generate a PDF Creates a submission: fills in a template with your data and generates a PDF. The PDF is generated in the background: on sync.api hosts the request waits for it (unless you pass wait=false), otherwise poll GET /submissions/{submission_id} until state isn't pending. Data that doesn't match the template's fields returns a 422 with an invalid_data error. The submission is still saved, with its errors, so you can find it in DocSpring: the error's submission_id is its ID.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • body (CreateSubmissionRequest): The submission's data and settings.
  • opts (keyword): Optional parameters
    • :version (String.t): The template version to use: a published version (1.2.0, or 1 for the latest 1.x.x), latest or draft. Default latest (the draft when no version has been published).
    • :wait (boolean()): Wait until the files have been generated before responding. Default true on sync.api hosts.
    • :"Idempotency-Key" (String.t): A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an Idempotent-Replayed: true header) instead of creating another submission. Send a new key with each new submission, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 idempotency_key_reused. A 409 idempotency_key_in_use means the first request is still being processed: send the request again in a few seconds.

Returns

  • {:ok, Docspring.Model.Submission.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

create_submission_batch(connection, body, opts \\ [])

Generate PDFs in a batch Creates up to 50 submissions in one request, from one template or several. The PDFs are only generated when every submission is valid. On sync.api hosts the request waits until every PDF has been generated (unless you pass wait=false), otherwise poll GET /submissions/batches/{submission_batch_id} until processed_at is set. When any submission is invalid, nothing is generated and the request returns a 422. Submissions whose data doesn't match their template's fields are still saved with their errors (an invalid_data error, with each one's submission_id in its details), so you can find them in DocSpring. The other submissions aren't saved.

Parameters

  • connection (Docspring.Connection): Connection to server
  • body (CreateSubmissionBatchRequest): The submissions to create, and the settings they share.
  • opts (keyword): Optional parameters
    • :wait (boolean()): Wait until every PDF in the batch has been generated before responding. Default true on sync.api hosts.
    • :"Idempotency-Key" (String.t): A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an Idempotent-Replayed: true header) instead of creating another batch. Send a new key with each new batch, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 idempotency_key_reused. A 409 idempotency_key_in_use means the first request is still being processed: send the request again in a few seconds.

Returns

  • {:ok, Docspring.Model.SubmissionBatch.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

create_template(connection, body, opts \\ [])

Create a template Creates an HTML template, or a PDF template from a PDF you uploaded with the presigned upload (GET /uploads/presign): pass its fields.key as cache_id. To send the PDF with the request instead, use POST /templates/upload. A PDF template is ready to generate PDFs once DocSpring has processed its PDF (ready is true). On sync.api hosts the request waits for that unless you pass wait=false.

Parameters

  • connection (Docspring.Connection): Connection to server
  • body (CreateTemplateRequest): The template to create.
  • opts (keyword): Optional parameters
    • :wait (boolean()): Wait until the PDF has been processed, and a document_url downloaded, before responding. Default true on sync.api hosts.

Returns

  • {:ok, Docspring.Model.Template.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

create_template_preview(connection, template_id, body, opts \\ [])

Preview a template with data Makes PNG images of a template's pages filled in with the data you send (not a PDF), so you can check how an HTML or PDF template prints with your data before you publish a version or send live data. It renders the template's draft, or the published version you ask for. A preview makes no submission and uses no credits, and its pages are watermarked like a test submission's PDF. It's pending while it renders: get it with GET /templates/{template_id}/previews/{preview_id} until it's processed, with an image of each page, or error.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • body (CreateTemplatePreviewRequest): The data to render the template with.
  • opts (keyword): Optional parameters
    • :version (String.t): A published version (1.2.0, or 1 for the latest 1.x.x), latest or draft. Default draft.

Returns

  • {:ok, Docspring.Model.TemplatePreview.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

create_webhook(connection, body, opts \\ [])

Create a webhook Creates a webhook that sends a POST request to your endpoint whenever a subscribed event happens. Scope it to API tokens, templates or folders to receive only their events.

Parameters

  • connection (Docspring.Connection): Connection to server
  • body (CreateWebhookRequest): The webhook to create.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Webhook.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

delete_custom_file(connection, custom_file_id, opts \\ [])

@spec delete_custom_file(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.CustomFile.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Delete a custom file Deletes a custom file and returns it. Use a live API token: test tokens can't delete custom files.

Parameters

  • connection (Docspring.Connection): Connection to server
  • custom_file_id (String.t): The custom file's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.CustomFile.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

delete_folder(connection, folder_id, opts \\ [])

@spec delete_folder(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.Folder.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Delete a folder Deletes an empty folder and returns it. A folder that still has templates or folders in it can't be deleted.

Parameters

  • connection (Docspring.Connection): Connection to server
  • folder_id (String.t): The folder's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Folder.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

delete_template(connection, template_id, opts \\ [])

@spec delete_template(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.Template.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Delete a template Deletes a template's draft and all of its published versions, or one published version (version). Returns the template as it was before it was deleted.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • opts (keyword): Optional parameters
    • :version (String.t): Delete only this published version (1.2.0) or the draft (draft, when no version has been published). Without it, the draft and every published version are deleted.

Returns

  • {:ok, Docspring.Model.Template.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

delete_webhook(connection, webhook_id, opts \\ [])

@spec delete_webhook(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.Webhook.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Delete a webhook Deletes a webhook so it stops receiving events, and returns it.

Parameters

  • connection (Docspring.Connection): Connection to server
  • webhook_id (String.t): The webhook's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Webhook.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

expire_combined_pdf(connection, combined_pdf_id, opts \\ [])

@spec expire_combined_pdf(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.CombinedPdf.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Expire a combined PDF Deletes a combined PDF's PDF and returns the expired combined PDF.

Parameters

  • connection (Docspring.Connection): Connection to server
  • combined_pdf_id (String.t): The combined PDF's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.CombinedPdf.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

expire_submission(connection, submission_id, opts \\ [])

@spec expire_submission(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.Submission.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Expire a submission Deletes a submission's data and PDF now, and returns the expired submission.

Parameters

  • connection (Docspring.Connection): Connection to server
  • submission_id (String.t): The submission's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Submission.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

generate_submission_files(connection, submission_id, body, opts \\ [])

Generate more files Adds formats to a processed submission's files, in the background: png, a PNG image of each page of the PDF (up to 100 pages). To make them with the submission, add them to output_formats when you create it. Each new file is listed in files while it's made: on sync.api hosts the request waits for them (unless you pass wait=false), otherwise poll GET /submissions/{submission_id} until none of their state is pending. A file that couldn't be made has the state error and an error_message, and the submission stays processed. Asking for a format the submission already has (or is making) changes nothing.

Parameters

  • connection (Docspring.Connection): Connection to server
  • submission_id (String.t): The submission's ID.
  • body (GenerateSubmissionFilesRequest): The formats to make.
  • opts (keyword): Optional parameters
    • :wait (boolean()): Wait until the files have been generated before responding. Default true on sync.api hosts.

Returns

  • {:ok, Docspring.Model.Submission.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

generate_submission_preview(connection, submission_id, opts \\ [])

@spec generate_submission_preview(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.Submission.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Generate a preview PDF Generates a preview of a submission's PDF in the background, such as for a submission still waiting for its signature requests. It's in files.preview once preview_generated_at changes.

Parameters

  • connection (Docspring.Connection): Connection to server
  • submission_id (String.t): The submission's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Submission.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_combined_pdf(connection, combined_pdf_id, opts \\ [])

@spec get_combined_pdf(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.CombinedPdf.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Get a combined PDF Returns a combined PDF, with a temporary link to download it once it has been generated.

Parameters

  • connection (Docspring.Connection): Connection to server
  • combined_pdf_id (String.t): The combined PDF's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.CombinedPdf.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_custom_file(connection, custom_file_id, opts \\ [])

@spec get_custom_file(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.CustomFile.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Get a custom file Returns a custom file, with a temporary URL to download it.

Parameters

  • connection (Docspring.Connection): Connection to server
  • custom_file_id (String.t): The custom file's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.CustomFile.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_folder(connection, folder_id, opts \\ [])

@spec get_folder(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.Folder.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Get a folder Returns a folder.

Parameters

  • connection (Docspring.Connection): Connection to server
  • folder_id (String.t): The folder's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Folder.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_presign_url(connection, opts \\ [])

@spec get_presign_url(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Docspring.Model.UploadPresign.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Get a presigned URL to upload a file Returns a presigned S3 form for uploading a file directly to DocSpring, for files too large to send in a request body. POST the fields and the file (as file) to url as multipart/form-data, then pass fields.key as the cache_id when you create a custom file.

Parameters

  • connection (Docspring.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.UploadPresign.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_signature_request(connection, signature_request_id, opts \\ [])

@spec get_signature_request(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.SignatureRequest.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Get a signature request Returns a signature request, with the values the person has entered so far.

Parameters

  • connection (Docspring.Connection): Connection to server
  • signature_request_id (String.t): The signature request's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.SignatureRequest.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_submission(connection, submission_id, opts \\ [])

@spec get_submission(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.Submission.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Get a submission Returns a submission, with its data and links to download its PDF.

Parameters

  • connection (Docspring.Connection): Connection to server
  • submission_id (String.t): The submission's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Submission.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_submission_batch(connection, submission_batch_id, opts \\ [])

@spec get_submission_batch(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.SubmissionBatch.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Get a batch Returns a batch with its submissions. The batch has finished once processed_at is set: its state is processed when every PDF was generated, or error when any submission failed.

Parameters

  • connection (Docspring.Connection): Connection to server
  • submission_batch_id (String.t): The batch's ID.
  • opts (keyword): Optional parameters
    • :include_data (boolean()): Include each submission's data (null without it).

Returns

  • {:ok, Docspring.Model.SubmissionBatch.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_template(connection, template_id, opts \\ [])

@spec get_template(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.Template.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Get a template Returns a template: its draft, or one of its published versions.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • opts (keyword): Optional parameters
    • :version (String.t): A published version (1.2.0, or 1 for the latest 1.x.x), latest or draft. Default draft.

Returns

  • {:ok, Docspring.Model.Template.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_template_diff(connection, template_id, opts \\ [])

@spec get_template_diff(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.TemplateDiff.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Compare a version of a template with the one before it Returns what changed in the template's draft since its latest published version (or in a published version since the one before it): fields added, removed, changed and moved, the settings that changed, and whether the document was replaced. Check it before you publish a version.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • opts (keyword): Optional parameters
    • :version (String.t): A published version (1.2.0, or 1 for the latest 1.x.x), latest or draft. Default draft.

Returns

  • {:ok, Docspring.Model.TemplateDiff.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_template_model_code(connection, template_id, lang, opts \\ [])

Generate typed code for a template's submission data Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir or Go, so your app catches mistakes before it calls the API. root_type_name is the type of the whole data object, and just_types=true leaves out the code that converts JSON to and from the types. Java returns every class in code, each under a // ClassName.java comment. A template with no named fields returns 422.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • lang (ModelCodeLanguage): The language to generate the code in.
  • opts (keyword): Optional parameters
    • :version (String.t): The template version: a published version (1.2.0, or 1 for the latest 1.x.x), latest or draft. Default latest (the draft when no version has been published), the version a submission uses by default.
    • :just_types (boolean()): Return only the types (interfaces, classes or structs), without the code that converts JSON to and from them. Default false. JavaScript has no types and PHP no types-only code, so theirs is the same either way.

Returns

  • {:ok, Docspring.Model.TemplateModelCode.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_template_page_images(connection, template_id, opts \\ [])

@spec get_template_page_images(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.TemplatePageImages.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Get images of a template's pages Returns a JPEG image of each page of a PDF template's PDF, with temporary links to download them: the draft's PDF, or a published version's. Use them to see the pages that fields are placed on.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • opts (keyword): Optional parameters
    • :version (String.t): A published version (1.2.0, or 1 for the latest 1.x.x), latest or draft. Default draft.

Returns

  • {:ok, Docspring.Model.TemplatePageImages.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_template_preview(connection, template_id, preview_id, opts \\ [])

@spec get_template_preview(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
  {:ok, Docspring.Model.TemplatePreview.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Get a template preview Returns a preview made with POST /templates/{template_id}/previews. Once it's processed, pages has a PNG image of each page with a temporary link to download it: a preview has no PDF. Previews are deleted an hour after they're created.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • preview_id (String.t): The preview's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.TemplatePreview.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_template_schema(connection, template_id, opts \\ [])

@spec get_template_schema(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, %{optional(String.t()) => any()}}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Get the JSON Schema of a template's submission data Returns the JSON Schema that a submission's data must match. Use it to check data before you create submissions, or to build a form for the template's fields.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • opts (keyword): Optional parameters
    • :version (String.t): The template version: a published version (1.2.0, or 1 for the latest 1.x.x), latest or draft. Default latest (the draft when no version has been published), the version a submission uses by default.

Returns

  • {:ok, %{optional(String.t) => any()}} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

get_webhook(connection, webhook_id, opts \\ [])

@spec get_webhook(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.Webhook.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Get a webhook Returns a webhook.

Parameters

  • connection (Docspring.Connection): Connection to server
  • webhook_id (String.t): The webhook's ID.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Webhook.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

list_combined_pdfs(connection, opts \\ [])

@spec list_combined_pdfs(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Docspring.Model.CombinedPdfList.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

List combined PDFs Returns the combined PDFs in your account, newest first, one page at a time.

Parameters

  • connection (Docspring.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :limit (integer()): How many items to return (1-100, default 50).
    • :cursor (String.t): The previous page's next_cursor, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.

Returns

  • {:ok, Docspring.Model.CombinedPdfList.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

list_custom_files(connection, opts \\ [])

@spec list_custom_files(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Docspring.Model.CustomFileList.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

List custom files Returns the custom files in your account, newest first, one page at a time.

Parameters

  • connection (Docspring.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :limit (integer()): How many items to return (1-100, default 50).
    • :cursor (String.t): The previous page's next_cursor, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.

Returns

  • {:ok, Docspring.Model.CustomFileList.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

list_folders(connection, opts \\ [])

@spec list_folders(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Docspring.Model.FolderList.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

List folders Returns the folders in your account, newest first, one page at a time. Pass parent_folder_id to list the folders in one folder.

Parameters

  • connection (Docspring.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :parent_folder_id (String.t): Only list the folders in this folder. Without it, the list has every folder, at any depth.
    • :limit (integer()): How many items to return (1-100, default 50).
    • :cursor (String.t): The previous page's next_cursor, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.

Returns

  • {:ok, Docspring.Model.FolderList.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

list_submissions(connection, opts \\ [])

@spec list_submissions(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Docspring.Model.SubmissionList.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

List submissions Returns the submissions in your account, newest first, one page at a time. Each one is a summary: its data is null unless you pass include_data=true, and its files are empty unless you pass include_files=true. Get a submission by its ID for its signature requests, uploads and page images.

Parameters

  • connection (Docspring.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :template_id (String.t): Only list this template's submissions.
    • :test (boolean()): Only list test submissions (true) or live submissions (false).
    • :created_after (DateTime.t): Only list submissions created after this time (RFC 3339, such as 2025-01-31T09:00:00Z).
    • :created_before (DateTime.t): Only list submissions created before this time.
    • :include_data (boolean()): Include each submission's data (null without it).
    • :limit (integer()): How many items to return (1-100, default 50).
    • :cursor (String.t): The previous page's next_cursor, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
    • :state (SubmissionState): Only list submissions in this state (one state per request). The ones that failed are invalid_data, error, syntax_error, image_download_failed and image_processing_failed, and one still pending an hour after it was created is stuck.
    • :include_files (boolean()): Include each submission's generated files and their download links (files, empty without it), without the page images' links.

Returns

  • {:ok, Docspring.Model.SubmissionList.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

list_template_fields(connection, template_id, opts \\ [])

@spec list_template_fields(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.TemplateFields.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

List a template's fields Returns a template's fields with all of their settings, page by page: the draft's fields, or a published version's. A PDF template's fields are placed on its pages: GET /templates/{template_id}/page_images has images of the pages.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • opts (keyword): Optional parameters
    • :version (String.t): A published version (1.2.0, or 1 for the latest 1.x.x), latest or draft. Default draft.

Returns

  • {:ok, Docspring.Model.TemplateFields.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

list_template_submissions(connection, template_id, opts \\ [])

@spec list_template_submissions(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.SubmissionList.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

List a template's submissions Returns a template's submissions (from every version of the template), newest first.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • opts (keyword): Optional parameters
    • :test (boolean()): Only list test submissions (true) or live submissions (false).
    • :created_after (DateTime.t): Only list submissions created after this time (RFC 3339, such as 2025-01-31T09:00:00Z).
    • :created_before (DateTime.t): Only list submissions created before this time.
    • :include_data (boolean()): Include each submission's data (null without it).
    • :limit (integer()): How many items to return (1-100, default 50).
    • :cursor (String.t): The previous page's next_cursor, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
    • :state (SubmissionState): Only list submissions in this state (one state per request). The ones that failed are invalid_data, error, syntax_error, image_download_failed and image_processing_failed, and one still pending an hour after it was created is stuck.
    • :include_files (boolean()): Include each submission's generated files and their download links (files, empty without it), without the page images' links.

Returns

  • {:ok, Docspring.Model.SubmissionList.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

list_templates(connection, opts \\ [])

@spec list_templates(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Docspring.Model.TemplateSummaryList.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

List templates Returns the templates in your account (their drafts), newest first, one page at a time. Each one is a summary: get a template by its ID for its settings, its PDF in full, its HTML, defaults and published versions.

Parameters

  • connection (Docspring.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :query (String.t): Only list templates whose name contains this text (ignoring case).
    • :parent_folder_id (String.t): Only list the templates in this folder (not in its subfolders).
    • :limit (integer()): How many items to return (1-100, default 50).
    • :cursor (String.t): The previous page's next_cursor, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.

Returns

  • {:ok, Docspring.Model.TemplateSummaryList.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

list_webhooks(connection, opts \\ [])

@spec list_webhooks(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Docspring.Model.WebhookList.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

List webhooks Returns the webhooks in your account, newest first, one page at a time. Filter them by event type, mode, or the API token, template or folder they're scoped to.

Parameters

  • connection (Docspring.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :event_type (WebhookEventType): Only list webhooks that subscribe to this event.
    • :mode (WebhookMode): Only list webhooks set to this mode.
    • :template_id (String.t): Only list webhooks scoped to this template.
    • :folder_id (String.t): Only list webhooks scoped to this folder.
    • :api_token_id (String.t): Only list webhooks scoped to this API token.
    • :limit (integer()): How many items to return (1-100, default 50).
    • :cursor (String.t): The previous page's next_cursor, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.

Returns

  • {:ok, Docspring.Model.WebhookList.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

move_folder(connection, folder_id, body, opts \\ [])

Move a folder Moves a folder into another folder, or to the root with parent_folder_id: null. Its templates and folders move with it. A folder can't move into itself or one of its own folders.

Parameters

  • connection (Docspring.Connection): Connection to server
  • folder_id (String.t): The folder's ID.
  • body (MoveFolderRequest): Where to move the folder.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Folder.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

move_template(connection, template_id, body, opts \\ [])

Move a template to a folder Moves a template and all of its published versions to a folder, or to the root (null).

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • body (MoveTemplateRequest): Where to move the template.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Template.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

publish_template_version(connection, template_id, body, opts \\ [])

Publish a template version Publishes the template's draft as a new version that doesn't change. version_type says which part of the latest version number goes up. While the template's PDF is downloading or being processed, or DocSpring is setting up its fields, it returns a 409 that says so.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • body (PublishTemplateVersionRequest): The version to publish.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.TemplateVersion.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

remove_template_fields(connection, template_id, body, opts \\ [])

Remove fields from a template Removes fields from a template's draft and returns the fields that are left. Conditional logic that used only the removed fields is removed too.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • body (RemoveTemplateFieldsRequest): The fields to remove from the template's draft.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.TemplateFields.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

rename_folder(connection, folder_id, body, opts \\ [])

Rename a folder Renames a folder. The name must be unique within its parent folder.

Parameters

  • connection (Docspring.Connection): Connection to server
  • folder_id (String.t): The folder's ID.
  • body (RenameFolderRequest): The folder's new name.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Folder.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

reorder_template_fields(connection, template_id, body, opts \\ [])

Reorder a template's fields Changes the order of the fields in a template's draft and returns them in their new order. Send every field's ID: each field stays on its page, and a page's fields are printed in this order, so a later field prints over an earlier one where they overlap. Their values are in this order in the template's data schema and forms.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • body (ReorderTemplateFieldsRequest): The new order of the fields in the template's draft.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.TemplateFields.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

restore_template_version(connection, template_id, body, opts \\ [])

Restore a template version Replaces the template's draft with a copy of one of its published versions.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • body (RestoreTemplateVersionRequest): The version to restore.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Template.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

test_authentication(connection, opts \\ [])

@spec test_authentication(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Docspring.Model.AuthenticationCheck.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Test authentication Checks whether your API token is valid by making an authenticated request. This endpoint is useful for verifying credentials during setup or troubleshooting issues.

Parameters

  • connection (Docspring.Connection): Connection to server
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.AuthenticationCheck.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

update_signature_request(connection, signature_request_id, body, opts \\ [])

Update a signature request Changes a pending signature request's metadata, or how your app authenticated the person (for the audit trail). Once the person has opened it, only its metadata can be changed, and a completed or declined signature request can't be changed.

Parameters

  • connection (Docspring.Connection): Connection to server
  • signature_request_id (String.t): The signature request's ID.
  • body (UpdateSignatureRequestRequest): The settings to change. Properties left out keep their values.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.SignatureRequest.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

update_template(connection, template_id, body, opts \\ [])

Update a template Changes a template's draft. Properties left out keep their values. defaults and html_engine_options replace the whole object, and field_groups changes only the groups it lists. Setting parent_folder_id moves the template and all of its published versions.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • body (UpdateTemplateRequest): The settings to change. Properties left out keep their values.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Template.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

update_template_document(connection, template_id, body, opts \\ [])

Replace a template's PDF Replaces a PDF template's PDF with one you uploaded with the presigned upload (GET /uploads/presign) (cache_id), a link to download it from (document_url), or the file in base64 (document_base64). The fields stay where they are, unless reimport_fields replaces them with the new PDF's fillable fields. To send the PDF as multipart/form-data instead, use PUT /templates/{template_id}/document/upload.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • body (UpdateTemplateDocumentRequest): The new PDF, as one of cache_id, document_url and document_base64.
  • opts (keyword): Optional parameters
    • :wait (boolean()): Wait until the PDF has been processed, and a document_url downloaded, before responding. Default true on sync.api hosts.

Returns

  • {:ok, Docspring.Model.Template.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

update_template_fields(connection, template_id, body, opts \\ [])

Update a template's fields Changes fields of a template's draft and returns all of its fields. Settings left out keep their values. A shared setting (type, required, default, ...) changes for every field with the same name.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • body (UpdateTemplateFieldsRequest): The fields to change in the template's draft.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.TemplateFields.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

update_webhook(connection, webhook_id, body, opts \\ [])

Update a webhook Updates a webhook. Only the properties you send change.

Parameters

  • connection (Docspring.Connection): Connection to server
  • webhook_id (String.t): The webhook's ID.
  • body (UpdateWebhookRequest): The settings to change. Properties left out keep their values.
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Webhook.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

upload_template(connection, document, opts \\ [])

@spec upload_template(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, Docspring.Model.Template.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Create a PDF template from an uploaded PDF Creates a PDF template from a PDF sent with the request (multipart/form-data). For large files, upload the PDF with the presigned upload (GET /uploads/presign) and create the template with POST /templates.

Parameters

  • connection (Docspring.Connection): Connection to server
  • document (String.t): The PDF.
  • opts (keyword): Optional parameters
    • :wait (boolean()): Wait until the PDF has been processed, and a document_url downloaded, before responding. Default true on sync.api hosts.
    • :name (String.t): The template's name.
    • :description (String.t): The template's description.
    • :parent_folder_id (String.t): The folder to put the template in. Left out, it's created at the root.
    • :ai_field_naming_language (Docspring.Model.AiFieldNamingLanguage.t): The language AI field setup names fields in: auto uses the form's language when it's written in the Latin alphabet without accents, and English otherwise; english always uses English; form_language uses the form's language and script. Default: your account's template settings.
    • :detect_fields (boolean()): Set up the PDF's fields as DocSpring's \"Automatically detect fields\" upload option does: import or detect the fields, name them with AI, and set up conditional logic. field_source, field_naming and field_logic choose how. Default false. document.page_processing_statuses and document.field_logic_status show how it's going, and document.state becomes processed once every page's fields are set up.
    • :field_source (Docspring.Model.FieldSetupSource.t): With detect_fields, where the fields come from. auto (the default) imports the form fields of a fillable PDF and detects the fields of a PDF without them; pdf_detection detects the fields from the page layout, even on a fillable PDF; pdf_form_fields only imports the PDF's form fields.
    • :field_naming (Docspring.Model.FieldSetupNaming.t): With detect_fields, how the fields are named. ai (the default) names them and sets their types and settings with AI; preserve keeps the names of the PDF's form fields, and AI only names the fields it detected. preserve needs field_source auto or pdf_form_fields.
    • :field_logic (Docspring.Model.FieldSetupLogic.t): With detect_fields, whether AI reads the whole form once the fields are named and sets up conditional logic and required fields (ai) or not (none). Default: your account's template settings.

Returns

  • {:ok, Docspring.Model.Template.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

upload_template_document(connection, template_id, document, opts \\ [])

@spec upload_template_document(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
  {:ok, Docspring.Model.Template.t()}
  | {:ok, Docspring.Model.ErrorResponse.t()}
  | {:error, Tesla.Env.t()}

Replace a template's PDF with an uploaded PDF Replaces a PDF template's PDF with one sent with the request (multipart/form-data). The fields stay where they are, unless reimport_fields replaces them with the new PDF's fillable fields.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • document (String.t): The new PDF.
  • opts (keyword): Optional parameters
    • :wait (boolean()): Wait until the PDF has been processed, and a document_url downloaded, before responding. Default true on sync.api hosts.
    • :reimport_fields (boolean()): Replace all of the template's fields with the fillable fields in the new PDF, once DocSpring has processed it (document.field_reimport_state). As on a first upload, the default typeface, font size, bold and color are taken from the PDF's fields; the template's other settings are kept. If the PDF has no fillable fields, the template keeps its fields. A locked template can't re-import its fields.

Returns

  • {:ok, Docspring.Model.Template.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure

validate_submission(connection, template_id, body, opts \\ [])

Check a submission without creating it Checks a submission as creating it would (its data against the template's fields, its settings and signature requests) without saving it, generating anything or using credits. It doesn't check your account's credits. The response says whether the submission is valid, and if not, has the error that creating it would return.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t): The template's ID.
  • body (ValidateSubmissionRequest): The submission's data and settings.
  • opts (keyword): Optional parameters
    • :version (String.t): The template version to use: a published version (1.2.0, or 1 for the latest 1.x.x), latest or draft. Default latest (the draft when no version has been published).

Returns

  • {:ok, Docspring.Model.SubmissionValidation.t} | {:ok, Docspring.Model.ErrorResponse.t} on success

  • {:error, Tesla.Env.t} on failure