Docspring.Api.Client (docspring v3.0.0)

API calls for all endpoints tagged Client.

Summary

Functions

Add new fields to a Template Adds fields to a PDF template. Configure field types, positions, defaults, and formatting options.

Generate multiple PDFs Generates up to 50 PDFs in a single request. Each submission can use a different template and data. Supports both synchronous (wait for all PDFs) and asynchronous processing. More efficient than individual requests when creating multiple PDFs. See also: - Batch and Combine PDFs - Generate and merge PDFs in one request

Merge submission PDFs, template PDFs, or custom files Combines multiple PDFs from various sources into a single PDF file. Supports merging submission PDFs, template PDFs, custom files, other merged PDFs, and PDFs from URLs. Merges the PDFs in the order provided.

Copy a template Creates a copy of an existing template with all its fields and configuration. Optionally specify a new name and target folder. The copied template starts as a new draft that can be modified independently of the original.

Create a new custom file from a cached S3 upload The Custom Files API endpoint allows you to upload PDFs to DocSpring and then merge them with other PDFs. First upload your file using the presigned URL endpoint, then use the returned cache_id to create the custom file.

Create a new event for emailing a signee a request for signature Records user notification events for data requests. Use this to create an audit trail showing when and how users were notified about data request forms. Supports email, SMS, and other notification types. Records the notification time for compliance tracking. See also: - Embedded Data Requests Guide - User notification workflow

Create a new data request token for form authentication Creates an authentication token for accessing a data request form. Tokens can be created for API access (1 hour expiration) or email links (30 day expiration). Returns a token and a pre-authenticated URL for the data request form. See also: - Embedded Data Requests Guide

Create a folder Creates a new folder for organizing templates. Folders can be nested within other folders by providing a parent_folder_id. Folder names must be unique within the same parent.

Create a new HTML template Creates a new HTML template using HTML, CSS/SCSS, and Liquid templating. Allows complete control over PDF layout and styling. Supports headers, footers, and dynamic content using Liquid syntax for field values, conditions, loops, and filters.

Create a new PDF template with a form POST file upload Creates a new PDF template by uploading a PDF file. The uploaded PDF becomes the foundation for your template, and you can then add fillable fields using the template editor. Use the wait parameter to control whether the request waits for document processing to complete.

Create a new PDF template from a cached S3 file upload Creates a new PDF template from a file previously uploaded to S3 using a presigned URL. This two-step process allows for more reliable large file uploads by first uploading the file to S3, then creating the template using the cached upload ID.

Delete a folder Deletes an empty folder. The folder must not contain any templates or subfolders. Move or delete all contents before attempting to delete the folder.

Delete a template Deletes a template or a specific template version. When no version is specified, deletes the entire template including all versions. When a version is specified, deletes only that version while preserving others. Returns remaining version information.

Expire a combined submission Expiring a combined submission deletes the PDF from our system. This is useful for invalidating sensitive documents.

Expire a PDF submission Expiring a PDF submission deletes the PDF and removes the data from our database. This is useful for invalidating sensitive documents after they've been downloaded. You can also configure a data retention policy for your submissions so that they automatically expire.

Generate a PDF Creates a PDF submission by filling in a template with data. Supports both synchronous (default) and asynchronous processing. Set wait: false to return immediately. See also: - Customize the PDF Title and Filename - Set custom metadata - Handling Truncated Text - Handle text that doesn't fit in fields

Generate a preview PDF for partially completed data requests Generates a preview PDF for a submission with partially completed data requests. Useful for showing users what the final document will look like before all signatures or data have been collected. The preview includes any data collected so far.

Check the status of a combined submission (merged PDFs) Retrieves the details and status of a combined submission. Returns processing state, download URL (if processed), metadata, and information about any integrated actions (e.g., S3 uploads).

Look up a submission data request Retrieves the details and status of a data request. Returns information about the request state (pending, viewed, completed), authentication details, and metadata. Includes audit information like IP address, browseruser agent, and timestamps. See also: - Embedded Data Requests Guide - Complete guide to data request workflow

Fetch the full attributes for a PDF template Retrieves complete template information including fields, defaults, settings, and HTML/SCSS content. Use this to get all template data needed for automated updates or analysis. Returns more detailed information than the basic getTemplate endpoint.

Get a presigned S3 URL for direct file upload Returns a presigned S3 URL for uploading files directly to our S3 bucket. Use this endpoint to upload large files before creating templates or custom files. S3 will respond with a JSON object that you can include in your DocSpring API request. Uploaded files can be used to: - Create templates - Update templates - Create custom files and then merge them with other PDFs

Check the status of a PDF Retrieves the details and status of a PDF submission. Returns processing state, download URL (if processed), metadata, submission data (optional), and information about any integrated actions. Use this to poll for completion when using asynchronous processing.

Check the status of a submission batch job Retrieves the status and results of a batch PDF generation job. Returns processing state, completion statistics, and optionally includes all individual submission details. Use this to poll for completion when using asynchronous batch processing.

Check the status of an uploaded template Retrieves information about a template including processing status and document URL. Use this to check if template is ready to view in the template editor or generate PDFs.

Fetch the JSON schema for a template Retrieves the JSON Schema definition for a template's fields. Use this to validate data before submitting it for PDF generation, or to build dynamic forms that match the template's field structure and validation requirements. See also: - Generate PDFs Guide - Use schema to validate submission data

Get a list of all combined submissions Returns a paginated list of combined submissions (merged PDFs) for your account. Includes processing status, expiration details, and download URLs for processed PDFs.

Get a list of all folders Returns a list of folders in your account. Can be filtered by parent folder ID to retrieve subfolders. Folders help organize templates and maintain a hierarchical structure.

List all submissions Returns a paginated list of all PDF submissions across all templates in your account. Can be filtered by date range and submission type (test/live). Supports cursor-based pagination and optionally includes submission data for each result.

List all submissions for a given template Returns a paginated list of all submissions for a specific template. Can be filtered by date range, submission type (test/live), and optionally include submission data. Supports cursor-based pagination for efficient retrieval of large result sets.

Get a list of all templates Retrieves a list of your templates with search, filtering, and pagination options. Returns basic template information including ID, name, type (PDF or HTML), and folder location. Supports text search by name and filtering by parent folder.

Move a folder Moves a folder to a new parent folder or to the root level. All templates and subfolders within the folder are moved together. Cannot move a folder into one of its own subfolders.

Move Template to folder Moves a template to a different folder or to the root level. Use this to organize templates within your folders. Provide a folder ID to move to a specific folder, or null to move to the root level.

Publish a template version Publishes the current draft version of a template and creates a new immutable version with semantic versioning (major.minor.patch).

Rename a folder Renames an existing folder. The new name must be unique within the same parent folder. This operation only changes the folder name, not its location or contents.

Restore a template version Restores your template to a previously published version, copying that version's content and configuration to the current draft. Use this to revert changes or recover from an unwanted modification.

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

Update a submission data request Updates authentication details for a data request. Use this when a user logs in to record their authentication method, provider, session information, and hashed identifiers. Updates metadata and tracks authentication state changes for auditing and compliance.

Update a Template Updates template content and properties. For HTML templates, you can modify the HTML, SCSS, headers, footers, name, and description. Changes are applied to your draft template and do not affect published template versions.

Update a template's document with a form POST file upload Upload a new PDF file to update a PDF template's document. This replaces the template's PDF while preserving all of the existing fields. If you upload a PDF with fewer pages than the current document, any fields on the removed pages will be deleted.

Update a template's document with a cached S3 file upload Updates a PDF template's document using a cached file upload. This is a three-step process: First, request a presigned URL to upload your PDF file to our S3 bucket. Then, use that URL to upload your PDF file. Finally, submit the ID of the uploaded file to replace the template's document.

Functions

add_fields_to_template(connection, template_id, data, opts \\ [])

Add new fields to a Template Adds fields to a PDF template. Configure field types, positions, defaults, and formatting options.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t):
  • data (AddFieldsData):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.TemplateAddFieldsResponse.t} on success
  • {:error, Tesla.Env.t} on failure

batch_generate_pdfs(connection, data, opts \\ [])

Generate multiple PDFs Generates up to 50 PDFs in a single request. Each submission can use a different template and data. Supports both synchronous (wait for all PDFs) and asynchronous processing. More efficient than individual requests when creating multiple PDFs. See also: - Batch and Combine PDFs - Generate and merge PDFs in one request

Parameters

  • connection (Docspring.Connection): Connection to server
  • data (SubmissionBatchData):
  • opts (keyword): Optional parameters
    • :wait (boolean()): Wait for submission batch to be processed before returning. Set to false to return immediately. Default: true (on sync.* subdomain)

Returns

  • {:ok, Docspring.Model.BatchGeneratePdfs201Response.t} on success
  • {:error, Tesla.Env.t} on failure

combine_pdfs(connection, data, opts \\ [])

Merge submission PDFs, template PDFs, or custom files Combines multiple PDFs from various sources into a single PDF file. Supports merging submission PDFs, template PDFs, custom files, other merged PDFs, and PDFs from URLs. Merges the PDFs in the order provided.

Parameters

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

Returns

  • {:ok, Docspring.Model.CreateCombinedSubmissionResponse.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.ErrorResponse.t()}
  | {:ok, Docspring.Model.TemplatePreview.t()}
  | {:error, Tesla.Env.t()}

Copy a template Creates a copy of an existing template with all its fields and configuration. Optionally specify a new name and target folder. The copied template starts as a new draft that can be modified independently of the original.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t):
  • opts (keyword): Optional parameters
    • :body (CopyTemplateOptions):

Returns

  • {:ok, Docspring.Model.TemplatePreview.t} on success
  • {:error, Tesla.Env.t} on failure

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

Create a new custom file from a cached S3 upload The Custom Files API endpoint allows you to upload PDFs to DocSpring and then merge them with other PDFs. First upload your file using the presigned URL endpoint, then use the returned cache_id to create the custom file.

Parameters

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

Returns

  • {:ok, Docspring.Model.CreateCustomFileResponse.t} on success
  • {:error, Tesla.Env.t} on failure

create_data_request_event(connection, data_request_id, event, opts \\ [])

Create a new event for emailing a signee a request for signature Records user notification events for data requests. Use this to create an audit trail showing when and how users were notified about data request forms. Supports email, SMS, and other notification types. Records the notification time for compliance tracking. See also: - Embedded Data Requests Guide - User notification workflow

Parameters

  • connection (Docspring.Connection): Connection to server
  • data_request_id (String.t):
  • event (CreateSubmissionDataRequestEventRequest):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.CreateSubmissionDataRequestEventResponse.t} on success
  • {:error, Tesla.Env.t} on failure

create_data_request_token(connection, data_request_id, opts \\ [])

Create a new data request token for form authentication Creates an authentication token for accessing a data request form. Tokens can be created for API access (1 hour expiration) or email links (30 day expiration). Returns a token and a pre-authenticated URL for the data request form. See also: - Embedded Data Requests Guide

Parameters

  • connection (Docspring.Connection): Connection to server
  • data_request_id (String.t):
  • opts (keyword): Optional parameters
    • :type (String.t):

Returns

  • {:ok, Docspring.Model.CreateSubmissionDataRequestTokenResponse.t} on success
  • {:error, Tesla.Env.t} on failure

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

Create a folder Creates a new folder for organizing templates. Folders can be nested within other folders by providing a parent_folder_id. Folder names must be unique within the same parent.

Parameters

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

Returns

  • {:ok, Docspring.Model.Folder.t} on success
  • {:error, Tesla.Env.t} on failure

create_html_template(connection, data, opts \\ [])

Create a new HTML template Creates a new HTML template using HTML, CSS/SCSS, and Liquid templating. Allows complete control over PDF layout and styling. Supports headers, footers, and dynamic content using Liquid syntax for field values, conditions, loops, and filters.

Parameters

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

Returns

  • {:ok, Docspring.Model.TemplatePreview.t} on success
  • {:error, Tesla.Env.t} on failure

create_pdf_template(connection, template_left_square_bracketdocument_right_square_bracket, template_left_square_bracketname_right_square_bracket, opts \\ [])

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

Create a new PDF template with a form POST file upload Creates a new PDF template by uploading a PDF file. The uploaded PDF becomes the foundation for your template, and you can then add fillable fields using the template editor. Use the wait parameter to control whether the request waits for document processing to complete.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_left_square_bracketdocument_right_square_bracket (String.t):
  • template_left_square_bracketname_right_square_bracket (String.t):
  • opts (keyword): Optional parameters
    • :wait (boolean()): Wait for template document to be processed before returning. Set to false to return immediately. Default: true (on sync.* subdomain)
    • :"template[description]" (String.t):
    • :"template[parent_folder_id]" (String.t):

Returns

  • {:ok, Docspring.Model.TemplatePreview.t} on success
  • {:error, Tesla.Env.t} on failure

create_pdf_template_from_upload(connection, data, opts \\ [])

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

Create a new PDF template from a cached S3 file upload Creates a new PDF template from a file previously uploaded to S3 using a presigned URL. This two-step process allows for more reliable large file uploads by first uploading the file to S3, then creating the template using the cached upload ID.

Parameters

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

Returns

  • {:ok, Docspring.Model.TemplatePreview.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.ErrorResponse.t()}
  | {:ok, Docspring.Model.Folder.t()}
  | {:error, Tesla.Env.t()}

Delete a folder Deletes an empty folder. The folder must not contain any templates or subfolders. Move or delete all contents before attempting to delete the folder.

Parameters

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

Returns

  • {:ok, Docspring.Model.Folder.t} on success
  • {:error, Tesla.Env.t} on failure

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

Delete a template Deletes a template or a specific template version. When no version is specified, deletes the entire template including all versions. When a version is specified, deletes only that version while preserving others. Returns remaining version information.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t):
  • opts (keyword): Optional parameters
    • :version (String.t):

Returns

  • {:ok, Docspring.Model.TemplateDeleteResponse.t} on success
  • {:error, Tesla.Env.t} on failure

expire_combined_submission(connection, combined_submission_id, opts \\ [])

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

Expire a combined submission Expiring a combined submission deletes the PDF from our system. This is useful for invalidating sensitive documents.

Parameters

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

Returns

  • {:ok, Docspring.Model.CombinedSubmission.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.ErrorResponse.t()}
  | {:ok, Docspring.Model.SubmissionPreview.t()}
  | {:error, Tesla.Env.t()}

Expire a PDF submission Expiring a PDF submission deletes the PDF and removes the data from our database. This is useful for invalidating sensitive documents after they've been downloaded. You can also configure a data retention policy for your submissions so that they automatically expire.

Parameters

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

Returns

  • {:ok, Docspring.Model.SubmissionPreview.t} on success
  • {:error, Tesla.Env.t} on failure

generate_pdf(connection, template_id, submission, opts \\ [])

Generate a PDF Creates a PDF submission by filling in a template with data. Supports both synchronous (default) and asynchronous processing. Set wait: false to return immediately. See also: - Customize the PDF Title and Filename - Set custom metadata - Handling Truncated Text - Handle text that doesn't fit in fields

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t):
  • submission (CreatePdfSubmissionData):
  • opts (keyword): Optional parameters
    • :wait (boolean()): Wait for submission to be processed before returning. Set to false to return immediately. Default: true (on sync.* subdomain)

Returns

  • {:ok, Docspring.Model.CreateSubmissionResponse.t} on success
  • {:error, Tesla.Env.t} on failure

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

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

Generate a preview PDF for partially completed data requests Generates a preview PDF for a submission with partially completed data requests. Useful for showing users what the final document will look like before all signatures or data have been collected. The preview includes any data collected so far.

Parameters

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

Returns

  • {:ok, Docspring.Model.SuccessErrorResponse.t} on success
  • {:error, Tesla.Env.t} on failure

get_combined_submission(connection, combined_submission_id, opts \\ [])

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

Check the status of a combined submission (merged PDFs) Retrieves the details and status of a combined submission. Returns processing state, download URL (if processed), metadata, and information about any integrated actions (e.g., S3 uploads).

Parameters

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

Returns

  • {:ok, Docspring.Model.CombinedSubmission.t} on success
  • {:error, Tesla.Env.t} on failure

get_data_request(connection, data_request_id, opts \\ [])

Look up a submission data request Retrieves the details and status of a data request. Returns information about the request state (pending, viewed, completed), authentication details, and metadata. Includes audit information like IP address, browseruser agent, and timestamps. See also: - Embedded Data Requests Guide - Complete guide to data request workflow

Parameters

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

Returns

  • {:ok, Docspring.Model.SubmissionDataRequestShow.t} on success
  • {:error, Tesla.Env.t} on failure

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

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

Fetch the full attributes for a PDF template Retrieves complete template information including fields, defaults, settings, and HTML/SCSS content. Use this to get all template data needed for automated updates or analysis. Returns more detailed information than the basic getTemplate endpoint.

Parameters

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

Returns

  • {:ok, Docspring.Model.Template.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.ErrorResponse.t()}
  | {:ok, Docspring.Model.UploadPresignResponse.t()}
  | {:error, Tesla.Env.t()}

Get a presigned S3 URL for direct file upload Returns a presigned S3 URL for uploading files directly to our S3 bucket. Use this endpoint to upload large files before creating templates or custom files. S3 will respond with a JSON object that you can include in your DocSpring API request. Uploaded files can be used to: - Create templates - Update templates - Create custom files and then merge them with other PDFs

Parameters

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

Returns

  • {:ok, Docspring.Model.UploadPresignResponse.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.ErrorResponse.t()}
  | {:ok, Docspring.Model.Submission.t()}
  | {:error, Tesla.Env.t()}

Check the status of a PDF Retrieves the details and status of a PDF submission. Returns processing state, download URL (if processed), metadata, submission data (optional), and information about any integrated actions. Use this to poll for completion when using asynchronous processing.

Parameters

  • connection (Docspring.Connection): Connection to server
  • submission_id (String.t):
  • opts (keyword): Optional parameters
    • :include_data (boolean()):

Returns

  • {:ok, Docspring.Model.Submission.t} on success
  • {:error, Tesla.Env.t} on failure

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

Check the status of a submission batch job Retrieves the status and results of a batch PDF generation job. Returns processing state, completion statistics, and optionally includes all individual submission details. Use this to poll for completion when using asynchronous batch processing.

Parameters

  • connection (Docspring.Connection): Connection to server
  • submission_batch_id (String.t):
  • opts (keyword): Optional parameters
    • :include_submissions (boolean()):

Returns

  • {:ok, Docspring.Model.SubmissionBatchWithSubmissions.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.ErrorResponse.t()}
  | {:ok, Docspring.Model.TemplatePreview.t()}
  | {:error, Tesla.Env.t()}

Check the status of an uploaded template Retrieves information about a template including processing status and document URL. Use this to check if template is ready to view in the template editor or generate PDFs.

Parameters

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

Returns

  • {:ok, Docspring.Model.TemplatePreview.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, Docspring.Model.ErrorResponse.t()}
  | {:ok, Docspring.Model.JsonSchema.t()}
  | {:error, Tesla.Env.t()}

Fetch the JSON schema for a template Retrieves the JSON Schema definition for a template's fields. Use this to validate data before submitting it for PDF generation, or to build dynamic forms that match the template's field structure and validation requirements. See also: - Generate PDFs Guide - Use schema to validate submission data

Parameters

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

Returns

  • {:ok, Docspring.Model.JsonSchema.t} on success
  • {:error, Tesla.Env.t} on failure

list_combined_submissions(connection, opts \\ [])

@spec list_combined_submissions(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Docspring.Model.ErrorResponse.t()}
  | {:ok, [Docspring.Model.CombinedSubmission.t()]}
  | {:error, Tesla.Env.t()}

Get a list of all combined submissions Returns a paginated list of combined submissions (merged PDFs) for your account. Includes processing status, expiration details, and download URLs for processed PDFs.

Parameters

  • connection (Docspring.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :page (integer()): Default: 1
    • :per_page (integer()): Default: 50

Returns

  • {:ok, [%CombinedSubmission{}, ...]} on success
  • {:error, Tesla.Env.t} on failure

list_folders(connection, opts \\ [])

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

Get a list of all folders Returns a list of folders in your account. Can be filtered by parent folder ID to retrieve subfolders. Folders help organize templates and maintain a hierarchical structure.

Parameters

  • connection (Docspring.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :parent_folder_id (String.t): Filter By Folder Id

Returns

  • {:ok, [%Folder{}, ...]} on success
  • {:error, Tesla.Env.t} on failure

list_submissions(connection, opts \\ [])

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

List all submissions Returns a paginated list of all PDF submissions across all templates in your account. Can be filtered by date range and submission type (test/live). Supports cursor-based pagination and optionally includes submission data for each result.

Parameters

  • connection (Docspring.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :cursor (String.t):
    • :limit (integer()):
    • :created_after (String.t):
    • :created_before (String.t):
    • :type (String.t):
    • :include_data (boolean()):

Returns

  • {:ok, Docspring.Model.ListSubmissionsResponse.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.ErrorResponse.t()}
  | {:ok, Docspring.Model.ListSubmissionsResponse.t()}
  | {:error, Tesla.Env.t()}

List all submissions for a given template Returns a paginated list of all submissions for a specific template. Can be filtered by date range, submission type (test/live), and optionally include submission data. Supports cursor-based pagination for efficient retrieval of large result sets.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t):
  • opts (keyword): Optional parameters
    • :cursor (String.t):
    • :limit (integer()):
    • :created_after (String.t):
    • :created_before (String.t):
    • :type (String.t):
    • :include_data (boolean()):

Returns

  • {:ok, Docspring.Model.ListSubmissionsResponse.t} on success
  • {:error, Tesla.Env.t} on failure

list_templates(connection, opts \\ [])

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

Get a list of all templates Retrieves a list of your templates with search, filtering, and pagination options. Returns basic template information including ID, name, type (PDF or HTML), and folder location. Supports text search by name and filtering by parent folder.

Parameters

  • connection (Docspring.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :query (String.t): Search By Name
    • :parent_folder_id (String.t): Filter By Folder Id
    • :page (integer()): Default: 1
    • :per_page (integer()): Default: 50

Returns

  • {:ok, [%TemplatePreview{}, ...]} on success
  • {:error, Tesla.Env.t} on failure

move_folder_to_folder(connection, folder_id, data, opts \\ [])

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

Move a folder Moves a folder to a new parent folder or to the root level. All templates and subfolders within the folder are moved together. Cannot move a folder into one of its own subfolders.

Parameters

  • connection (Docspring.Connection): Connection to server
  • folder_id (String.t):
  • data (MoveFolderData):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Folder.t} on success
  • {:error, Tesla.Env.t} on failure

move_template_to_folder(connection, template_id, data, opts \\ [])

Move Template to folder Moves a template to a different folder or to the root level. Use this to organize templates within your folders. Provide a folder ID to move to a specific folder, or null to move to the root level.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t):
  • data (MoveTemplateData):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.TemplatePreview.t} on success
  • {:error, Tesla.Env.t} on failure

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

Publish a template version Publishes the current draft version of a template and creates a new immutable version with semantic versioning (major.minor.patch).

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t):
  • data (PublishVersionData):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.TemplatePublishVersionResponse.t} on success
  • {:error, Tesla.Env.t} on failure

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

Rename a folder Renames an existing folder. The new name must be unique within the same parent folder. This operation only changes the folder name, not its location or contents.

Parameters

  • connection (Docspring.Connection): Connection to server
  • folder_id (String.t):
  • data (RenameFolderData):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.Folder.t} on success
  • {:error, Tesla.Env.t} on failure

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

Restore a template version Restores your template to a previously published version, copying that version's content and configuration to the current draft. Use this to revert changes or recover from an unwanted modification.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t):
  • data (RestoreVersionData):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.SuccessErrorResponse.t} on success
  • {:error, Tesla.Env.t} on failure

test_authentication(connection, opts \\ [])

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

Test authentication Checks whether your API token is valid by making an authenticated request. Returns a success response if authentication passes. 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.SuccessErrorResponse.t} on success
  • {:error, Tesla.Env.t} on failure

update_data_request(connection, data_request_id, data, opts \\ [])

Update a submission data request Updates authentication details for a data request. Use this when a user logs in to record their authentication method, provider, session information, and hashed identifiers. Updates metadata and tracks authentication state changes for auditing and compliance.

Parameters

  • connection (Docspring.Connection): Connection to server
  • data_request_id (String.t):
  • data (UpdateSubmissionDataRequestData):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.CreateSubmissionDataRequestResponse.t} on success
  • {:error, Tesla.Env.t} on failure

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

Update a Template Updates template content and properties. For HTML templates, you can modify the HTML, SCSS, headers, footers, name, and description. Changes are applied to your draft template and do not affect published template versions.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t):
  • data (UpdateHtmlTemplate):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.SuccessMultipleErrorsResponse.t} on success
  • {:error, Tesla.Env.t} on failure

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

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

Update a template's document with a form POST file upload Upload a new PDF file to update a PDF template's document. This replaces the template's PDF while preserving all of the existing fields. If you upload a PDF with fewer pages than the current document, any fields on the removed pages will be deleted.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t):
  • template_left_square_bracketdocument_right_square_bracket (String.t):
  • opts (keyword): Optional parameters
    • :"template[name]" (String.t):

Returns

  • {:ok, Docspring.Model.SuccessMultipleErrorsResponse.t} on success
  • {:error, Tesla.Env.t} on failure

update_template_document_from_upload(connection, template_id, data, opts \\ [])

Update a template's document with a cached S3 file upload Updates a PDF template's document using a cached file upload. This is a three-step process: First, request a presigned URL to upload your PDF file to our S3 bucket. Then, use that URL to upload your PDF file. Finally, submit the ID of the uploaded file to replace the template's document.

Parameters

  • connection (Docspring.Connection): Connection to server
  • template_id (String.t):
  • data (UpdatePdfTemplate):
  • opts (keyword): Optional parameters

Returns

  • {:ok, Docspring.Model.SuccessMultipleErrorsResponse.t} on success
  • {:error, Tesla.Env.t} on failure