From a1f5dd08c74a2cb855022d1bcb26ed04bfdd30dd Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Mon, 8 Sep 2025 14:42:25 +0300 Subject: [PATCH 01/11] fix typo --- app/views/webhook_settings/show.html.erb | 2 +- config/locales/i18n.yml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/webhook_settings/show.html.erb b/app/views/webhook_settings/show.html.erb index 1b9a53ad..5084319e 100644 --- a/app/views/webhook_settings/show.html.erb +++ b/app/views/webhook_settings/show.html.erb @@ -84,7 +84,7 @@

<%= t('events_log') %>

<%= link_to t('all'), url_for(params.to_unsafe_h.except(:status)), style: 'margin-bottom: -1px', class: "tab h-10 text-base #{params[:status].blank? ? 'tab-active tab-bordered' : 'pb-[3px]'}" %> - <%= link_to t('successed'), url_for(params.to_unsafe_h.merge(status: 'success')), style: 'margin-bottom: -1px', class: "tab h-10 text-base #{params[:status] == 'success' ? 'tab-active tab-bordered' : 'pb-[3px]'}" %> + <%= link_to t('succeeded'), url_for(params.to_unsafe_h.merge(status: 'success')), style: 'margin-bottom: -1px', class: "tab h-10 text-base #{params[:status] == 'success' ? 'tab-active tab-bordered' : 'pb-[3px]'}" %> <%= link_to t('failed'), url_for(params.to_unsafe_h.merge(status: 'error')), style: 'margin-bottom: -1px', class: "tab h-10 text-base #{params[:status] == 'error' ? 'tab-active tab-bordered' : 'pb-[3px]'}" %>
<% if @webhook_events.present? %> diff --git a/config/locales/i18n.yml b/config/locales/i18n.yml index 18da4440..e43464fc 100644 --- a/config/locales/i18n.yml +++ b/config/locales/i18n.yml @@ -772,7 +772,7 @@ en: &en at_least_one_field_must_be_displayed_in_the_form: At least one field must be displayed in the form. this_template_has_multiple_parties_which_prevents_the_use_of_a_sharing_link: This template has multiple parties, which prevents the use of a shared link as it's unclear which party is responsible for specific fields. To resolve this, define the default party details. events_log: Events Log - successed: Successed + succeeded: Succeeded failed: Failed there_are_no_events: There are no events resend: Resend @@ -1662,7 +1662,7 @@ es: &es at_least_one_field_must_be_displayed_in_the_form: Al menos un campo debe mostrarse en el formulario. this_template_has_multiple_parties_which_prevents_the_use_of_a_sharing_link: Esta plantilla tiene varias partes, lo que impide el uso de un enlace compartido porque no está claro qué parte es responsable de campos específicos. Para resolverlo, define los detalles predeterminados de la parte. events_log: Registro de eventos - successed: Exitoso + succeeded: Exitoso failed: Fallido there_are_no_events: No hay eventos resend: Reenviar @@ -2552,7 +2552,7 @@ it: &it at_least_one_field_must_be_displayed_in_the_form: Almeno un campo deve essere visualizzato nel modulo. this_template_has_multiple_parties_which_prevents_the_use_of_a_sharing_link: Questo modello ha più parti, il che impedisce l’uso di un link di condivisione perché non è chiaro quale parte sia responsabile di campi specifici. Per risolvere, definisci i dettagli predefiniti della parte. events_log: Registro eventi - successed: Riuscito + succeeded: Riuscito failed: Fallito there_are_no_events: Nessun evento resend: Invia di nuovo @@ -3446,7 +3446,7 @@ fr: &fr at_least_one_field_must_be_displayed_in_the_form: Au moins un champ doit être affiché dans le formulaire. this_template_has_multiple_parties_which_prevents_the_use_of_a_sharing_link: Ce modèle contient plusieurs parties, ce qui empêche l’utilisation d’un lien de partage car il n’est pas clair quelle partie est responsable de certains champs. Pour résoudre cela, définissez les détails de la partie par défaut. events_log: Journal des événements - successed: Réussi + succeeded: Réussi failed: Échoué there_are_no_events: Aucun événement resend: Renvoyer @@ -4339,7 +4339,7 @@ pt: &pt at_least_one_field_must_be_displayed_in_the_form: Pelo menos um campo deve ser exibido no formulário. this_template_has_multiple_parties_which_prevents_the_use_of_a_sharing_link: Este modelo tem várias partes, o que impede o uso de um link de compartilhamento, pois não está claro qual parte é responsável por campos específicos. Para resolver isso, defina os detalhes padrão da parte. events_log: Registro de eventos - successed: Sucesso + succeeded: Sucesso failed: Falhou there_are_no_events: Nenhum evento resend: Reenviar @@ -5231,7 +5231,7 @@ de: &de at_least_one_field_must_be_displayed_in_the_form: Mindestens ein Feld muss im Formular angezeigt werden. this_template_has_multiple_parties_which_prevents_the_use_of_a_sharing_link: Diese Vorlage enthält mehrere Parteien, was die Verwendung eines Freigabelinks verhindert, da unklar ist, welche Partei für bestimmte Felder verantwortlich ist. Um dies zu beheben, definieren Sie die Standardparteidetails. events_log: Ereignisprotokoll - successed: Erfolgreich + succeeded: Erfolgreich failed: Fehlgeschlagen there_are_no_events: Keine Ereignisse vorhanden resend: Erneut senden From ba2e0999f16e7fdaa876884e64558954f44df061 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Tue, 9 Sep 2025 09:53:21 +0300 Subject: [PATCH 02/11] add with file links option --- app/models/account_config.rb | 1 + lib/submissions/generate_audit_trail.rb | 9 ++++++++- lib/submissions/generate_preview_attachments.rb | 4 +++- lib/submissions/generate_result_attachments.rb | 15 ++++++++++++--- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/app/models/account_config.rb b/app/models/account_config.rb index 2ef39cbf..462cc725 100644 --- a/app/models/account_config.rb +++ b/app/models/account_config.rb @@ -42,6 +42,7 @@ class AccountConfig < ApplicationRecord FORCE_SSO_AUTH_KEY = 'force_sso_auth' FLATTEN_RESULT_PDF_KEY = 'flatten_result_pdf' WITH_SIGNATURE_ID = 'with_signature_id' + WITH_FILE_LINKS_KEY = 'with_file_links' WITH_SIGNATURE_ID_REASON_KEY = 'with_signature_id_reason' WITH_AUDIT_VALUES_KEY = 'with_audit_values' WITH_SUBMITTER_TIMEZONE_KEY = 'with_submitter_timezone' diff --git a/lib/submissions/generate_audit_trail.rb b/lib/submissions/generate_audit_trail.rb index 2489c91f..7d793112 100644 --- a/lib/submissions/generate_audit_trail.rb +++ b/lib/submissions/generate_audit_trail.rb @@ -113,11 +113,13 @@ module Submissions configs = submission.account.account_configs.where(key: [AccountConfig::WITH_AUDIT_VALUES_KEY, AccountConfig::WITH_SIGNATURE_ID, + AccountConfig::WITH_FILE_LINKS_KEY, AccountConfig::WITH_SUBMITTER_TIMEZONE_KEY]) last_submitter = submission.submitters.select(&:completed_at).max_by(&:completed_at) with_signature_id = configs.find { |c| c.key == AccountConfig::WITH_SIGNATURE_ID }&.value == true + with_file_links = configs.find { |c| c.key == AccountConfig::WITH_FILE_LINKS_KEY }&.value == true with_audit_values = configs.find { |c| c.key == AccountConfig::WITH_AUDIT_VALUES_KEY }&.value != false with_submitter_timezone = configs.find { |c| c.key == AccountConfig::WITH_SUBMITTER_TIMEZONE_KEY }&.value == true @@ -392,7 +394,12 @@ module Submissions Array.wrap(value).map do |uuid| attachment = submitter.attachments.find { |a| a.uuid == uuid } - link = r.submissions_preview_url(submission.slug, **Docuseal.default_url_options) + link = + if with_file_links + ActiveStorage::Blob.proxy_url(attachment.blob) + else + r.submissions_preview_url(submission.slug, **Docuseal.default_url_options) + end { link:, text: "#{attachment.filename}\n", style: :link } end, diff --git a/lib/submissions/generate_preview_attachments.rb b/lib/submissions/generate_preview_attachments.rb index c1e201ca..b57b80a1 100644 --- a/lib/submissions/generate_preview_attachments.rb +++ b/lib/submissions/generate_preview_attachments.rb @@ -15,9 +15,11 @@ module Submissions configs = submission.account.account_configs.where(key: [AccountConfig::FLATTEN_RESULT_PDF_KEY, AccountConfig::WITH_SIGNATURE_ID, AccountConfig::WITH_SUBMITTER_TIMEZONE_KEY, + AccountConfig::WITH_FILE_LINKS_KEY, AccountConfig::WITH_SIGNATURE_ID_REASON_KEY]) with_signature_id = configs.find { |c| c.key == AccountConfig::WITH_SIGNATURE_ID }&.value == true + with_file_links = configs.find { |c| c.key == AccountConfig::WITH_FILE_LINKS_KEY }&.value == true is_flatten = configs.find { |c| c.key == AccountConfig::FLATTEN_RESULT_PDF_KEY }&.value != false with_submitter_timezone = configs.find { |c| c.key == AccountConfig::WITH_SUBMITTER_TIMEZONE_KEY }&.value == true with_signature_id_reason = @@ -34,7 +36,7 @@ module Submissions submitters.preload(attachments_attachments: :blob).each_with_index do |s, index| GenerateResultAttachments.fill_submitter_fields(s, submission.account, pdfs_index, with_signature_id:, is_flatten:, with_headings: index.zero?, - with_submitter_timezone:, + with_submitter_timezone:, with_file_links:, with_signature_id_reason:) end diff --git a/lib/submissions/generate_result_attachments.rb b/lib/submissions/generate_result_attachments.rb index ae85f346..e78deb2c 100644 --- a/lib/submissions/generate_result_attachments.rb +++ b/lib/submissions/generate_result_attachments.rb @@ -139,12 +139,14 @@ module Submissions def generate_pdfs(submitter) configs = submitter.account.account_configs.where(key: [AccountConfig::FLATTEN_RESULT_PDF_KEY, AccountConfig::WITH_SIGNATURE_ID, + AccountConfig::WITH_FILE_LINKS_KEY, AccountConfig::WITH_SUBMITTER_TIMEZONE_KEY, AccountConfig::WITH_SIGNATURE_ID_REASON_KEY]) with_signature_id = configs.find { |c| c.key == AccountConfig::WITH_SIGNATURE_ID }&.value == true is_flatten = configs.find { |c| c.key == AccountConfig::FLATTEN_RESULT_PDF_KEY }&.value != false with_submitter_timezone = configs.find { |c| c.key == AccountConfig::WITH_SUBMITTER_TIMEZONE_KEY }&.value == true + with_file_links = configs.find { |c| c.key == AccountConfig::WITH_FILE_LINKS_KEY }&.value == true with_signature_id_reason = configs.find { |c| c.key == AccountConfig::WITH_SIGNATURE_ID_REASON_KEY }&.value != false @@ -192,11 +194,12 @@ module Submissions fill_submitter_fields(submitter, submitter.account, pdfs_index, with_signature_id:, is_flatten:, with_submitter_timezone:, + with_file_links:, with_signature_id_reason:) end def fill_submitter_fields(submitter, account, pdfs_index, with_signature_id:, is_flatten:, with_headings: nil, - with_submitter_timezone: false, with_signature_id_reason: true) + with_submitter_timezone: false, with_signature_id_reason: true, with_file_links: nil) cell_layouter = HexaPDF::Layout::TextLayouter.new(text_valign: :center, text_align: :center) attachments_data_cache = {} @@ -466,6 +469,13 @@ module Submissions diff = ((area['h'] * height) / 2) - (lines.sum(&:height) / 2) + url = + if with_file_links + ActiveStorage::Blob.proxy_url(attachment.blob) + else + r.submissions_preview_url(submission.slug, **Docuseal.default_url_options) + end + page[:Annots] << pdf.add( { Type: :Annot, Subtype: :Link, @@ -477,8 +487,7 @@ module Submissions height - (area['y'] * height) - lines[..next_index].sum(&:height) + height_diff - (height_diff.zero? ? diff : 0) ], - A: { Type: :Action, S: :URI, - URI: r.submissions_preview_url(submission.slug, **Docuseal.default_url_options) } + A: { Type: :Action, S: :URI, URI: url } } ) From df5c4e4210aac79e0d49c394ad93fa94d2f5ae40 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Tue, 9 Sep 2025 19:29:09 +0300 Subject: [PATCH 03/11] fix email 2fa resubmit --- app/views/start_form/email_verification.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/start_form/email_verification.html.erb b/app/views/start_form/email_verification.html.erb index 445613c0..70983e8d 100644 --- a/app/views/start_form/email_verification.html.erb +++ b/app/views/start_form/email_verification.html.erb @@ -25,6 +25,7 @@ <%= form_for '', url: start_form_path(@template.slug), method: :put, html: { class: 'space-y-4', id: 'code_form' } do |f| %>
+ <%= f.hidden_field 'resubmit', value: params[:resubmit] %> <%= f.hidden_field 'submitter[name]', value: params[:name] || @submitter&.name %> <%= f.hidden_field 'submitter[email]', value: params[:email] || @submitter&.email %> <%= f.hidden_field 'submitter[phone]', value: params[:phone] || @submitter&.phone %> From b58ce1b571f4b6de596affb4b68f3e3e3ec1a398 Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Tue, 9 Sep 2025 18:20:26 +0300 Subject: [PATCH 04/11] add translations --- config/locales/i18n.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/config/locales/i18n.yml b/config/locales/i18n.yml index e43464fc..581b94c0 100644 --- a/config/locales/i18n.yml +++ b/config/locales/i18n.yml @@ -805,6 +805,9 @@ en: &en current_password: Current password dont_remember_your_current_password_click_here_to_reset_it_html: 'Don''t remember your current password? to reset it.' an_email_with_password_reset_instructions_has_been_sent: An email with password reset instructions has been sent. + api_key_access_code: API key access code + use_otp_code_to_access_the_api_key_html: Use %{code} code to access the API key. + please_reply_to_this_email_if_you_dont_recognize_this_request: Please reply to this email if you don't recognize this request. submission_sources: api: API bulk: Bulk Send @@ -1695,6 +1698,9 @@ es: &es current_password: Contraseña actual dont_remember_your_current_password_click_here_to_reset_it_html: '¿No recuerdas tu contraseña actual? para restablecerla.' an_email_with_password_reset_instructions_has_been_sent: Se enviará un correo electrónico con las instrucciones para restablecer tu contraseña en unos minutos. + api_key_access_code: Código de acceso de la clave API + use_otp_code_to_access_the_api_key_html: Usa el código %{code} para acceder a la clave API. + please_reply_to_this_email_if_you_dont_recognize_this_request: Responde a este correo si no reconoces esta solicitud. submission_sources: api: API bulk: Envío masivo @@ -2586,6 +2592,9 @@ it: &it current_password: Password attuale dont_remember_your_current_password_click_here_to_reset_it_html: 'Non ricordi la tua password attuale? per reimpostarla.' an_email_with_password_reset_instructions_has_been_sent: Un'email con le istruzioni per reimpostare la password ti è stata inviata e arriverà entro pochi minuti. + api_key_access_code: Codice di accesso della chiave API + use_otp_code_to_access_the_api_key_html: Usa il codice %{code} per accedere alla chiave API. + please_reply_to_this_email_if_you_dont_recognize_this_request: Rispondi a questa email se non riconosci questa richiesta. submission_sources: api: API bulk: Invio massivo @@ -3480,6 +3489,9 @@ fr: &fr current_password: Mot de passe actuel dont_remember_your_current_password_click_here_to_reset_it_html: 'Vous ne vous souvenez plus de votre mot de passe actuel ? pour le réinitialiser.' an_email_with_password_reset_instructions_has_been_sent: Un e-mail contenant les instructions pour réinitialiser votre mot de passe vous sera envoyé dans quelques minutes. + api_key_access_code: Code d'accès de la clé API + use_otp_code_to_access_the_api_key_html: Utilisez le code %{code} pour accéder à la clé API. + please_reply_to_this_email_if_you_dont_recognize_this_request: Veuillez répondre à cet e-mail si vous ne reconnaissez pas cette demande. submission_sources: api: API bulk: Envoi en masse @@ -4372,6 +4384,9 @@ pt: &pt current_password: Senha atual dont_remember_your_current_password_click_here_to_reset_it_html: 'Não se lembra da sua senha atual? para redefini-la.' an_email_with_password_reset_instructions_has_been_sent: Um e-mail com instruções para redefinir sua senha será enviado em alguns minutos. + api_key_access_code: Código de acesso da chave API + use_otp_code_to_access_the_api_key_html: Use o código %{code} para acessar a chave API. + please_reply_to_this_email_if_you_dont_recognize_this_request: Responda a este e-mail se você não reconhecer esta solicitação. submission_sources: api: API bulk: Envio em massa @@ -5264,6 +5279,9 @@ de: &de current_password: Aktuelles Passwort dont_remember_your_current_password_click_here_to_reset_it_html: 'Sie erinnern sich nicht an Ihr aktuelles Passwort? , um es zurückzusetzen.' an_email_with_password_reset_instructions_has_been_sent: Eine E-Mail mit Anweisungen zum Zurücksetzen Ihres Passworts wurde Ihnen in wenigen Minuten zugesendet. + api_key_access_code: API-Schlüssel-Zugangscode + use_otp_code_to_access_the_api_key_html: Verwenden Sie den Code %{code}, um auf den API-Schlüssel zuzugreifen. + please_reply_to_this_email_if_you_dont_recognize_this_request: Bitte antworten Sie auf diese E-Mail, wenn Sie diese Anfrage nicht erkennen. submission_sources: api: API bulk: Massenversand From 8e8e5e0e294e73bd7099a55a9a9a8741c08d3c19 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Fri, 12 Sep 2025 12:17:26 +0300 Subject: [PATCH 05/11] add template variables --- app/controllers/api/submissions_controller.rb | 1 + app/models/submission.rb | 4 +++ app/models/template.rb | 34 ++++++++++--------- .../20250912090605_add_template_variables.rb | 9 +++++ db/schema.rb | 5 ++- lib/submissions.rb | 1 + lib/submissions/create_from_submitters.rb | 4 ++- lib/submissions/serialize_for_api.rb | 1 + lib/submitters/serialize_for_webhook.rb | 4 +-- spec/requests/submissions_spec.rb | 2 ++ 10 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 db/migrate/20250912090605_add_template_variables.rb diff --git a/app/controllers/api/submissions_controller.rb b/app/controllers/api/submissions_controller.rb index 32b51c17..193226df 100644 --- a/app/controllers/api/submissions_controller.rb +++ b/app/controllers/api/submissions_controller.rb @@ -184,6 +184,7 @@ module Api :send_email, :send_sms, :bcc_completed, :completed_redirect_url, :reply_to, :go_to_last, :require_phone_2fa, :expire_at, :name, { + variables: {}, message: %i[subject body], submitters: [[:send_email, :send_sms, :completed_redirect_url, :uuid, :name, :email, :role, :completed, :phone, :application_key, :external_id, :reply_to, :go_to_last, diff --git a/app/models/submission.rb b/app/models/submission.rb index 351bcfa5..04a7ad85 100644 --- a/app/models/submission.rb +++ b/app/models/submission.rb @@ -15,6 +15,8 @@ # template_fields :text # template_schema :text # template_submitters :text +# variables :text +# variables_schema :text # created_at :datetime not null # updated_at :datetime not null # account_id :bigint not null @@ -50,6 +52,8 @@ class Submission < ApplicationRecord serialize :template_fields, coder: JSON serialize :template_schema, coder: JSON serialize :template_submitters, coder: JSON + serialize :variables_schema, coder: JSON + serialize :variables, coder: JSON serialize :preferences, coder: JSON attribute :source, :string, default: 'link' diff --git a/app/models/template.rb b/app/models/template.rb index a03bd5bc..c21e7a42 100644 --- a/app/models/template.rb +++ b/app/models/template.rb @@ -4,22 +4,23 @@ # # Table name: templates # -# id :bigint not null, primary key -# archived_at :datetime -# fields :text not null -# name :string not null -# preferences :text not null -# schema :text not null -# shared_link :boolean default(FALSE), not null -# slug :string not null -# source :text not null -# submitters :text not null -# created_at :datetime not null -# updated_at :datetime not null -# account_id :bigint not null -# author_id :bigint not null -# external_id :string -# folder_id :bigint not null +# id :bigint not null, primary key +# archived_at :datetime +# fields :text not null +# name :string not null +# preferences :text not null +# schema :text not null +# shared_link :boolean default(FALSE), not null +# slug :string not null +# source :text not null +# submitters :text not null +# variables_schema :text +# created_at :datetime not null +# updated_at :datetime not null +# account_id :bigint not null +# author_id :bigint not null +# external_id :string +# folder_id :bigint not null # # Indexes # @@ -57,6 +58,7 @@ class Template < ApplicationRecord serialize :preferences, coder: JSON serialize :fields, coder: JSON + serialize :variables_schema, coder: JSON serialize :schema, coder: JSON serialize :submitters, coder: JSON diff --git a/db/migrate/20250912090605_add_template_variables.rb b/db/migrate/20250912090605_add_template_variables.rb new file mode 100644 index 00000000..346762cd --- /dev/null +++ b/db/migrate/20250912090605_add_template_variables.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddTemplateVariables < ActiveRecord::Migration[8.0] + def change + add_column :templates, :variables_schema, :text + add_column :submissions, :variables_schema, :text + add_column :submissions, :variables, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index 9b5ee95b..6f4e7406 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2025_09_01_110606) do +ActiveRecord::Schema[8.0].define(version: 2025_09_12_090605) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" enable_extension "plpgsql" @@ -305,6 +305,8 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_01_110606) do t.bigint "account_id", null: false t.datetime "expire_at" t.text "name" + t.text "variables_schema" + t.text "variables" t.index ["account_id", "id"], name: "index_submissions_on_account_id_and_id" t.index ["account_id", "template_id", "id"], name: "index_submissions_on_account_id_and_template_id_and_id", where: "(archived_at IS NULL)" t.index ["account_id", "template_id", "id"], name: "index_submissions_on_account_id_and_template_id_and_id_archived", where: "(archived_at IS NOT NULL)" @@ -389,6 +391,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_01_110606) do t.string "external_id" t.text "preferences", null: false t.boolean "shared_link", default: false, null: false + t.text "variables_schema" t.index ["account_id", "folder_id", "id"], name: "index_templates_on_account_id_and_folder_id_and_id", where: "(archived_at IS NULL)" t.index ["account_id", "id"], name: "index_templates_on_account_id_and_id_archived", where: "(archived_at IS NOT NULL)" t.index ["account_id"], name: "index_templates_on_account_id" diff --git a/lib/submissions.rb b/lib/submissions.rb index f2afe428..c76d284d 100644 --- a/lib/submissions.rb +++ b/lib/submissions.rb @@ -70,6 +70,7 @@ module Submissions def update_template_fields!(submission) submission.template_fields = submission.template.fields + submission.variables_schema = submission.template.variables_schema submission.template_schema = submission.template.schema submission.template_submitters = submission.template.submitters if submission.template_submitters.blank? diff --git a/lib/submissions/create_from_submitters.rb b/lib/submissions/create_from_submitters.rb index acb75349..6d5e78c9 100644 --- a/lib/submissions/create_from_submitters.rb +++ b/lib/submissions/create_from_submitters.rb @@ -22,6 +22,7 @@ module Submissions account_id: user.account_id, preferences: set_submission_preferences, name: with_template ? attrs[:name] : (attrs[:name] || template.name), + variables: attrs[:variables] || {}, expire_at:, template_submitters: [], submitters_order:) @@ -139,8 +140,9 @@ module Submissions end if template_fields != (submission.template_fields || submission.template.fields) || - submitters_attrs.any? { |e| e[:completed].present? } || !with_template + submitters_attrs.any? { |e| e[:completed].present? } || !with_template || submission.variables.present? submission.template_fields = template_fields + submission.variables_schema = submission.template.variables_schema if submission.variables_schema.blank? submission.template_schema = submission.template.schema if submission.template_schema.blank? end diff --git a/lib/submissions/serialize_for_api.rb b/lib/submissions/serialize_for_api.rb index 616803cf..d06bbb42 100644 --- a/lib/submissions/serialize_for_api.rb +++ b/lib/submissions/serialize_for_api.rb @@ -25,6 +25,7 @@ module Submissions json = submission.as_json(SERIALIZE_PARAMS) + json['variables'] = (submission.variables || {}).as_json json['created_by_user'] ||= nil if with_events diff --git a/lib/submitters/serialize_for_webhook.rb b/lib/submitters/serialize_for_webhook.rb index 0f9cb4a2..3d987d5a 100644 --- a/lib/submitters/serialize_for_webhook.rb +++ b/lib/submitters/serialize_for_webhook.rb @@ -35,8 +35,7 @@ module Submitters 'audit_log_url' => submitter.submission.audit_log_url(expires_at:), 'submission_url' => r.submissions_preview_url(submission.slug, **Docuseal.default_url_options), 'template' => submission.template.as_json( - only: %i[id name external_id created_at updated_at], - methods: %i[folder_name] + only: %i[id name external_id created_at updated_at], methods: %i[folder_name] ), 'submission' => { 'id' => submission.id, @@ -44,6 +43,7 @@ module Submitters 'combined_document_url' => submission.combined_document_url(expires_at:), 'status' => build_submission_status(submission), 'url' => r.submissions_preview_url(submission.slug, **Docuseal.default_url_options), + 'variables' => (submission.variables || {}).as_json, 'created_at' => submission.created_at.as_json }) end diff --git a/spec/requests/submissions_spec.rb b/spec/requests/submissions_spec.rb index 468b5715..82698613 100644 --- a/spec/requests/submissions_spec.rb +++ b/spec/requests/submissions_spec.rb @@ -298,6 +298,7 @@ describe 'Submission API' do completed_at: nil, created_at: submission.created_at, updated_at: submission.updated_at, + variables: {}, archived_at: nil, status: 'pending', submitters:, @@ -358,6 +359,7 @@ describe 'Submission API' do completed_at: nil, created_at: submission.created_at, updated_at: submission.updated_at, + variables: {}, archived_at: nil, submitters:, template: { From 30115fc0dced15ff9664a8667a055699026fa73d Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Thu, 11 Sep 2025 18:30:39 +0300 Subject: [PATCH 06/11] adjust login OTP form --- app/views/devise/sessions/otp.html.erb | 25 ++++++++++++++++--------- config/locales/i18n.yml | 26 ++++++++++++++++++++++++++ spec/factories/email_events.rb | 12 ++++++++++++ 3 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 spec/factories/email_events.rb diff --git a/app/views/devise/sessions/otp.html.erb b/app/views/devise/sessions/otp.html.erb index 8e8a07e7..ace1d8d7 100644 --- a/app/views/devise/sessions/otp.html.erb +++ b/app/views/devise/sessions/otp.html.erb @@ -2,15 +2,22 @@

<%= t('sign_in') %>

- <%= form_for(resource, as: resource_name, html: { class: 'space-y-6' }, data: { turbo: params[:redir].blank? }, url: session_path(resource_name)) do |f| %> - <%= f.hidden_field :email %> - <%= f.hidden_field :password %> - <% if params[:redir].present? %> - <%= hidden_field_tag :redir, params[:redir] %> - <% end %> - <%= render 'otp_form', **local_assigns %> -
- <%= f.button button_title(title: t('sign_in'), disabled_with: t('signing_in')), class: 'base-button' %> + <% if local_assigns[:access_error].present? %> +
+ <%= svg_icon('x_circle', class: 'w-6 h-6 text-red-500') %> + <%= local_assigns[:access_error] %>
+ <% else %> + <%= form_for(resource, as: resource_name, html: { class: 'space-y-6' }, data: { turbo: params[:redir].blank? }, url: session_path(resource_name)) do |f| %> + <%= f.hidden_field :email %> + <%= f.hidden_field :password %> + <% if params[:redir].present? %> + <%= hidden_field_tag :redir, params[:redir] %> + <% end %> + <%= render 'otp_form', **local_assigns %> +
+ <%= f.button button_title(title: t('sign_in'), disabled_with: t('signing_in')), class: 'base-button' %> +
+ <% end %> <% end %>
diff --git a/config/locales/i18n.yml b/config/locales/i18n.yml index 581b94c0..cb6cdf24 100644 --- a/config/locales/i18n.yml +++ b/config/locales/i18n.yml @@ -808,6 +808,8 @@ en: &en api_key_access_code: API key access code use_otp_code_to_access_the_api_key_html: Use %{code} code to access the API key. please_reply_to_this_email_if_you_dont_recognize_this_request: Please reply to this email if you don't recognize this request. + your_user_account_has_been_archived_contact_your_administrator_to_restore_access_to_your_account: Your user account has been archived. Contact your administrator to restore access to your account. + your_email_could_not_be_reached_this_may_happen_if_there_was_a_typo_in_your_address_or_if_your_mailbox_is_not_available_please_contact_support_email_to_log_in: Your email could not be reached. This may happen if there was a typo in your address or if your mailbox is not available. Please contact support@docuseal.com to log in. submission_sources: api: API bulk: Bulk Send @@ -1701,6 +1703,8 @@ es: &es api_key_access_code: Código de acceso de la clave API use_otp_code_to_access_the_api_key_html: Usa el código %{code} para acceder a la clave API. please_reply_to_this_email_if_you_dont_recognize_this_request: Responde a este correo si no reconoces esta solicitud. + your_user_account_has_been_archived_contact_your_administrator_to_restore_access_to_your_account: Tu cuenta de usuario ha sido archivada. Contacta a tu administrador para restaurar el acceso a tu cuenta. + your_email_could_not_be_reached_this_may_happen_if_there_was_a_typo_in_your_address_or_if_your_mailbox_is_not_available_please_contact_support_email_to_log_in: No se pudo acceder a tu correo electrónico. Esto puede ocurrir si hubo un error tipográfico en tu dirección o si tu buzón no está disponible. Por favor, contacta a support@docuseal.com para iniciar sesión. submission_sources: api: API bulk: Envío masivo @@ -2595,6 +2599,8 @@ it: &it api_key_access_code: Codice di accesso della chiave API use_otp_code_to_access_the_api_key_html: Usa il codice %{code} per accedere alla chiave API. please_reply_to_this_email_if_you_dont_recognize_this_request: Rispondi a questa email se non riconosci questa richiesta. + your_user_account_has_been_archived_contact_your_administrator_to_restore_access_to_your_account: Il tuo account utente è stato archiviato. Contatta il tuo amministratore per ripristinare l'accesso al tuo account. + your_email_could_not_be_reached_this_may_happen_if_there_was_a_typo_in_your_address_or_if_your_mailbox_is_not_available_please_contact_support_email_to_log_in: Non è stato possibile raggiungere la tua email. Questo può accadere se c'è stato un errore di digitazione nell'indirizzo o se la tua casella di posta non è disponibile. Contatta support@docuseal.com per accedere. submission_sources: api: API bulk: Invio massivo @@ -3492,6 +3498,8 @@ fr: &fr api_key_access_code: Code d'accès de la clé API use_otp_code_to_access_the_api_key_html: Utilisez le code %{code} pour accéder à la clé API. please_reply_to_this_email_if_you_dont_recognize_this_request: Veuillez répondre à cet e-mail si vous ne reconnaissez pas cette demande. + your_user_account_has_been_archived_contact_your_administrator_to_restore_access_to_your_account: Votre compte utilisateur a été archivé. Contactez votre administrateur pour rétablir l'accès à votre compte. + your_email_could_not_be_reached_this_may_happen_if_there_was_a_typo_in_your_address_or_if_your_mailbox_is_not_available_please_contact_support_email_to_log_in: Votre e-mail n'a pas pu être atteint. Cela peut arriver s'il y a eu une faute de frappe dans votre adresse ou si votre boîte aux lettres n'est pas disponible. Veuillez contacter support@docuseal.com pour vous connecter. submission_sources: api: API bulk: Envoi en masse @@ -4387,6 +4395,8 @@ pt: &pt api_key_access_code: Código de acesso da chave API use_otp_code_to_access_the_api_key_html: Use o código %{code} para acessar a chave API. please_reply_to_this_email_if_you_dont_recognize_this_request: Responda a este e-mail se você não reconhecer esta solicitação. + your_user_account_has_been_archived_contact_your_administrator_to_restore_access_to_your_account: Sua conta de usuário foi arquivada. Entre em contato com o administrador para restaurar o acesso à sua conta. + your_email_could_not_be_reached_this_may_happen_if_there_was_a_typo_in_your_address_or_if_your_mailbox_is_not_available_please_contact_support_email_to_log_in: Seu e-mail não pôde ser acessado. Isso pode acontecer se houve um erro de digitação no endereço ou se sua caixa de correio não estiver disponível. Entre em contato com support@docuseal.com para fazer login. submission_sources: api: API bulk: Envio em massa @@ -5475,6 +5485,8 @@ pl: email_verification: Weryfikacja e-mail your_verification_code_to_access_the_name: 'Twój kod weryfikacyjny do uzyskania dostępu do "%{name}":' please_reply_to_this_email_if_you_didnt_request_this: Odpowiedz na ten e-mail, jeśli nie prosiłeś o to. + your_user_account_has_been_archived_contact_your_administrator_to_restore_access_to_your_account: Twoje konto użytkownika zostało zarchiwizowane. Skontaktuj się z administratorem, aby przywrócić dostęp do konta. + your_email_could_not_be_reached_this_may_happen_if_there_was_a_typo_in_your_address_or_if_your_mailbox_is_not_available_please_contact_support_email_to_log_in: Nie udało się uzyskać dostępu do Twojego adresu e-mail. Może to być spowodowane literówką w adresie lub niedostępnością skrzynki. Skontaktuj się z support@docuseal.com, aby się zalogować. uk: require_phone_2fa_to_open: Вимагати двофакторну автентифікацію через телефон для відкриття @@ -5564,6 +5576,8 @@ uk: email_verification: Підтвердження електронної пошти your_verification_code_to_access_the_name: 'Ваш код доступу до "%{name}":' please_reply_to_this_email_if_you_didnt_request_this: Відповідайте на цей лист, якщо ви цього не запитували. + your_user_account_has_been_archived_contact_your_administrator_to_restore_access_to_your_account: Ваш обліковий запис було архівовано. Зверніться до адміністратора, щоб відновити доступ. + your_email_could_not_be_reached_this_may_happen_if_there_was_a_typo_in_your_address_or_if_your_mailbox_is_not_available_please_contact_support_email_to_log_in: Не вдалося отримати доступ до вашої електронної пошти. Це може статися, якщо була допущена помилка в адресі або ваша скринька недоступна. Зверніться до support@docuseal.com, щоб увійти. cs: require_phone_2fa_to_open: Vyžadovat otevření pomocí telefonního 2FA @@ -5653,6 +5667,8 @@ cs: email_verification: Ověření e-mailu your_verification_code_to_access_the_name: 'Váš ověřovací kód pro přístup k "%{name}":' please_reply_to_this_email_if_you_didnt_request_this: Odpovězte na tento e-mail, pokud jste o to nežádali. + your_user_account_has_been_archived_contact_your_administrator_to_restore_access_to_your_account: Váš uživatelský účet byl archivován. Kontaktujte svého administrátora pro obnovení přístupu. + your_email_could_not_be_reached_this_may_happen_if_there_was_a_typo_in_your_address_or_if_your_mailbox_is_not_available_please_contact_support_email_to_log_in: Nepodařilo se dosáhnout na váš e-mail. To se může stát, pokud je v adrese překlep nebo vaše schránka není dostupná. Kontaktujte support@docuseal.com pro přihlášení. he: require_phone_2fa_to_open: דרוש אימות דו-שלבי באמצעות טלפון לפתיחה @@ -5742,6 +5758,8 @@ he: email_verification: 'אימות דוא"ל' your_verification_code_to_access_the_name: 'קוד האימות שלך לגישה ל-%{name}:' please_reply_to_this_email_if_you_didnt_request_this: 'השב למייל זה אם לא ביקשת זאת.' + your_user_account_has_been_archived_contact_your_administrator_to_restore_access_to_your_account: החשבון שלך הועבר לארכיון. פנה למנהל המערכת כדי לשחזר את הגישה. + your_email_could_not_be_reached_this_may_happen_if_there_was_a_typo_in_your_address_or_if_your_mailbox_is_not_available_please_contact_support_email_to_log_in: לא ניתן היה לגשת לדוא"ל שלך. ייתכן שזה קרה עקב שגיאת כתיב בכתובת או אם תיבת הדואר אינה זמינה. אנא פנה ל־support@docuseal.com כדי להתחבר. nl: require_phone_2fa_to_open: Vereis telefoon 2FA om te openen @@ -5831,6 +5849,8 @@ nl: email_verification: E-mailverificatie your_verification_code_to_access_the_name: 'Je verificatiecode voor toegang tot "%{name}":' please_reply_to_this_email_if_you_didnt_request_this: Reageer op deze e-mail als je dit niet hebt aangevraagd. + your_user_account_has_been_archived_contact_your_administrator_to_restore_access_to_your_account: Je gebruikersaccount is gearchiveerd. Neem contact op met je beheerder om de toegang te herstellen. + your_email_could_not_be_reached_this_may_happen_if_there_was_a_typo_in_your_address_or_if_your_mailbox_is_not_available_please_contact_support_email_to_log_in: Je e-mailadres kon niet worden bereikt. Dit kan gebeuren door een typefout in je adres of als je mailbox niet beschikbaar is. Neem contact op met support@docuseal.com om in te loggen. ar: require_phone_2fa_to_open: "تطلب فتح عبر تحقق الهاتف ذو العاملين" @@ -5920,6 +5940,8 @@ ar: email_verification: 'التحقق من البريد الإلكتروني' your_verification_code_to_access_the_name: 'رمز التحقق الخاص بك للوصول إلى "%{name}":' please_reply_to_this_email_if_you_didnt_request_this: 'يرجى الرد على هذا البريد إذا لم تطلب ذلك.' + your_user_account_has_been_archived_contact_your_administrator_to_restore_access_to_your_account: تم أرشفة حسابك. يرجى التواصل مع المسؤول لاستعادة الوصول إلى حسابك. + your_email_could_not_be_reached_this_may_happen_if_there_was_a_typo_in_your_address_or_if_your_mailbox_is_not_available_please_contact_support_email_to_log_in: تعذّر الوصول إلى بريدك الإلكتروني. قد يحدث هذا في حال وجود خطأ في العنوان أو إذا كانت صندوق البريد غير متاح. يرجى التواصل مع support@docuseal.com لتسجيل الدخول. ko: require_phone_2fa_to_open: 휴대폰 2FA를 열 때 요구함 @@ -6009,6 +6031,8 @@ ko: email_verification: 이메일 인증 your_verification_code_to_access_the_name: '"%{name}"에 액세스하기 위한 인증 코드:' please_reply_to_this_email_if_you_didnt_request_this: 요청하지 않았다면 이 이메일에 회신하세요. + your_user_account_has_been_archived_contact_your_administrator_to_restore_access_to_your_account: 사용자 계정이 보관되었습니다. 계정 접근을 복원하려면 관리자에게 문의하세요. + your_email_could_not_be_reached_this_may_happen_if_there_was_a_typo_in_your_address_or_if_your_mailbox_is_not_available_please_contact_support_email_to_log_in: 이메일에 접근할 수 없습니다. 주소에 오타가 있거나 메일박스가 사용 불가능한 경우 발생할 수 있습니다. 로그인하려면 support@docuseal.com에 문의하세요. ja: require_phone_2fa_to_open: 電話による2段階認証が必要です @@ -6098,6 +6122,8 @@ ja: email_verification: メール認証 your_verification_code_to_access_the_name: '"%{name}"へのアクセスコード:' please_reply_to_this_email_if_you_didnt_request_this: このリクエストを行っていない場合は、このメールに返信してください。 + your_user_account_has_been_archived_contact_your_administrator_to_restore_access_to_your_account: あなたのユーザーアカウントはアーカイブされました。アクセスを復元するには管理者に連絡してください。 + your_email_could_not_be_reached_this_may_happen_if_there_was_a_typo_in_your_address_or_if_your_mailbox_is_not_available_please_contact_support_email_to_log_in: メールにアクセスできませんでした。アドレスの入力ミスやメールボックスが利用できない場合に発生することがあります。ログインするには support@docuseal.com に連絡してください。 en-US: <<: *en diff --git a/spec/factories/email_events.rb b/spec/factories/email_events.rb new file mode 100644 index 00000000..37b7aa5c --- /dev/null +++ b/spec/factories/email_events.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +FactoryBot.define do + factory :email_event do + account + event_type { 'bounce' } + message_id { SecureRandom.uuid } + tag { 'submitter_invitation' } + email { Faker::Internet.email } + event_datetime { 1.hour.ago } + end +end From 74ed9a50405ed06b4d67beededfc36eb66ddc059 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sat, 13 Sep 2025 11:23:34 +0300 Subject: [PATCH 07/11] update docs --- docs/api/csharp.md | 740 ++++++++++++- docs/api/go.md | 763 +++++++++++++- docs/api/java.md | 739 ++++++++++++- docs/api/javascript.md | 756 +++++++++++++- docs/api/nodejs.md | 762 +++++++++++++- docs/api/php.md | 754 +++++++++++++- docs/api/python.md | 757 +++++++++++++- docs/api/ruby.md | 757 +++++++++++++- docs/api/shell.md | 739 ++++++++++++- docs/api/typescript.md | 756 +++++++++++++- docs/embedding/form-builder-angular.md | 11 + docs/embedding/form-builder-javascript.md | 11 + docs/embedding/form-builder-react.md | 11 + docs/embedding/form-builder-vue.md | 11 + docs/embedding/signing-form-javascript.md | 8 +- docs/openapi.json | 1145 ++++++++++++++++++++- docs/webhooks/form-webhook.md | 4 + docs/webhooks/submission-webhook.md | 4 + 18 files changed, 8316 insertions(+), 412 deletions(-) diff --git a/docs/api/csharp.md b/docs/api/csharp.md index 8df5aeb5..2d4d56a7 100644 --- a/docs/api/csharp.md +++ b/docs/api/csharp.md @@ -523,6 +523,15 @@ var response = client.Execute(request); "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -598,14 +607,45 @@ var response = client.Execute(request); "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1025,10 +1065,6 @@ var response = client.Execute(request); "type": "string", "description": "Specify Reply-To address to use in the notification emails." }, - "completed_redirect_url": { - "type": "string", - "description": "Submitter specific URL to redirect to after the submission completion." - }, "completed": { "type": "boolean", "description": "Pass `true` to mark submitter as completed and auto-signed via API." @@ -1038,6 +1074,15 @@ var response = client.Execute(request); "description": "Metadata object with additional submitter information.", "example": "{ \"customField\": \"value\" }" }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -1105,14 +1150,45 @@ var response = client.Execute(request); "type": "boolean", "description": "Set `true` to make the field required." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1775,6 +1851,46 @@ var response = client.Execute(request); "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -2253,7 +2369,7 @@ var response = client.Execute(request); ### Create a submission from PDF -The API endpoint provides the functionality to create one-off submission request from a PDF or DOCX file. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form +The API endpoint provides the functionality to create one-off submission request from a PDF. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form ```csharp @@ -2531,6 +2647,15 @@ var response = client.Execute(request); "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -2593,14 +2718,45 @@ var response = client.Execute(request); "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -2946,6 +3102,15 @@ var response = client.Execute(request); "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -3008,14 +3173,45 @@ var response = client.Execute(request); "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3323,6 +3519,46 @@ var response = client.Execute(request); "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -3439,3 +3675,433 @@ var response = client.Execute(request); } ``` +### Create a submission from DOCX + +The API endpoint provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use [[variable_name]] text tags to define dynamic content variables in the document. See https://www.docuseal.com/examples/demo_template.docx for the specific text variable syntax, including dynamic content tables and list. You can also use the {{signature}} fillable field syntax to define fillable fields, as in a PDF.
Related Guides
Use embedded text field tags to create a fillable form + +```csharp +var client = new RestClient("https://api.docuseal.com/submissions/docx"); +var request = new RestRequest("", Method.Post); +request.AddHeader("X-Auth-Token", "API_KEY"); +request.AddHeader("content-type", "application/json"); +request.AddParameter("application/json", "{\"name\":\"Test Submission Document\",\"variables\":{\"variable_name\":\"value\"},\"documents\":[{\"name\":\"string\",\"file\":\"base64\"}],\"submitters\":[{\"role\":\"First Party\",\"email\":\"john.doe@example.com\"}]}", ParameterType.RequestBody); +var response = client.Execute(request); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from DOCX", + "operationId": "createSubmissionFromDocx", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "documents", + "submitters" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document submission.", + "example": "Test Submission Document" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "variables": { + "type": "object", + "description": "Dynamic content variables object", + "example": { + "variable_name": "value" + } + }, + "order": { + "type": "string", + "description": "Pass 'random' to send signature request emails to all parties right away. The order is 'preserved' by default so the second party will receive a signature request email only after the document is signed by the first party.", + "default": "preserved", + "enum": [ + "preserved", + "random" + ] + }, + "completed_redirect_url": { + "type": "string", + "description": "Specify URL to redirect to after the submission completion." + }, + "bcc_completed": { + "type": "string", + "description": "Specify BCC address to send signed documents to after the completion." + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails." + }, + "expire_at": { + "type": "string", + "description": "Specify the expiration date and time after which the submission becomes unavailable for signature.", + "example": "2024-09-01 12:00:00 UTC" + }, + "template_ids": { + "type": "array", + "description": "An optional array of template IDs to use in the submission along with the provided documents. This can be used to create multi-document submissions when some of the required documents exist within templates.", + "items": { + "type": "integer", + "description": "The ID of the template to use for the submission." + } + }, + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "file" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL." + }, + "position": { + "type": "integer", + "description": "Document position in the submission. If not specified, the document will be added in the order it appears in the documents array." + } + } + } + }, + "submitters": { + "type": "array", + "description": "The list of submitters for the submission.", + "items": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the submitter." + }, + "role": { + "type": "string", + "description": "The role name or title of the submitter.", + "example": "First Party" + }, + "email": { + "type": "string", + "description": "The email address of the submitter.", + "format": "email", + "example": "john.doe@example.com" + }, + "phone": { + "type": "string", + "description": "The phone number of the submitter, formatted according to the E.164 standard.", + "example": "+1234567890" + }, + "values": { + "type": "object", + "description": "An object with pre-filled values for the submission. Use field names for keys of the object. For more configurations see `fields` param." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this submitter within your app." + }, + "completed": { + "type": "boolean", + "description": "Pass `true` to mark submitter as completed and auto-signed via API." + }, + "metadata": { + "type": "object", + "description": "Metadata object with additional submitter information.", + "example": "{ \"customField\": \"value\" }" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending only for this submitter.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails for this submitter." + }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, + "fields": { + "type": "array", + "description": "A list of configurations for document form fields.", + "items": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Document field name.", + "example": "First Name" + }, + "default_value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Default value of the field. Use base64 encoded file or a public URL to the image file to set default signature or image fields.", + "example": "Acme" + }, + "readonly": { + "type": "boolean", + "description": "Set `true` to make it impossible for the submitter to edit predefined field value.", + "default": false + }, + "required": { + "type": "boolean", + "description": "Set `true` to make the field required." + }, + "title": { + "type": "string", + "description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown." + }, + "description": { + "type": "string", + "description": "Field description displayed on the signing form. Supports Markdown." + }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, + "preferences": { + "type": "object", + "properties": { + "font_size": { + "type": "integer", + "description": "Font size of the field value in pixels.", + "example": 12 + }, + "font_type": { + "type": "string", + "description": "Font type of the field value.", + "enum": [ + "bold", + "italic", + "bold_italic" + ] + }, + "font": { + "type": "string", + "description": "Font family of the field value.", + "enum": [ + "Times", + "Helvetica", + "Courier" + ] + }, + "color": { + "type": "string", + "description": "Font color of the field value.", + "enum": [ + "black", + "white", + "blue" + ], + "default": "black" + }, + "align": { + "type": "string", + "description": "Horizontal alignment of the field text value.", + "enum": [ + "left", + "center", + "right" + ], + "default": "left" + }, + "valign": { + "type": "string", + "description": "Vertical alignment of the field text value.", + "enum": [ + "top", + "center", + "bottom" + ], + "default": "center" + }, + "format": { + "type": "string", + "description": "The data format for different field types.
- Date field: accepts formats such as DD/MM/YYYY (default: MM/DD/YYYY).
- Signature field: accepts drawn, typed, drawn_or_typed (default), or upload.
- Number field: accepts currency formats such as usd, eur, gbp.", + "example": "DD/MM/YYYY" + }, + "price": { + "type": "number", + "description": "Price value of the payment field. Only for payment fields.", + "example": 99.99 + }, + "currency": { + "type": "string", + "description": "Currency value of the payment field. Only for payment fields.", + "enum": [ + "USD", + "EUR", + "GBP", + "CAD", + "AUD" + ], + "default": "USD" + }, + "mask": { + "description": "Set `true` to make sensitive data masked on the document.", + "oneOf": [ + { + "type": "integer" + }, + { + "type": "boolean" + } + ], + "default": false + } + } + } + } + } + }, + "roles": { + "type": "array", + "description": "A list of roles for the submitter. Use this param to merge multiple roles into one submitter.", + "items": { + "type": "string" + } + } + } + } + }, + "message": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "description": "Custom signature request email subject." + }, + "body": { + "type": "string", + "description": "Custom signature request email body. Can include the following variables: {{submission.name}}, {{submitter.link}}, {{account.name}}." + } + } + }, + "merge_documents": { + "type": "boolean", + "description": "Set `true` to merge the documents into a single PDF file.", + "default": false + }, + "remove_tags": { + "type": "boolean", + "description": "Pass `false` to disable the removal of {{text}} tags from the PDF. This can be used along with transparent text tags for faster and more robust PDF processing.", + "default": true + } + } + } + } + } + } +} +``` + diff --git a/docs/api/go.md b/docs/api/go.md index 83db964f..c0622ea8 100644 --- a/docs/api/go.md +++ b/docs/api/go.md @@ -653,6 +653,15 @@ func main() { "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -728,14 +737,45 @@ func main() { "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1285,10 +1325,6 @@ func main() { "type": "string", "description": "Specify Reply-To address to use in the notification emails." }, - "completed_redirect_url": { - "type": "string", - "description": "Submitter specific URL to redirect to after the submission completion." - }, "completed": { "type": "boolean", "description": "Pass `true` to mark submitter as completed and auto-signed via API." @@ -1298,6 +1334,15 @@ func main() { "description": "Metadata object with additional submitter information.", "example": "{ \"customField\": \"value\" }" }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -1365,14 +1410,45 @@ func main() { "type": "boolean", "description": "Set `true` to make the field required." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -2148,6 +2224,46 @@ func main() { "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -2672,7 +2788,7 @@ func main() { ### Create a submission from PDF -The API endpoint provides the functionality to create one-off submission request from a PDF or DOCX file. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form +The API endpoint provides the functionality to create one-off submission request from a PDF. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form ```go @@ -2973,6 +3089,15 @@ func main() { "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -3035,14 +3160,45 @@ func main() { "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3411,6 +3567,15 @@ func main() { "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -3473,14 +3638,45 @@ func main() { "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3811,6 +4007,46 @@ func main() { "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -3927,3 +4163,456 @@ func main() { } ``` +### Create a submission from DOCX + +The API endpoint provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use [[variable_name]] text tags to define dynamic content variables in the document. See https://www.docuseal.com/examples/demo_template.docx for the specific text variable syntax, including dynamic content tables and list. You can also use the {{signature}} fillable field syntax to define fillable fields, as in a PDF.
Related Guides
Use embedded text field tags to create a fillable form + +```go +package main + +import ( + "fmt" + "strings" + "net/http" + "io" +) + +func main() { + + url := "https://api.docuseal.com/submissions/docx" + + payload := strings.NewReader("{\"name\":\"Test Submission Document\",\"variables\":{\"variable_name\":\"value\"},\"documents\":[{\"name\":\"string\",\"file\":\"base64\"}],\"submitters\":[{\"role\":\"First Party\",\"email\":\"john.doe@example.com\"}]}") + + req, _ := http.NewRequest("POST", url, payload) + + req.Header.Add("X-Auth-Token", "API_KEY") + req.Header.Add("content-type", "application/json") + + res, _ := http.DefaultClient.Do(req) + + defer res.Body.Close() + body, _ := io.ReadAll(res.Body) + + fmt.Println(res) + fmt.Println(string(body)) + +} +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from DOCX", + "operationId": "createSubmissionFromDocx", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "documents", + "submitters" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document submission.", + "example": "Test Submission Document" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "variables": { + "type": "object", + "description": "Dynamic content variables object", + "example": { + "variable_name": "value" + } + }, + "order": { + "type": "string", + "description": "Pass 'random' to send signature request emails to all parties right away. The order is 'preserved' by default so the second party will receive a signature request email only after the document is signed by the first party.", + "default": "preserved", + "enum": [ + "preserved", + "random" + ] + }, + "completed_redirect_url": { + "type": "string", + "description": "Specify URL to redirect to after the submission completion." + }, + "bcc_completed": { + "type": "string", + "description": "Specify BCC address to send signed documents to after the completion." + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails." + }, + "expire_at": { + "type": "string", + "description": "Specify the expiration date and time after which the submission becomes unavailable for signature.", + "example": "2024-09-01 12:00:00 UTC" + }, + "template_ids": { + "type": "array", + "description": "An optional array of template IDs to use in the submission along with the provided documents. This can be used to create multi-document submissions when some of the required documents exist within templates.", + "items": { + "type": "integer", + "description": "The ID of the template to use for the submission." + } + }, + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "file" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL." + }, + "position": { + "type": "integer", + "description": "Document position in the submission. If not specified, the document will be added in the order it appears in the documents array." + } + } + } + }, + "submitters": { + "type": "array", + "description": "The list of submitters for the submission.", + "items": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the submitter." + }, + "role": { + "type": "string", + "description": "The role name or title of the submitter.", + "example": "First Party" + }, + "email": { + "type": "string", + "description": "The email address of the submitter.", + "format": "email", + "example": "john.doe@example.com" + }, + "phone": { + "type": "string", + "description": "The phone number of the submitter, formatted according to the E.164 standard.", + "example": "+1234567890" + }, + "values": { + "type": "object", + "description": "An object with pre-filled values for the submission. Use field names for keys of the object. For more configurations see `fields` param." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this submitter within your app." + }, + "completed": { + "type": "boolean", + "description": "Pass `true` to mark submitter as completed and auto-signed via API." + }, + "metadata": { + "type": "object", + "description": "Metadata object with additional submitter information.", + "example": "{ \"customField\": \"value\" }" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending only for this submitter.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails for this submitter." + }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, + "fields": { + "type": "array", + "description": "A list of configurations for document form fields.", + "items": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Document field name.", + "example": "First Name" + }, + "default_value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Default value of the field. Use base64 encoded file or a public URL to the image file to set default signature or image fields.", + "example": "Acme" + }, + "readonly": { + "type": "boolean", + "description": "Set `true` to make it impossible for the submitter to edit predefined field value.", + "default": false + }, + "required": { + "type": "boolean", + "description": "Set `true` to make the field required." + }, + "title": { + "type": "string", + "description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown." + }, + "description": { + "type": "string", + "description": "Field description displayed on the signing form. Supports Markdown." + }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, + "preferences": { + "type": "object", + "properties": { + "font_size": { + "type": "integer", + "description": "Font size of the field value in pixels.", + "example": 12 + }, + "font_type": { + "type": "string", + "description": "Font type of the field value.", + "enum": [ + "bold", + "italic", + "bold_italic" + ] + }, + "font": { + "type": "string", + "description": "Font family of the field value.", + "enum": [ + "Times", + "Helvetica", + "Courier" + ] + }, + "color": { + "type": "string", + "description": "Font color of the field value.", + "enum": [ + "black", + "white", + "blue" + ], + "default": "black" + }, + "align": { + "type": "string", + "description": "Horizontal alignment of the field text value.", + "enum": [ + "left", + "center", + "right" + ], + "default": "left" + }, + "valign": { + "type": "string", + "description": "Vertical alignment of the field text value.", + "enum": [ + "top", + "center", + "bottom" + ], + "default": "center" + }, + "format": { + "type": "string", + "description": "The data format for different field types.
- Date field: accepts formats such as DD/MM/YYYY (default: MM/DD/YYYY).
- Signature field: accepts drawn, typed, drawn_or_typed (default), or upload.
- Number field: accepts currency formats such as usd, eur, gbp.", + "example": "DD/MM/YYYY" + }, + "price": { + "type": "number", + "description": "Price value of the payment field. Only for payment fields.", + "example": 99.99 + }, + "currency": { + "type": "string", + "description": "Currency value of the payment field. Only for payment fields.", + "enum": [ + "USD", + "EUR", + "GBP", + "CAD", + "AUD" + ], + "default": "USD" + }, + "mask": { + "description": "Set `true` to make sensitive data masked on the document.", + "oneOf": [ + { + "type": "integer" + }, + { + "type": "boolean" + } + ], + "default": false + } + } + } + } + } + }, + "roles": { + "type": "array", + "description": "A list of roles for the submitter. Use this param to merge multiple roles into one submitter.", + "items": { + "type": "string" + } + } + } + } + }, + "message": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "description": "Custom signature request email subject." + }, + "body": { + "type": "string", + "description": "Custom signature request email body. Can include the following variables: {{submission.name}}, {{submitter.link}}, {{account.name}}." + } + } + }, + "merge_documents": { + "type": "boolean", + "description": "Set `true` to merge the documents into a single PDF file.", + "default": false + }, + "remove_tags": { + "type": "boolean", + "description": "Pass `false` to disable the removal of {{text}} tags from the PDF. This can be used along with transparent text tags for faster and more robust PDF processing.", + "default": true + } + } + } + } + } + } +} +``` + diff --git a/docs/api/java.md b/docs/api/java.md index ca3df371..83375022 100644 --- a/docs/api/java.md +++ b/docs/api/java.md @@ -517,6 +517,15 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/submissio "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -592,14 +601,45 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/submissio "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1013,10 +1053,6 @@ HttpResponse response = Unirest.put("https://api.docuseal.com/submitters "type": "string", "description": "Specify Reply-To address to use in the notification emails." }, - "completed_redirect_url": { - "type": "string", - "description": "Submitter specific URL to redirect to after the submission completion." - }, "completed": { "type": "boolean", "description": "Pass `true` to mark submitter as completed and auto-signed via API." @@ -1026,6 +1062,15 @@ HttpResponse response = Unirest.put("https://api.docuseal.com/submitters "description": "Metadata object with additional submitter information.", "example": "{ \"customField\": \"value\" }" }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -1093,14 +1138,45 @@ HttpResponse response = Unirest.put("https://api.docuseal.com/submitters "type": "boolean", "description": "Set `true` to make the field required." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1758,6 +1834,46 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -2234,7 +2350,7 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates ### Create a submission from PDF -The API endpoint provides the functionality to create one-off submission request from a PDF or DOCX file. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form +The API endpoint provides the functionality to create one-off submission request from a PDF. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form ```java @@ -2511,6 +2627,15 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/submissio "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -2573,14 +2698,45 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/submissio "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -2925,6 +3081,15 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/submissio "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -2987,14 +3152,45 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/submissio "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3301,6 +3497,46 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -3417,3 +3653,432 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates } ``` +### Create a submission from DOCX + +The API endpoint provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use [[variable_name]] text tags to define dynamic content variables in the document. See https://www.docuseal.com/examples/demo_template.docx for the specific text variable syntax, including dynamic content tables and list. You can also use the {{signature}} fillable field syntax to define fillable fields, as in a PDF.
Related Guides
Use embedded text field tags to create a fillable form + +```java +HttpResponse response = Unirest.post("https://api.docuseal.com/submissions/docx") + .header("X-Auth-Token", "API_KEY") + .header("content-type", "application/json") + .body("{\"name\":\"Test Submission Document\",\"variables\":{\"variable_name\":\"value\"},\"documents\":[{\"name\":\"string\",\"file\":\"base64\"}],\"submitters\":[{\"role\":\"First Party\",\"email\":\"john.doe@example.com\"}]}") + .asString(); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from DOCX", + "operationId": "createSubmissionFromDocx", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "documents", + "submitters" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document submission.", + "example": "Test Submission Document" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "variables": { + "type": "object", + "description": "Dynamic content variables object", + "example": { + "variable_name": "value" + } + }, + "order": { + "type": "string", + "description": "Pass 'random' to send signature request emails to all parties right away. The order is 'preserved' by default so the second party will receive a signature request email only after the document is signed by the first party.", + "default": "preserved", + "enum": [ + "preserved", + "random" + ] + }, + "completed_redirect_url": { + "type": "string", + "description": "Specify URL to redirect to after the submission completion." + }, + "bcc_completed": { + "type": "string", + "description": "Specify BCC address to send signed documents to after the completion." + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails." + }, + "expire_at": { + "type": "string", + "description": "Specify the expiration date and time after which the submission becomes unavailable for signature.", + "example": "2024-09-01 12:00:00 UTC" + }, + "template_ids": { + "type": "array", + "description": "An optional array of template IDs to use in the submission along with the provided documents. This can be used to create multi-document submissions when some of the required documents exist within templates.", + "items": { + "type": "integer", + "description": "The ID of the template to use for the submission." + } + }, + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "file" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL." + }, + "position": { + "type": "integer", + "description": "Document position in the submission. If not specified, the document will be added in the order it appears in the documents array." + } + } + } + }, + "submitters": { + "type": "array", + "description": "The list of submitters for the submission.", + "items": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the submitter." + }, + "role": { + "type": "string", + "description": "The role name or title of the submitter.", + "example": "First Party" + }, + "email": { + "type": "string", + "description": "The email address of the submitter.", + "format": "email", + "example": "john.doe@example.com" + }, + "phone": { + "type": "string", + "description": "The phone number of the submitter, formatted according to the E.164 standard.", + "example": "+1234567890" + }, + "values": { + "type": "object", + "description": "An object with pre-filled values for the submission. Use field names for keys of the object. For more configurations see `fields` param." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this submitter within your app." + }, + "completed": { + "type": "boolean", + "description": "Pass `true` to mark submitter as completed and auto-signed via API." + }, + "metadata": { + "type": "object", + "description": "Metadata object with additional submitter information.", + "example": "{ \"customField\": \"value\" }" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending only for this submitter.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails for this submitter." + }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, + "fields": { + "type": "array", + "description": "A list of configurations for document form fields.", + "items": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Document field name.", + "example": "First Name" + }, + "default_value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Default value of the field. Use base64 encoded file or a public URL to the image file to set default signature or image fields.", + "example": "Acme" + }, + "readonly": { + "type": "boolean", + "description": "Set `true` to make it impossible for the submitter to edit predefined field value.", + "default": false + }, + "required": { + "type": "boolean", + "description": "Set `true` to make the field required." + }, + "title": { + "type": "string", + "description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown." + }, + "description": { + "type": "string", + "description": "Field description displayed on the signing form. Supports Markdown." + }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, + "preferences": { + "type": "object", + "properties": { + "font_size": { + "type": "integer", + "description": "Font size of the field value in pixels.", + "example": 12 + }, + "font_type": { + "type": "string", + "description": "Font type of the field value.", + "enum": [ + "bold", + "italic", + "bold_italic" + ] + }, + "font": { + "type": "string", + "description": "Font family of the field value.", + "enum": [ + "Times", + "Helvetica", + "Courier" + ] + }, + "color": { + "type": "string", + "description": "Font color of the field value.", + "enum": [ + "black", + "white", + "blue" + ], + "default": "black" + }, + "align": { + "type": "string", + "description": "Horizontal alignment of the field text value.", + "enum": [ + "left", + "center", + "right" + ], + "default": "left" + }, + "valign": { + "type": "string", + "description": "Vertical alignment of the field text value.", + "enum": [ + "top", + "center", + "bottom" + ], + "default": "center" + }, + "format": { + "type": "string", + "description": "The data format for different field types.
- Date field: accepts formats such as DD/MM/YYYY (default: MM/DD/YYYY).
- Signature field: accepts drawn, typed, drawn_or_typed (default), or upload.
- Number field: accepts currency formats such as usd, eur, gbp.", + "example": "DD/MM/YYYY" + }, + "price": { + "type": "number", + "description": "Price value of the payment field. Only for payment fields.", + "example": 99.99 + }, + "currency": { + "type": "string", + "description": "Currency value of the payment field. Only for payment fields.", + "enum": [ + "USD", + "EUR", + "GBP", + "CAD", + "AUD" + ], + "default": "USD" + }, + "mask": { + "description": "Set `true` to make sensitive data masked on the document.", + "oneOf": [ + { + "type": "integer" + }, + { + "type": "boolean" + } + ], + "default": false + } + } + } + } + } + }, + "roles": { + "type": "array", + "description": "A list of roles for the submitter. Use this param to merge multiple roles into one submitter.", + "items": { + "type": "string" + } + } + } + } + }, + "message": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "description": "Custom signature request email subject." + }, + "body": { + "type": "string", + "description": "Custom signature request email body. Can include the following variables: {{submission.name}}, {{submitter.link}}, {{account.name}}." + } + } + }, + "merge_documents": { + "type": "boolean", + "description": "Set `true` to merge the documents into a single PDF file.", + "default": false + }, + "remove_tags": { + "type": "boolean", + "description": "Pass `false` to disable the removal of {{text}} tags from the PDF. This can be used along with transparent text tags for faster and more robust PDF processing.", + "default": true + } + } + } + } + } + } +} +``` + diff --git a/docs/api/javascript.md b/docs/api/javascript.md index 0fea7231..c0635531 100644 --- a/docs/api/javascript.md +++ b/docs/api/javascript.md @@ -537,6 +537,15 @@ const submission = await docuseal.createSubmission({ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -612,14 +621,45 @@ const submission = await docuseal.createSubmission({ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1052,10 +1092,6 @@ const submitter = await docuseal.updateSubmitter(500001, { "type": "string", "description": "Specify Reply-To address to use in the notification emails." }, - "completed_redirect_url": { - "type": "string", - "description": "Submitter specific URL to redirect to after the submission completion." - }, "completed": { "type": "boolean", "description": "Pass `true` to mark submitter as completed and auto-signed via API." @@ -1065,6 +1101,15 @@ const submitter = await docuseal.updateSubmitter(500001, { "description": "Metadata object with additional submitter information.", "example": "{ \"customField\": \"value\" }" }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -1132,14 +1177,45 @@ const submitter = await docuseal.updateSubmitter(500001, { "type": "boolean", "description": "Set `true` to make the field required." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1826,6 +1902,46 @@ const template = await docuseal.createTemplateFromDocx({ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -2330,7 +2446,7 @@ const template = await docuseal.mergeTemplates({ ### Create a submission from PDF -The API endpoint provides the functionality to create one-off submission request from a PDF or DOCX file. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form +The API endpoint provides the functionality to create one-off submission request from a PDF. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form ```javascript @@ -2635,6 +2751,15 @@ const submission = await docuseal.createSubmissionFromPdf({ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -2697,14 +2822,45 @@ const submission = await docuseal.createSubmissionFromPdf({ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3071,6 +3227,15 @@ and typesetting industry

"type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -3133,14 +3298,45 @@ and typesetting industry

"type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3469,6 +3665,46 @@ const template = await docuseal.createTemplateFromPdf({ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -3585,3 +3821,449 @@ const template = await docuseal.createTemplateFromPdf({ } ``` +### Create a submission from DOCX + +The API endpoint provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use [[variable_name]] text tags to define dynamic content variables in the document. See https://www.docuseal.com/examples/demo_template.docx for the specific text variable syntax, including dynamic content tables and list. You can also use the {{signature}} fillable field syntax to define fillable fields, as in a PDF.
Related Guides
Use embedded text field tags to create a fillable form + +```javascript +const docuseal = require("@docuseal/api"); + +docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); + +const submission = await docuseal.createSubmissionFromDocx({ + name: "Test Submission Document", + variables: { + variable_name: "value" + }, + documents: [ + { + name: "string", + file: "base64" + } + ], + submitters: [ + { + role: "First Party", + email: "john.doe@example.com" + } + ] +}); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from DOCX", + "operationId": "createSubmissionFromDocx", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "documents", + "submitters" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document submission.", + "example": "Test Submission Document" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "variables": { + "type": "object", + "description": "Dynamic content variables object", + "example": { + "variable_name": "value" + } + }, + "order": { + "type": "string", + "description": "Pass 'random' to send signature request emails to all parties right away. The order is 'preserved' by default so the second party will receive a signature request email only after the document is signed by the first party.", + "default": "preserved", + "enum": [ + "preserved", + "random" + ] + }, + "completed_redirect_url": { + "type": "string", + "description": "Specify URL to redirect to after the submission completion." + }, + "bcc_completed": { + "type": "string", + "description": "Specify BCC address to send signed documents to after the completion." + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails." + }, + "expire_at": { + "type": "string", + "description": "Specify the expiration date and time after which the submission becomes unavailable for signature.", + "example": "2024-09-01 12:00:00 UTC" + }, + "template_ids": { + "type": "array", + "description": "An optional array of template IDs to use in the submission along with the provided documents. This can be used to create multi-document submissions when some of the required documents exist within templates.", + "items": { + "type": "integer", + "description": "The ID of the template to use for the submission." + } + }, + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "file" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL." + }, + "position": { + "type": "integer", + "description": "Document position in the submission. If not specified, the document will be added in the order it appears in the documents array." + } + } + } + }, + "submitters": { + "type": "array", + "description": "The list of submitters for the submission.", + "items": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the submitter." + }, + "role": { + "type": "string", + "description": "The role name or title of the submitter.", + "example": "First Party" + }, + "email": { + "type": "string", + "description": "The email address of the submitter.", + "format": "email", + "example": "john.doe@example.com" + }, + "phone": { + "type": "string", + "description": "The phone number of the submitter, formatted according to the E.164 standard.", + "example": "+1234567890" + }, + "values": { + "type": "object", + "description": "An object with pre-filled values for the submission. Use field names for keys of the object. For more configurations see `fields` param." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this submitter within your app." + }, + "completed": { + "type": "boolean", + "description": "Pass `true` to mark submitter as completed and auto-signed via API." + }, + "metadata": { + "type": "object", + "description": "Metadata object with additional submitter information.", + "example": "{ \"customField\": \"value\" }" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending only for this submitter.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails for this submitter." + }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, + "fields": { + "type": "array", + "description": "A list of configurations for document form fields.", + "items": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Document field name.", + "example": "First Name" + }, + "default_value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Default value of the field. Use base64 encoded file or a public URL to the image file to set default signature or image fields.", + "example": "Acme" + }, + "readonly": { + "type": "boolean", + "description": "Set `true` to make it impossible for the submitter to edit predefined field value.", + "default": false + }, + "required": { + "type": "boolean", + "description": "Set `true` to make the field required." + }, + "title": { + "type": "string", + "description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown." + }, + "description": { + "type": "string", + "description": "Field description displayed on the signing form. Supports Markdown." + }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, + "preferences": { + "type": "object", + "properties": { + "font_size": { + "type": "integer", + "description": "Font size of the field value in pixels.", + "example": 12 + }, + "font_type": { + "type": "string", + "description": "Font type of the field value.", + "enum": [ + "bold", + "italic", + "bold_italic" + ] + }, + "font": { + "type": "string", + "description": "Font family of the field value.", + "enum": [ + "Times", + "Helvetica", + "Courier" + ] + }, + "color": { + "type": "string", + "description": "Font color of the field value.", + "enum": [ + "black", + "white", + "blue" + ], + "default": "black" + }, + "align": { + "type": "string", + "description": "Horizontal alignment of the field text value.", + "enum": [ + "left", + "center", + "right" + ], + "default": "left" + }, + "valign": { + "type": "string", + "description": "Vertical alignment of the field text value.", + "enum": [ + "top", + "center", + "bottom" + ], + "default": "center" + }, + "format": { + "type": "string", + "description": "The data format for different field types.
- Date field: accepts formats such as DD/MM/YYYY (default: MM/DD/YYYY).
- Signature field: accepts drawn, typed, drawn_or_typed (default), or upload.
- Number field: accepts currency formats such as usd, eur, gbp.", + "example": "DD/MM/YYYY" + }, + "price": { + "type": "number", + "description": "Price value of the payment field. Only for payment fields.", + "example": 99.99 + }, + "currency": { + "type": "string", + "description": "Currency value of the payment field. Only for payment fields.", + "enum": [ + "USD", + "EUR", + "GBP", + "CAD", + "AUD" + ], + "default": "USD" + }, + "mask": { + "description": "Set `true` to make sensitive data masked on the document.", + "oneOf": [ + { + "type": "integer" + }, + { + "type": "boolean" + } + ], + "default": false + } + } + } + } + } + }, + "roles": { + "type": "array", + "description": "A list of roles for the submitter. Use this param to merge multiple roles into one submitter.", + "items": { + "type": "string" + } + } + } + } + }, + "message": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "description": "Custom signature request email subject." + }, + "body": { + "type": "string", + "description": "Custom signature request email body. Can include the following variables: {{submission.name}}, {{submitter.link}}, {{account.name}}." + } + } + }, + "merge_documents": { + "type": "boolean", + "description": "Set `true` to merge the documents into a single PDF file.", + "default": false + }, + "remove_tags": { + "type": "boolean", + "description": "Pass `false` to disable the removal of {{text}} tags from the PDF. This can be used along with transparent text tags for faster and more robust PDF processing.", + "default": true + } + } + } + } + } + } +} +``` + diff --git a/docs/api/nodejs.md b/docs/api/nodejs.md index 3b099a3a..d5865715 100644 --- a/docs/api/nodejs.md +++ b/docs/api/nodejs.md @@ -569,6 +569,15 @@ const submitters = await resp.json(); "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -644,14 +653,45 @@ const submitters = await resp.json(); "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1116,10 +1156,6 @@ const submitter = await resp.json(); "type": "string", "description": "Specify Reply-To address to use in the notification emails." }, - "completed_redirect_url": { - "type": "string", - "description": "Submitter specific URL to redirect to after the submission completion." - }, "completed": { "type": "boolean", "description": "Pass `true` to mark submitter as completed and auto-signed via API." @@ -1129,6 +1165,15 @@ const submitter = await resp.json(); "description": "Metadata object with additional submitter information.", "example": "{ \"customField\": \"value\" }" }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -1196,14 +1241,45 @@ const submitter = await resp.json(); "type": "boolean", "description": "Set `true` to make the field required." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1919,6 +1995,46 @@ const template = await resp.json(); "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -2435,7 +2551,7 @@ const template = await resp.json(); ### Create a submission from PDF -The API endpoint provides the functionality to create one-off submission request from a PDF or DOCX file. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form +The API endpoint provides the functionality to create one-off submission request from a PDF. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form ```nodejs @@ -2746,6 +2862,15 @@ const submission = await resp.json(); "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -2808,14 +2933,45 @@ const submission = await resp.json(); "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3188,6 +3344,15 @@ const submission = await resp.json(); "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -3250,14 +3415,45 @@ const submission = await resp.json(); "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3592,6 +3788,46 @@ const template = await resp.json(); "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -3708,3 +3944,455 @@ const template = await resp.json(); } ``` +### Create a submission from DOCX + +The API endpoint provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use [[variable_name]] text tags to define dynamic content variables in the document. See https://www.docuseal.com/examples/demo_template.docx for the specific text variable syntax, including dynamic content tables and list. You can also use the {{signature}} fillable field syntax to define fillable fields, as in a PDF.
Related Guides
Use embedded text field tags to create a fillable form + +```nodejs +const fetch = require("node-fetch"); + +const resp = await fetch("https://api.docuseal.com/submissions/docx", { + method: "POST", + headers: { + "X-Auth-Token": "API_KEY" + }, + body: JSON.stringify({ + name: "Test Submission Document", + variables: { + variable_name: "value" + }, + documents: [ + { + name: "string", + file: "base64" + } + ], + submitters: [ + { + role: "First Party", + email: "john.doe@example.com" + } + ] + }) +}); + +const submitters = await resp.json(); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from DOCX", + "operationId": "createSubmissionFromDocx", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "documents", + "submitters" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document submission.", + "example": "Test Submission Document" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "variables": { + "type": "object", + "description": "Dynamic content variables object", + "example": { + "variable_name": "value" + } + }, + "order": { + "type": "string", + "description": "Pass 'random' to send signature request emails to all parties right away. The order is 'preserved' by default so the second party will receive a signature request email only after the document is signed by the first party.", + "default": "preserved", + "enum": [ + "preserved", + "random" + ] + }, + "completed_redirect_url": { + "type": "string", + "description": "Specify URL to redirect to after the submission completion." + }, + "bcc_completed": { + "type": "string", + "description": "Specify BCC address to send signed documents to after the completion." + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails." + }, + "expire_at": { + "type": "string", + "description": "Specify the expiration date and time after which the submission becomes unavailable for signature.", + "example": "2024-09-01 12:00:00 UTC" + }, + "template_ids": { + "type": "array", + "description": "An optional array of template IDs to use in the submission along with the provided documents. This can be used to create multi-document submissions when some of the required documents exist within templates.", + "items": { + "type": "integer", + "description": "The ID of the template to use for the submission." + } + }, + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "file" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL." + }, + "position": { + "type": "integer", + "description": "Document position in the submission. If not specified, the document will be added in the order it appears in the documents array." + } + } + } + }, + "submitters": { + "type": "array", + "description": "The list of submitters for the submission.", + "items": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the submitter." + }, + "role": { + "type": "string", + "description": "The role name or title of the submitter.", + "example": "First Party" + }, + "email": { + "type": "string", + "description": "The email address of the submitter.", + "format": "email", + "example": "john.doe@example.com" + }, + "phone": { + "type": "string", + "description": "The phone number of the submitter, formatted according to the E.164 standard.", + "example": "+1234567890" + }, + "values": { + "type": "object", + "description": "An object with pre-filled values for the submission. Use field names for keys of the object. For more configurations see `fields` param." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this submitter within your app." + }, + "completed": { + "type": "boolean", + "description": "Pass `true` to mark submitter as completed and auto-signed via API." + }, + "metadata": { + "type": "object", + "description": "Metadata object with additional submitter information.", + "example": "{ \"customField\": \"value\" }" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending only for this submitter.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails for this submitter." + }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, + "fields": { + "type": "array", + "description": "A list of configurations for document form fields.", + "items": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Document field name.", + "example": "First Name" + }, + "default_value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Default value of the field. Use base64 encoded file or a public URL to the image file to set default signature or image fields.", + "example": "Acme" + }, + "readonly": { + "type": "boolean", + "description": "Set `true` to make it impossible for the submitter to edit predefined field value.", + "default": false + }, + "required": { + "type": "boolean", + "description": "Set `true` to make the field required." + }, + "title": { + "type": "string", + "description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown." + }, + "description": { + "type": "string", + "description": "Field description displayed on the signing form. Supports Markdown." + }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, + "preferences": { + "type": "object", + "properties": { + "font_size": { + "type": "integer", + "description": "Font size of the field value in pixels.", + "example": 12 + }, + "font_type": { + "type": "string", + "description": "Font type of the field value.", + "enum": [ + "bold", + "italic", + "bold_italic" + ] + }, + "font": { + "type": "string", + "description": "Font family of the field value.", + "enum": [ + "Times", + "Helvetica", + "Courier" + ] + }, + "color": { + "type": "string", + "description": "Font color of the field value.", + "enum": [ + "black", + "white", + "blue" + ], + "default": "black" + }, + "align": { + "type": "string", + "description": "Horizontal alignment of the field text value.", + "enum": [ + "left", + "center", + "right" + ], + "default": "left" + }, + "valign": { + "type": "string", + "description": "Vertical alignment of the field text value.", + "enum": [ + "top", + "center", + "bottom" + ], + "default": "center" + }, + "format": { + "type": "string", + "description": "The data format for different field types.
- Date field: accepts formats such as DD/MM/YYYY (default: MM/DD/YYYY).
- Signature field: accepts drawn, typed, drawn_or_typed (default), or upload.
- Number field: accepts currency formats such as usd, eur, gbp.", + "example": "DD/MM/YYYY" + }, + "price": { + "type": "number", + "description": "Price value of the payment field. Only for payment fields.", + "example": 99.99 + }, + "currency": { + "type": "string", + "description": "Currency value of the payment field. Only for payment fields.", + "enum": [ + "USD", + "EUR", + "GBP", + "CAD", + "AUD" + ], + "default": "USD" + }, + "mask": { + "description": "Set `true` to make sensitive data masked on the document.", + "oneOf": [ + { + "type": "integer" + }, + { + "type": "boolean" + } + ], + "default": false + } + } + } + } + } + }, + "roles": { + "type": "array", + "description": "A list of roles for the submitter. Use this param to merge multiple roles into one submitter.", + "items": { + "type": "string" + } + } + } + } + }, + "message": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "description": "Custom signature request email subject." + }, + "body": { + "type": "string", + "description": "Custom signature request email body. Can include the following variables: {{submission.name}}, {{submitter.link}}, {{account.name}}." + } + } + }, + "merge_documents": { + "type": "boolean", + "description": "Set `true` to merge the documents into a single PDF file.", + "default": false + }, + "remove_tags": { + "type": "boolean", + "description": "Pass `false` to disable the removal of {{text}} tags from the PDF. This can be used along with transparent text tags for faster and more robust PDF processing.", + "default": true + } + } + } + } + } + } +} +``` + diff --git a/docs/api/php.md b/docs/api/php.md index ff02eb85..81c10af2 100644 --- a/docs/api/php.md +++ b/docs/api/php.md @@ -525,6 +525,15 @@ $docuseal->createSubmission([ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -600,14 +609,45 @@ $docuseal->createSubmission([ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1028,10 +1068,6 @@ $docuseal->updateSubmitter(500001, [ "type": "string", "description": "Specify Reply-To address to use in the notification emails." }, - "completed_redirect_url": { - "type": "string", - "description": "Submitter specific URL to redirect to after the submission completion." - }, "completed": { "type": "boolean", "description": "Pass `true` to mark submitter as completed and auto-signed via API." @@ -1041,6 +1077,15 @@ $docuseal->updateSubmitter(500001, [ "description": "Metadata object with additional submitter information.", "example": "{ \"customField\": \"value\" }" }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -1108,14 +1153,45 @@ $docuseal->updateSubmitter(500001, [ "type": "boolean", "description": "Set `true` to make the field required." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1792,6 +1868,46 @@ $docuseal->createTemplateFromDocx([ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -2292,7 +2408,7 @@ $docuseal->mergeTemplates([ ### Create a submission from PDF -The API endpoint provides the functionality to create one-off submission request from a PDF or DOCX file. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form +The API endpoint provides the functionality to create one-off submission request from a PDF. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form ```php @@ -2595,6 +2711,15 @@ $docuseal->createSubmissionFromPdf([ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -2657,14 +2782,45 @@ $docuseal->createSubmissionFromPdf([ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3029,6 +3185,15 @@ and typesetting industry

"type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -3091,14 +3256,45 @@ and typesetting industry

"type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3425,6 +3621,46 @@ $docuseal->createTemplateFromPdf([ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -3541,3 +3777,447 @@ $docuseal->createTemplateFromPdf([ } ``` +### Create a submission from DOCX + +The API endpoint provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use [[variable_name]] text tags to define dynamic content variables in the document. See https://www.docuseal.com/examples/demo_template.docx for the specific text variable syntax, including dynamic content tables and list. You can also use the {{signature}} fillable field syntax to define fillable fields, as in a PDF.
Related Guides
Use embedded text field tags to create a fillable form + +```php +$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); + +$docuseal->createSubmissionFromDocx([ + 'name' => 'Test Submission Document', + 'variables' => [ + 'variable_name' => 'value' + ], + 'documents' => [ + [ + 'name' => 'string', + 'file' => 'base64' + ] + ], + 'submitters' => [ + [ + 'role' => 'First Party', + 'email' => 'john.doe@example.com' + ] + ] +]); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from DOCX", + "operationId": "createSubmissionFromDocx", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "documents", + "submitters" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document submission.", + "example": "Test Submission Document" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "variables": { + "type": "object", + "description": "Dynamic content variables object", + "example": { + "variable_name": "value" + } + }, + "order": { + "type": "string", + "description": "Pass 'random' to send signature request emails to all parties right away. The order is 'preserved' by default so the second party will receive a signature request email only after the document is signed by the first party.", + "default": "preserved", + "enum": [ + "preserved", + "random" + ] + }, + "completed_redirect_url": { + "type": "string", + "description": "Specify URL to redirect to after the submission completion." + }, + "bcc_completed": { + "type": "string", + "description": "Specify BCC address to send signed documents to after the completion." + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails." + }, + "expire_at": { + "type": "string", + "description": "Specify the expiration date and time after which the submission becomes unavailable for signature.", + "example": "2024-09-01 12:00:00 UTC" + }, + "template_ids": { + "type": "array", + "description": "An optional array of template IDs to use in the submission along with the provided documents. This can be used to create multi-document submissions when some of the required documents exist within templates.", + "items": { + "type": "integer", + "description": "The ID of the template to use for the submission." + } + }, + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "file" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL." + }, + "position": { + "type": "integer", + "description": "Document position in the submission. If not specified, the document will be added in the order it appears in the documents array." + } + } + } + }, + "submitters": { + "type": "array", + "description": "The list of submitters for the submission.", + "items": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the submitter." + }, + "role": { + "type": "string", + "description": "The role name or title of the submitter.", + "example": "First Party" + }, + "email": { + "type": "string", + "description": "The email address of the submitter.", + "format": "email", + "example": "john.doe@example.com" + }, + "phone": { + "type": "string", + "description": "The phone number of the submitter, formatted according to the E.164 standard.", + "example": "+1234567890" + }, + "values": { + "type": "object", + "description": "An object with pre-filled values for the submission. Use field names for keys of the object. For more configurations see `fields` param." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this submitter within your app." + }, + "completed": { + "type": "boolean", + "description": "Pass `true` to mark submitter as completed and auto-signed via API." + }, + "metadata": { + "type": "object", + "description": "Metadata object with additional submitter information.", + "example": "{ \"customField\": \"value\" }" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending only for this submitter.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails for this submitter." + }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, + "fields": { + "type": "array", + "description": "A list of configurations for document form fields.", + "items": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Document field name.", + "example": "First Name" + }, + "default_value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Default value of the field. Use base64 encoded file or a public URL to the image file to set default signature or image fields.", + "example": "Acme" + }, + "readonly": { + "type": "boolean", + "description": "Set `true` to make it impossible for the submitter to edit predefined field value.", + "default": false + }, + "required": { + "type": "boolean", + "description": "Set `true` to make the field required." + }, + "title": { + "type": "string", + "description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown." + }, + "description": { + "type": "string", + "description": "Field description displayed on the signing form. Supports Markdown." + }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, + "preferences": { + "type": "object", + "properties": { + "font_size": { + "type": "integer", + "description": "Font size of the field value in pixels.", + "example": 12 + }, + "font_type": { + "type": "string", + "description": "Font type of the field value.", + "enum": [ + "bold", + "italic", + "bold_italic" + ] + }, + "font": { + "type": "string", + "description": "Font family of the field value.", + "enum": [ + "Times", + "Helvetica", + "Courier" + ] + }, + "color": { + "type": "string", + "description": "Font color of the field value.", + "enum": [ + "black", + "white", + "blue" + ], + "default": "black" + }, + "align": { + "type": "string", + "description": "Horizontal alignment of the field text value.", + "enum": [ + "left", + "center", + "right" + ], + "default": "left" + }, + "valign": { + "type": "string", + "description": "Vertical alignment of the field text value.", + "enum": [ + "top", + "center", + "bottom" + ], + "default": "center" + }, + "format": { + "type": "string", + "description": "The data format for different field types.
- Date field: accepts formats such as DD/MM/YYYY (default: MM/DD/YYYY).
- Signature field: accepts drawn, typed, drawn_or_typed (default), or upload.
- Number field: accepts currency formats such as usd, eur, gbp.", + "example": "DD/MM/YYYY" + }, + "price": { + "type": "number", + "description": "Price value of the payment field. Only for payment fields.", + "example": 99.99 + }, + "currency": { + "type": "string", + "description": "Currency value of the payment field. Only for payment fields.", + "enum": [ + "USD", + "EUR", + "GBP", + "CAD", + "AUD" + ], + "default": "USD" + }, + "mask": { + "description": "Set `true` to make sensitive data masked on the document.", + "oneOf": [ + { + "type": "integer" + }, + { + "type": "boolean" + } + ], + "default": false + } + } + } + } + } + }, + "roles": { + "type": "array", + "description": "A list of roles for the submitter. Use this param to merge multiple roles into one submitter.", + "items": { + "type": "string" + } + } + } + } + }, + "message": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "description": "Custom signature request email subject." + }, + "body": { + "type": "string", + "description": "Custom signature request email body. Can include the following variables: {{submission.name}}, {{submitter.link}}, {{account.name}}." + } + } + }, + "merge_documents": { + "type": "boolean", + "description": "Set `true` to merge the documents into a single PDF file.", + "default": false + }, + "remove_tags": { + "type": "boolean", + "description": "Pass `false` to disable the removal of {{text}} tags from the PDF. This can be used along with transparent text tags for faster and more robust PDF processing.", + "default": true + } + } + } + } + } + } +} +``` + diff --git a/docs/api/python.md b/docs/api/python.md index 50edcd4e..07dc3bbd 100644 --- a/docs/api/python.md +++ b/docs/api/python.md @@ -543,6 +543,15 @@ docuseal.create_submission({ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -618,14 +627,45 @@ docuseal.create_submission({ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1064,10 +1104,6 @@ docuseal.update_submitter(500001, { "type": "string", "description": "Specify Reply-To address to use in the notification emails." }, - "completed_redirect_url": { - "type": "string", - "description": "Submitter specific URL to redirect to after the submission completion." - }, "completed": { "type": "boolean", "description": "Pass `true` to mark submitter as completed and auto-signed via API." @@ -1077,6 +1113,15 @@ docuseal.update_submitter(500001, { "description": "Metadata object with additional submitter information.", "example": "{ \"customField\": \"value\" }" }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -1144,14 +1189,45 @@ docuseal.update_submitter(500001, { "type": "boolean", "description": "Set `true` to make the field required." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1843,6 +1919,46 @@ docuseal.create_template_from_docx({ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -2349,7 +2465,7 @@ docuseal.merge_templates({ ### Create a submission from PDF -The API endpoint provides the functionality to create one-off submission request from a PDF or DOCX file. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form +The API endpoint provides the functionality to create one-off submission request from a PDF. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form ```python @@ -2655,6 +2771,15 @@ docuseal.create_submission_from_pdf({ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -2717,14 +2842,45 @@ docuseal.create_submission_from_pdf({ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3092,6 +3248,15 @@ and typesetting industry

"type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -3154,14 +3319,45 @@ and typesetting industry

"type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3491,6 +3687,46 @@ docuseal.create_template_from_pdf({ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -3607,3 +3843,450 @@ docuseal.create_template_from_pdf({ } ``` +### Create a submission from DOCX + +The API endpoint provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use [[variable_name]] text tags to define dynamic content variables in the document. See https://www.docuseal.com/examples/demo_template.docx for the specific text variable syntax, including dynamic content tables and list. You can also use the {{signature}} fillable field syntax to define fillable fields, as in a PDF.
Related Guides
Use embedded text field tags to create a fillable form + +```python +from docuseal import docuseal + +docuseal.key = "API_KEY" +docuseal.url = "https://api.docuseal.com" + +docuseal.create_submission_from_docx({ + "name": "Test Submission Document", + "variables": { + "variable_name": "value" + }, + "documents": [ + { + "name": "string", + "file": "base64" + } + ], + "submitters": [ + { + "role": "First Party", + "email": "john.doe@example.com" + } + ] +}) +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from DOCX", + "operationId": "createSubmissionFromDocx", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "documents", + "submitters" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document submission.", + "example": "Test Submission Document" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "variables": { + "type": "object", + "description": "Dynamic content variables object", + "example": { + "variable_name": "value" + } + }, + "order": { + "type": "string", + "description": "Pass 'random' to send signature request emails to all parties right away. The order is 'preserved' by default so the second party will receive a signature request email only after the document is signed by the first party.", + "default": "preserved", + "enum": [ + "preserved", + "random" + ] + }, + "completed_redirect_url": { + "type": "string", + "description": "Specify URL to redirect to after the submission completion." + }, + "bcc_completed": { + "type": "string", + "description": "Specify BCC address to send signed documents to after the completion." + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails." + }, + "expire_at": { + "type": "string", + "description": "Specify the expiration date and time after which the submission becomes unavailable for signature.", + "example": "2024-09-01 12:00:00 UTC" + }, + "template_ids": { + "type": "array", + "description": "An optional array of template IDs to use in the submission along with the provided documents. This can be used to create multi-document submissions when some of the required documents exist within templates.", + "items": { + "type": "integer", + "description": "The ID of the template to use for the submission." + } + }, + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "file" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL." + }, + "position": { + "type": "integer", + "description": "Document position in the submission. If not specified, the document will be added in the order it appears in the documents array." + } + } + } + }, + "submitters": { + "type": "array", + "description": "The list of submitters for the submission.", + "items": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the submitter." + }, + "role": { + "type": "string", + "description": "The role name or title of the submitter.", + "example": "First Party" + }, + "email": { + "type": "string", + "description": "The email address of the submitter.", + "format": "email", + "example": "john.doe@example.com" + }, + "phone": { + "type": "string", + "description": "The phone number of the submitter, formatted according to the E.164 standard.", + "example": "+1234567890" + }, + "values": { + "type": "object", + "description": "An object with pre-filled values for the submission. Use field names for keys of the object. For more configurations see `fields` param." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this submitter within your app." + }, + "completed": { + "type": "boolean", + "description": "Pass `true` to mark submitter as completed and auto-signed via API." + }, + "metadata": { + "type": "object", + "description": "Metadata object with additional submitter information.", + "example": "{ \"customField\": \"value\" }" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending only for this submitter.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails for this submitter." + }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, + "fields": { + "type": "array", + "description": "A list of configurations for document form fields.", + "items": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Document field name.", + "example": "First Name" + }, + "default_value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Default value of the field. Use base64 encoded file or a public URL to the image file to set default signature or image fields.", + "example": "Acme" + }, + "readonly": { + "type": "boolean", + "description": "Set `true` to make it impossible for the submitter to edit predefined field value.", + "default": false + }, + "required": { + "type": "boolean", + "description": "Set `true` to make the field required." + }, + "title": { + "type": "string", + "description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown." + }, + "description": { + "type": "string", + "description": "Field description displayed on the signing form. Supports Markdown." + }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, + "preferences": { + "type": "object", + "properties": { + "font_size": { + "type": "integer", + "description": "Font size of the field value in pixels.", + "example": 12 + }, + "font_type": { + "type": "string", + "description": "Font type of the field value.", + "enum": [ + "bold", + "italic", + "bold_italic" + ] + }, + "font": { + "type": "string", + "description": "Font family of the field value.", + "enum": [ + "Times", + "Helvetica", + "Courier" + ] + }, + "color": { + "type": "string", + "description": "Font color of the field value.", + "enum": [ + "black", + "white", + "blue" + ], + "default": "black" + }, + "align": { + "type": "string", + "description": "Horizontal alignment of the field text value.", + "enum": [ + "left", + "center", + "right" + ], + "default": "left" + }, + "valign": { + "type": "string", + "description": "Vertical alignment of the field text value.", + "enum": [ + "top", + "center", + "bottom" + ], + "default": "center" + }, + "format": { + "type": "string", + "description": "The data format for different field types.
- Date field: accepts formats such as DD/MM/YYYY (default: MM/DD/YYYY).
- Signature field: accepts drawn, typed, drawn_or_typed (default), or upload.
- Number field: accepts currency formats such as usd, eur, gbp.", + "example": "DD/MM/YYYY" + }, + "price": { + "type": "number", + "description": "Price value of the payment field. Only for payment fields.", + "example": 99.99 + }, + "currency": { + "type": "string", + "description": "Currency value of the payment field. Only for payment fields.", + "enum": [ + "USD", + "EUR", + "GBP", + "CAD", + "AUD" + ], + "default": "USD" + }, + "mask": { + "description": "Set `true` to make sensitive data masked on the document.", + "oneOf": [ + { + "type": "integer" + }, + { + "type": "boolean" + } + ], + "default": false + } + } + } + } + } + }, + "roles": { + "type": "array", + "description": "A list of roles for the submitter. Use this param to merge multiple roles into one submitter.", + "items": { + "type": "string" + } + } + } + } + }, + "message": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "description": "Custom signature request email subject." + }, + "body": { + "type": "string", + "description": "Custom signature request email body. Can include the following variables: {{submission.name}}, {{submitter.link}}, {{account.name}}." + } + } + }, + "merge_documents": { + "type": "boolean", + "description": "Set `true` to merge the documents into a single PDF file.", + "default": false + }, + "remove_tags": { + "type": "boolean", + "description": "Pass `false` to disable the removal of {{text}} tags from the PDF. This can be used along with transparent text tags for faster and more robust PDF processing.", + "default": true + } + } + } + } + } + } +} +``` + diff --git a/docs/api/ruby.md b/docs/api/ruby.md index cf2cd9fe..45be27ae 100644 --- a/docs/api/ruby.md +++ b/docs/api/ruby.md @@ -543,6 +543,15 @@ Docuseal.create_submission({ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -618,14 +627,45 @@ Docuseal.create_submission({ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1064,10 +1104,6 @@ Docuseal.update_submitter(500001, { "type": "string", "description": "Specify Reply-To address to use in the notification emails." }, - "completed_redirect_url": { - "type": "string", - "description": "Submitter specific URL to redirect to after the submission completion." - }, "completed": { "type": "boolean", "description": "Pass `true` to mark submitter as completed and auto-signed via API." @@ -1077,6 +1113,15 @@ Docuseal.update_submitter(500001, { "description": "Metadata object with additional submitter information.", "example": "{ \"customField\": \"value\" }" }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -1144,14 +1189,45 @@ Docuseal.update_submitter(500001, { "type": "boolean", "description": "Set `true` to make the field required." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1843,6 +1919,46 @@ Docuseal.create_template_from_docx({ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -2349,7 +2465,7 @@ Docuseal.merge_templates({ ### Create a submission from PDF -The API endpoint provides the functionality to create one-off submission request from a PDF or DOCX file. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form +The API endpoint provides the functionality to create one-off submission request from a PDF. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form ```ruby @@ -2655,6 +2771,15 @@ Docuseal.create_submission_from_pdf({ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -2717,14 +2842,45 @@ Docuseal.create_submission_from_pdf({ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3092,6 +3248,15 @@ and typesetting industry

"type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -3154,14 +3319,45 @@ and typesetting industry

"type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3491,6 +3687,46 @@ Docuseal.create_template_from_pdf({ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -3607,3 +3843,450 @@ Docuseal.create_template_from_pdf({ } ``` +### Create a submission from DOCX + +The API endpoint provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use [[variable_name]] text tags to define dynamic content variables in the document. See https://www.docuseal.com/examples/demo_template.docx for the specific text variable syntax, including dynamic content tables and list. You can also use the {{signature}} fillable field syntax to define fillable fields, as in a PDF.
Related Guides
Use embedded text field tags to create a fillable form + +```ruby +require "docuseal" + +Docuseal.key = ENV["DOCUSEAL_API_KEY"] +Docuseal.url = "https://api.docuseal.com" + +Docuseal.create_submission_from_docx({ + name: "Test Submission Document", + variables: { + variable_name: "value" + }, + documents: [ + { + name: "string", + file: "base64" + } + ], + submitters: [ + { + role: "First Party", + email: "john.doe@example.com" + } + ] +}) +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from DOCX", + "operationId": "createSubmissionFromDocx", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "documents", + "submitters" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document submission.", + "example": "Test Submission Document" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "variables": { + "type": "object", + "description": "Dynamic content variables object", + "example": { + "variable_name": "value" + } + }, + "order": { + "type": "string", + "description": "Pass 'random' to send signature request emails to all parties right away. The order is 'preserved' by default so the second party will receive a signature request email only after the document is signed by the first party.", + "default": "preserved", + "enum": [ + "preserved", + "random" + ] + }, + "completed_redirect_url": { + "type": "string", + "description": "Specify URL to redirect to after the submission completion." + }, + "bcc_completed": { + "type": "string", + "description": "Specify BCC address to send signed documents to after the completion." + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails." + }, + "expire_at": { + "type": "string", + "description": "Specify the expiration date and time after which the submission becomes unavailable for signature.", + "example": "2024-09-01 12:00:00 UTC" + }, + "template_ids": { + "type": "array", + "description": "An optional array of template IDs to use in the submission along with the provided documents. This can be used to create multi-document submissions when some of the required documents exist within templates.", + "items": { + "type": "integer", + "description": "The ID of the template to use for the submission." + } + }, + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "file" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL." + }, + "position": { + "type": "integer", + "description": "Document position in the submission. If not specified, the document will be added in the order it appears in the documents array." + } + } + } + }, + "submitters": { + "type": "array", + "description": "The list of submitters for the submission.", + "items": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the submitter." + }, + "role": { + "type": "string", + "description": "The role name or title of the submitter.", + "example": "First Party" + }, + "email": { + "type": "string", + "description": "The email address of the submitter.", + "format": "email", + "example": "john.doe@example.com" + }, + "phone": { + "type": "string", + "description": "The phone number of the submitter, formatted according to the E.164 standard.", + "example": "+1234567890" + }, + "values": { + "type": "object", + "description": "An object with pre-filled values for the submission. Use field names for keys of the object. For more configurations see `fields` param." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this submitter within your app." + }, + "completed": { + "type": "boolean", + "description": "Pass `true` to mark submitter as completed and auto-signed via API." + }, + "metadata": { + "type": "object", + "description": "Metadata object with additional submitter information.", + "example": "{ \"customField\": \"value\" }" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending only for this submitter.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails for this submitter." + }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, + "fields": { + "type": "array", + "description": "A list of configurations for document form fields.", + "items": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Document field name.", + "example": "First Name" + }, + "default_value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Default value of the field. Use base64 encoded file or a public URL to the image file to set default signature or image fields.", + "example": "Acme" + }, + "readonly": { + "type": "boolean", + "description": "Set `true` to make it impossible for the submitter to edit predefined field value.", + "default": false + }, + "required": { + "type": "boolean", + "description": "Set `true` to make the field required." + }, + "title": { + "type": "string", + "description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown." + }, + "description": { + "type": "string", + "description": "Field description displayed on the signing form. Supports Markdown." + }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, + "preferences": { + "type": "object", + "properties": { + "font_size": { + "type": "integer", + "description": "Font size of the field value in pixels.", + "example": 12 + }, + "font_type": { + "type": "string", + "description": "Font type of the field value.", + "enum": [ + "bold", + "italic", + "bold_italic" + ] + }, + "font": { + "type": "string", + "description": "Font family of the field value.", + "enum": [ + "Times", + "Helvetica", + "Courier" + ] + }, + "color": { + "type": "string", + "description": "Font color of the field value.", + "enum": [ + "black", + "white", + "blue" + ], + "default": "black" + }, + "align": { + "type": "string", + "description": "Horizontal alignment of the field text value.", + "enum": [ + "left", + "center", + "right" + ], + "default": "left" + }, + "valign": { + "type": "string", + "description": "Vertical alignment of the field text value.", + "enum": [ + "top", + "center", + "bottom" + ], + "default": "center" + }, + "format": { + "type": "string", + "description": "The data format for different field types.
- Date field: accepts formats such as DD/MM/YYYY (default: MM/DD/YYYY).
- Signature field: accepts drawn, typed, drawn_or_typed (default), or upload.
- Number field: accepts currency formats such as usd, eur, gbp.", + "example": "DD/MM/YYYY" + }, + "price": { + "type": "number", + "description": "Price value of the payment field. Only for payment fields.", + "example": 99.99 + }, + "currency": { + "type": "string", + "description": "Currency value of the payment field. Only for payment fields.", + "enum": [ + "USD", + "EUR", + "GBP", + "CAD", + "AUD" + ], + "default": "USD" + }, + "mask": { + "description": "Set `true` to make sensitive data masked on the document.", + "oneOf": [ + { + "type": "integer" + }, + { + "type": "boolean" + } + ], + "default": false + } + } + } + } + } + }, + "roles": { + "type": "array", + "description": "A list of roles for the submitter. Use this param to merge multiple roles into one submitter.", + "items": { + "type": "string" + } + } + } + } + }, + "message": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "description": "Custom signature request email subject." + }, + "body": { + "type": "string", + "description": "Custom signature request email body. Can include the following variables: {{submission.name}}, {{submitter.link}}, {{account.name}}." + } + } + }, + "merge_documents": { + "type": "boolean", + "description": "Set `true` to merge the documents into a single PDF file.", + "default": false + }, + "remove_tags": { + "type": "boolean", + "description": "Pass `false` to disable the removal of {{text}} tags from the PDF. This can be used along with transparent text tags for faster and more robust PDF processing.", + "default": true + } + } + } + } + } + } +} +``` + diff --git a/docs/api/shell.md b/docs/api/shell.md index 02016519..f5132490 100644 --- a/docs/api/shell.md +++ b/docs/api/shell.md @@ -517,6 +517,15 @@ curl --request POST \ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -592,14 +601,45 @@ curl --request POST \ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1013,10 +1053,6 @@ curl --request PUT \ "type": "string", "description": "Specify Reply-To address to use in the notification emails." }, - "completed_redirect_url": { - "type": "string", - "description": "Submitter specific URL to redirect to after the submission completion." - }, "completed": { "type": "boolean", "description": "Pass `true` to mark submitter as completed and auto-signed via API." @@ -1026,6 +1062,15 @@ curl --request PUT \ "description": "Metadata object with additional submitter information.", "example": "{ \"customField\": \"value\" }" }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -1093,14 +1138,45 @@ curl --request PUT \ "type": "boolean", "description": "Set `true` to make the field required." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1758,6 +1834,46 @@ curl --request POST \ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -2234,7 +2350,7 @@ curl --request POST \ ### Create a submission from PDF -The API endpoint provides the functionality to create one-off submission request from a PDF or DOCX file. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form +The API endpoint provides the functionality to create one-off submission request from a PDF. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form ```shell @@ -2511,6 +2627,15 @@ curl --request POST \ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -2573,14 +2698,45 @@ curl --request POST \ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -2925,6 +3081,15 @@ curl --request POST \ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -2987,14 +3152,45 @@ curl --request POST \ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3301,6 +3497,46 @@ curl --request POST \ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -3417,3 +3653,432 @@ curl --request POST \ } ``` +### Create a submission from DOCX + +The API endpoint provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use [[variable_name]] text tags to define dynamic content variables in the document. See https://www.docuseal.com/examples/demo_template.docx for the specific text variable syntax, including dynamic content tables and list. You can also use the {{signature}} fillable field syntax to define fillable fields, as in a PDF.
Related Guides
Use embedded text field tags to create a fillable form + +```shell +curl --request POST \ + --url https://api.docuseal.com/submissions/docx \ + --header 'X-Auth-Token: API_KEY' \ + --header 'content-type: application/json' \ + --data '{"name":"Test Submission Document","variables":{"variable_name":"value"},"documents":[{"name":"string","file":"base64"}],"submitters":[{"role":"First Party","email":"john.doe@example.com"}]}' +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from DOCX", + "operationId": "createSubmissionFromDocx", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "documents", + "submitters" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document submission.", + "example": "Test Submission Document" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "variables": { + "type": "object", + "description": "Dynamic content variables object", + "example": { + "variable_name": "value" + } + }, + "order": { + "type": "string", + "description": "Pass 'random' to send signature request emails to all parties right away. The order is 'preserved' by default so the second party will receive a signature request email only after the document is signed by the first party.", + "default": "preserved", + "enum": [ + "preserved", + "random" + ] + }, + "completed_redirect_url": { + "type": "string", + "description": "Specify URL to redirect to after the submission completion." + }, + "bcc_completed": { + "type": "string", + "description": "Specify BCC address to send signed documents to after the completion." + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails." + }, + "expire_at": { + "type": "string", + "description": "Specify the expiration date and time after which the submission becomes unavailable for signature.", + "example": "2024-09-01 12:00:00 UTC" + }, + "template_ids": { + "type": "array", + "description": "An optional array of template IDs to use in the submission along with the provided documents. This can be used to create multi-document submissions when some of the required documents exist within templates.", + "items": { + "type": "integer", + "description": "The ID of the template to use for the submission." + } + }, + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "file" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL." + }, + "position": { + "type": "integer", + "description": "Document position in the submission. If not specified, the document will be added in the order it appears in the documents array." + } + } + } + }, + "submitters": { + "type": "array", + "description": "The list of submitters for the submission.", + "items": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the submitter." + }, + "role": { + "type": "string", + "description": "The role name or title of the submitter.", + "example": "First Party" + }, + "email": { + "type": "string", + "description": "The email address of the submitter.", + "format": "email", + "example": "john.doe@example.com" + }, + "phone": { + "type": "string", + "description": "The phone number of the submitter, formatted according to the E.164 standard.", + "example": "+1234567890" + }, + "values": { + "type": "object", + "description": "An object with pre-filled values for the submission. Use field names for keys of the object. For more configurations see `fields` param." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this submitter within your app." + }, + "completed": { + "type": "boolean", + "description": "Pass `true` to mark submitter as completed and auto-signed via API." + }, + "metadata": { + "type": "object", + "description": "Metadata object with additional submitter information.", + "example": "{ \"customField\": \"value\" }" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending only for this submitter.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails for this submitter." + }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, + "fields": { + "type": "array", + "description": "A list of configurations for document form fields.", + "items": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Document field name.", + "example": "First Name" + }, + "default_value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Default value of the field. Use base64 encoded file or a public URL to the image file to set default signature or image fields.", + "example": "Acme" + }, + "readonly": { + "type": "boolean", + "description": "Set `true` to make it impossible for the submitter to edit predefined field value.", + "default": false + }, + "required": { + "type": "boolean", + "description": "Set `true` to make the field required." + }, + "title": { + "type": "string", + "description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown." + }, + "description": { + "type": "string", + "description": "Field description displayed on the signing form. Supports Markdown." + }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, + "preferences": { + "type": "object", + "properties": { + "font_size": { + "type": "integer", + "description": "Font size of the field value in pixels.", + "example": 12 + }, + "font_type": { + "type": "string", + "description": "Font type of the field value.", + "enum": [ + "bold", + "italic", + "bold_italic" + ] + }, + "font": { + "type": "string", + "description": "Font family of the field value.", + "enum": [ + "Times", + "Helvetica", + "Courier" + ] + }, + "color": { + "type": "string", + "description": "Font color of the field value.", + "enum": [ + "black", + "white", + "blue" + ], + "default": "black" + }, + "align": { + "type": "string", + "description": "Horizontal alignment of the field text value.", + "enum": [ + "left", + "center", + "right" + ], + "default": "left" + }, + "valign": { + "type": "string", + "description": "Vertical alignment of the field text value.", + "enum": [ + "top", + "center", + "bottom" + ], + "default": "center" + }, + "format": { + "type": "string", + "description": "The data format for different field types.
- Date field: accepts formats such as DD/MM/YYYY (default: MM/DD/YYYY).
- Signature field: accepts drawn, typed, drawn_or_typed (default), or upload.
- Number field: accepts currency formats such as usd, eur, gbp.", + "example": "DD/MM/YYYY" + }, + "price": { + "type": "number", + "description": "Price value of the payment field. Only for payment fields.", + "example": 99.99 + }, + "currency": { + "type": "string", + "description": "Currency value of the payment field. Only for payment fields.", + "enum": [ + "USD", + "EUR", + "GBP", + "CAD", + "AUD" + ], + "default": "USD" + }, + "mask": { + "description": "Set `true` to make sensitive data masked on the document.", + "oneOf": [ + { + "type": "integer" + }, + { + "type": "boolean" + } + ], + "default": false + } + } + } + } + } + }, + "roles": { + "type": "array", + "description": "A list of roles for the submitter. Use this param to merge multiple roles into one submitter.", + "items": { + "type": "string" + } + } + } + } + }, + "message": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "description": "Custom signature request email subject." + }, + "body": { + "type": "string", + "description": "Custom signature request email body. Can include the following variables: {{submission.name}}, {{submitter.link}}, {{account.name}}." + } + } + }, + "merge_documents": { + "type": "boolean", + "description": "Set `true` to merge the documents into a single PDF file.", + "default": false + }, + "remove_tags": { + "type": "boolean", + "description": "Pass `false` to disable the removal of {{text}} tags from the PDF. This can be used along with transparent text tags for faster and more robust PDF processing.", + "default": true + } + } + } + } + } + } +} +``` + diff --git a/docs/api/typescript.md b/docs/api/typescript.md index d2bd2a7e..65d4b084 100644 --- a/docs/api/typescript.md +++ b/docs/api/typescript.md @@ -537,6 +537,15 @@ const submission = await docuseal.createSubmission({ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -612,14 +621,45 @@ const submission = await docuseal.createSubmission({ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1052,10 +1092,6 @@ const submitter = await docuseal.updateSubmitter(500001, { "type": "string", "description": "Specify Reply-To address to use in the notification emails." }, - "completed_redirect_url": { - "type": "string", - "description": "Submitter specific URL to redirect to after the submission completion." - }, "completed": { "type": "boolean", "description": "Pass `true` to mark submitter as completed and auto-signed via API." @@ -1065,6 +1101,15 @@ const submitter = await docuseal.updateSubmitter(500001, { "description": "Metadata object with additional submitter information.", "example": "{ \"customField\": \"value\" }" }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -1132,14 +1177,45 @@ const submitter = await docuseal.updateSubmitter(500001, { "type": "boolean", "description": "Set `true` to make the field required." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -1826,6 +1902,46 @@ const template = await docuseal.createTemplateFromDocx({ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -2330,7 +2446,7 @@ const template = await docuseal.mergeTemplates({ ### Create a submission from PDF -The API endpoint provides the functionality to create one-off submission request from a PDF or DOCX file. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form +The API endpoint provides the functionality to create one-off submission request from a PDF. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form ```typescript @@ -2635,6 +2751,15 @@ const submission = await docuseal.createSubmissionFromPdf({ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -2697,14 +2822,45 @@ const submission = await docuseal.createSubmissionFromPdf({ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3071,6 +3227,15 @@ and typesetting industry

"type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -3133,14 +3298,45 @@ and typesetting industry

"type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3469,6 +3665,46 @@ const template = await docuseal.createTemplateFromPdf({ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -3585,3 +3821,449 @@ const template = await docuseal.createTemplateFromPdf({ } ``` +### Create a submission from DOCX + +The API endpoint provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use [[variable_name]] text tags to define dynamic content variables in the document. See https://www.docuseal.com/examples/demo_template.docx for the specific text variable syntax, including dynamic content tables and list. You can also use the {{signature}} fillable field syntax to define fillable fields, as in a PDF.
Related Guides
Use embedded text field tags to create a fillable form + +```typescript +import docuseal from "@docuseal/api"; + +docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); + +const submission = await docuseal.createSubmissionFromDocx({ + name: "Test Submission Document", + variables: { + variable_name: "value" + }, + documents: [ + { + name: "string", + file: "base64" + } + ], + submitters: [ + { + role: "First Party", + email: "john.doe@example.com" + } + ] +}); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from DOCX", + "operationId": "createSubmissionFromDocx", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "documents", + "submitters" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document submission.", + "example": "Test Submission Document" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "variables": { + "type": "object", + "description": "Dynamic content variables object", + "example": { + "variable_name": "value" + } + }, + "order": { + "type": "string", + "description": "Pass 'random' to send signature request emails to all parties right away. The order is 'preserved' by default so the second party will receive a signature request email only after the document is signed by the first party.", + "default": "preserved", + "enum": [ + "preserved", + "random" + ] + }, + "completed_redirect_url": { + "type": "string", + "description": "Specify URL to redirect to after the submission completion." + }, + "bcc_completed": { + "type": "string", + "description": "Specify BCC address to send signed documents to after the completion." + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails." + }, + "expire_at": { + "type": "string", + "description": "Specify the expiration date and time after which the submission becomes unavailable for signature.", + "example": "2024-09-01 12:00:00 UTC" + }, + "template_ids": { + "type": "array", + "description": "An optional array of template IDs to use in the submission along with the provided documents. This can be used to create multi-document submissions when some of the required documents exist within templates.", + "items": { + "type": "integer", + "description": "The ID of the template to use for the submission." + } + }, + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "file" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL." + }, + "position": { + "type": "integer", + "description": "Document position in the submission. If not specified, the document will be added in the order it appears in the documents array." + } + } + } + }, + "submitters": { + "type": "array", + "description": "The list of submitters for the submission.", + "items": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the submitter." + }, + "role": { + "type": "string", + "description": "The role name or title of the submitter.", + "example": "First Party" + }, + "email": { + "type": "string", + "description": "The email address of the submitter.", + "format": "email", + "example": "john.doe@example.com" + }, + "phone": { + "type": "string", + "description": "The phone number of the submitter, formatted according to the E.164 standard.", + "example": "+1234567890" + }, + "values": { + "type": "object", + "description": "An object with pre-filled values for the submission. Use field names for keys of the object. For more configurations see `fields` param." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this submitter within your app." + }, + "completed": { + "type": "boolean", + "description": "Pass `true` to mark submitter as completed and auto-signed via API." + }, + "metadata": { + "type": "object", + "description": "Metadata object with additional submitter information.", + "example": "{ \"customField\": \"value\" }" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending only for this submitter.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails for this submitter." + }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, + "fields": { + "type": "array", + "description": "A list of configurations for document form fields.", + "items": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Document field name.", + "example": "First Name" + }, + "default_value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Default value of the field. Use base64 encoded file or a public URL to the image file to set default signature or image fields.", + "example": "Acme" + }, + "readonly": { + "type": "boolean", + "description": "Set `true` to make it impossible for the submitter to edit predefined field value.", + "default": false + }, + "required": { + "type": "boolean", + "description": "Set `true` to make the field required." + }, + "title": { + "type": "string", + "description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown." + }, + "description": { + "type": "string", + "description": "Field description displayed on the signing form. Supports Markdown." + }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, + "preferences": { + "type": "object", + "properties": { + "font_size": { + "type": "integer", + "description": "Font size of the field value in pixels.", + "example": 12 + }, + "font_type": { + "type": "string", + "description": "Font type of the field value.", + "enum": [ + "bold", + "italic", + "bold_italic" + ] + }, + "font": { + "type": "string", + "description": "Font family of the field value.", + "enum": [ + "Times", + "Helvetica", + "Courier" + ] + }, + "color": { + "type": "string", + "description": "Font color of the field value.", + "enum": [ + "black", + "white", + "blue" + ], + "default": "black" + }, + "align": { + "type": "string", + "description": "Horizontal alignment of the field text value.", + "enum": [ + "left", + "center", + "right" + ], + "default": "left" + }, + "valign": { + "type": "string", + "description": "Vertical alignment of the field text value.", + "enum": [ + "top", + "center", + "bottom" + ], + "default": "center" + }, + "format": { + "type": "string", + "description": "The data format for different field types.
- Date field: accepts formats such as DD/MM/YYYY (default: MM/DD/YYYY).
- Signature field: accepts drawn, typed, drawn_or_typed (default), or upload.
- Number field: accepts currency formats such as usd, eur, gbp.", + "example": "DD/MM/YYYY" + }, + "price": { + "type": "number", + "description": "Price value of the payment field. Only for payment fields.", + "example": 99.99 + }, + "currency": { + "type": "string", + "description": "Currency value of the payment field. Only for payment fields.", + "enum": [ + "USD", + "EUR", + "GBP", + "CAD", + "AUD" + ], + "default": "USD" + }, + "mask": { + "description": "Set `true` to make sensitive data masked on the document.", + "oneOf": [ + { + "type": "integer" + }, + { + "type": "boolean" + } + ], + "default": false + } + } + } + } + } + }, + "roles": { + "type": "array", + "description": "A list of roles for the submitter. Use this param to merge multiple roles into one submitter.", + "items": { + "type": "string" + } + } + } + } + }, + "message": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "description": "Custom signature request email subject." + }, + "body": { + "type": "string", + "description": "Custom signature request email body. Can include the following variables: {{submission.name}}, {{submitter.link}}, {{account.name}}." + } + } + }, + "merge_documents": { + "type": "boolean", + "description": "Set `true` to merge the documents into a single PDF file.", + "default": false + }, + "remove_tags": { + "type": "boolean", + "description": "Pass `false` to disable the removal of {{text}} tags from the PDF. This can be used along with transparent text tags for faster and more robust PDF processing.", + "default": true + } + } + } + } + } + } +} +``` + diff --git a/docs/embedding/form-builder-angular.md b/docs/embedding/form-builder-angular.md index 89eb9c65..b78fafd2 100644 --- a/docs/embedding/form-builder-angular.md +++ b/docs/embedding/form-builder-angular.md @@ -450,6 +450,11 @@ const token = jwt.sign({ "default": false, "description": "Set `true` to display field name placeholders instead of the field type icons." }, + "withSignatureId": { + "type": "boolean", + "required": false, + "description": "Set to `true` to enable Signature ID by default for newly added fields. If set to `false`, the Signature ID toggle will be displayed under field settings, with the Signature ID turned off by default." + }, "onlyDefinedFields": { "type": "boolean", "required": false, @@ -462,6 +467,12 @@ const token = jwt.sign({ "default": false, "description": "Show template in preview mode without ability to edit it." }, + "inputMode": { + "type": "boolean", + "required": false, + "default": false, + "description": "Open template in data input mode to prefill fields with default values." + }, "autosave": { "type": "boolean", "required": false, diff --git a/docs/embedding/form-builder-javascript.md b/docs/embedding/form-builder-javascript.md index 64cb8eaf..4953b54f 100644 --- a/docs/embedding/form-builder-javascript.md +++ b/docs/embedding/form-builder-javascript.md @@ -414,12 +414,23 @@ "default": false, "description": "Set `true` to display field name placeholders instead of the field type icons." }, + "data-with-signature-id": { + "type": "boolean", + "required": false, + "description": "Set to `true` to enable Signature ID by default for newly added fields. If set to `false`, the Signature ID toggle will be displayed under field settings, with the Signature ID turned off by default." + }, "data-preview": { "type": "boolean", "required": false, "default": false, "description": "Show template in preview mode without ability to edit it." }, + "data-input-mode": { + "type": "boolean", + "required": false, + "default": false, + "description": "Open template in data input mode to prefill fields with default values." + }, "data-only-defined-fields": { "type": "boolean", "required": false, diff --git a/docs/embedding/form-builder-react.md b/docs/embedding/form-builder-react.md index e38a146a..894f684a 100644 --- a/docs/embedding/form-builder-react.md +++ b/docs/embedding/form-builder-react.md @@ -441,6 +441,11 @@ const token = jwt.sign({ "default": false, "description": "Set `true` to display field name placeholders instead of the field type icons." }, + "withSignatureId": { + "type": "boolean", + "required": false, + "description": "Set to `true` to enable Signature ID by default for newly added fields. If set to `false`, the Signature ID toggle will be displayed under field settings, with the Signature ID turned off by default." + }, "onlyDefinedFields": { "type": "boolean", "required": false, @@ -453,6 +458,12 @@ const token = jwt.sign({ "default": false, "description": "Show template in preview mode without ability to edit it." }, + "inputMode": { + "type": "boolean", + "required": false, + "default": false, + "description": "Open template in data input mode to prefill fields with default values." + }, "autosave": { "type": "boolean", "required": false, diff --git a/docs/embedding/form-builder-vue.md b/docs/embedding/form-builder-vue.md index 698360aa..f745be19 100644 --- a/docs/embedding/form-builder-vue.md +++ b/docs/embedding/form-builder-vue.md @@ -456,6 +456,11 @@ const token = jwt.sign({ "default": false, "description": "Set `true` to display field name placeholders instead of the field type icons." }, + "with-signature-id": { + "type": "boolean", + "required": false, + "description": "Set to `true` to enable Signature ID by default for newly added fields. If set to `false`, the Signature ID toggle will be displayed under field settings, with the Signature ID turned off by default." + }, "autosave": { "type": "boolean", "required": false, @@ -468,6 +473,12 @@ const token = jwt.sign({ "default": false, "description": "Show template in preview mode without ability to edit it." }, + "input-mode": { + "type": "boolean", + "required": false, + "default": false, + "description": "Open template in data input mode to prefill fields with default values." + }, "language": { "type": "string", "required": false, diff --git a/docs/embedding/signing-form-javascript.md b/docs/embedding/signing-form-javascript.md index 9674bb35..935153b5 100644 --- a/docs/embedding/signing-form-javascript.md +++ b/docs/embedding/signing-form-javascript.md @@ -7,12 +7,14 @@ + data-src="https://docuseal.com/d/{{ template_slug }}" + data-email="{{ signer_email }}"> ``` diff --git a/docs/openapi.json b/docs/openapi.json index bb9fa35d..84f95deb 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -1773,6 +1773,10 @@ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, "require_phone_2fa": { "type": "boolean", "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", @@ -1853,14 +1857,45 @@ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3171,7 +3206,7 @@ "Submissions" ], "summary": "Create a submission from PDF", - "description": "The API endpoint provides the functionality to create one-off submission request from a PDF or DOCX file. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form\n", + "description": "The API endpoint provides the functionality to create one-off submission request from a PDF. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.pdf for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
Related Guides
Use embedded text field tags to create a fillable form\n", "operationId": "createSubmissionFromPdf", "parameters": [], "requestBody": { @@ -3251,7 +3286,7 @@ "example": "base64", "type": "string", "format": "base64", - "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL." + "description": "Base64-encoded content of the PDF file or downloadable file URL." }, "fields": { "type": "array", @@ -3427,6 +3462,866 @@ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, + "require_phone_2fa": { + "type": "boolean", + "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", + "default": false + }, + "fields": { + "type": "array", + "description": "A list of configurations for document form fields.", + "items": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "Document field name.", + "example": "First Name" + }, + "default_value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Default value of the field. Use base64 encoded file or a public URL to the image file to set default signature or image fields.", + "example": "Acme" + }, + "readonly": { + "type": "boolean", + "description": "Set `true` to make it impossible for the submitter to edit predefined field value.", + "default": false + }, + "required": { + "type": "boolean", + "description": "Set `true` to make the field required." + }, + "title": { + "type": "string", + "description": "Field title displayed to the user instead of the name, shown on the signing form. Supports Markdown." + }, + "description": { + "type": "string", + "description": "Field description displayed on the signing form. Supports Markdown." + }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, + "preferences": { + "type": "object", + "properties": { + "font_size": { + "type": "integer", + "description": "Font size of the field value in pixels.", + "example": 12 + }, + "font_type": { + "type": "string", + "description": "Font type of the field value.", + "enum": [ + "bold", + "italic", + "bold_italic" + ] + }, + "font": { + "type": "string", + "description": "Font family of the field value.", + "enum": [ + "Times", + "Helvetica", + "Courier" + ] + }, + "color": { + "type": "string", + "description": "Font color of the field value.", + "enum": [ + "black", + "white", + "blue" + ], + "default": "black" + }, + "align": { + "type": "string", + "description": "Horizontal alignment of the field text value.", + "enum": [ + "left", + "center", + "right" + ], + "default": "left" + }, + "valign": { + "type": "string", + "description": "Vertical alignment of the field text value.", + "enum": [ + "top", + "center", + "bottom" + ], + "default": "center" + }, + "format": { + "type": "string", + "description": "The data format for different field types.
- Date field: accepts formats such as DD/MM/YYYY (default: MM/DD/YYYY).
- Signature field: accepts drawn, typed, drawn_or_typed (default), or upload.
- Number field: accepts currency formats such as usd, eur, gbp.", + "example": "DD/MM/YYYY" + }, + "price": { + "type": "number", + "description": "Price value of the payment field. Only for payment fields.", + "example": 99.99 + }, + "currency": { + "type": "string", + "description": "Currency value of the payment field. Only for payment fields.", + "enum": [ + "USD", + "EUR", + "GBP", + "CAD", + "AUD" + ], + "default": "USD" + }, + "mask": { + "description": "Set `true` to make sensitive data masked on the document.", + "oneOf": [ + { + "type": "integer" + }, + { + "type": "boolean" + } + ], + "default": false + } + } + } + } + } + }, + "roles": { + "type": "array", + "description": "A list of roles for the submitter. Use this param to merge multiple roles into one submitter.", + "items": { + "type": "string" + } + } + } + } + }, + "message": { + "type": "object", + "properties": { + "subject": { + "type": "string", + "description": "Custom signature request email subject." + }, + "body": { + "type": "string", + "description": "Custom signature request email body. Can include the following variables: {{submission.name}}, {{submitter.link}}, {{account.name}}." + } + } + }, + "flatten": { + "type": "boolean", + "description": "Remove PDF form fields from the documents.", + "default": false + }, + "merge_documents": { + "type": "boolean", + "description": "Set `true` to merge the documents into a single PDF file.", + "default": false + }, + "remove_tags": { + "type": "boolean", + "description": "Pass `false` to disable the removal of {{text}} tags from the PDF. This can be used along with transparent text tags for faster and more robust PDF processing.", + "default": true + } + } + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "id", + "submitters", + "source", + "submitters_order", + "status", + "documents", + "expire_at", + "created_at" + ], + "properties": { + "id": { + "type": "integer", + "description": "Submission unique ID number." + }, + "name": { + "type": "string", + "description": "Submission name." + }, + "submitters": { + "type": "array", + "description": "The list of submitters.", + "items": { + "type": "object", + "required": [ + "id", + "submission_id", + "uuid", + "email", + "slug", + "sent_at", + "opened_at", + "completed_at", + "declined_at", + "created_at", + "updated_at", + "name", + "phone", + "status", + "role", + "metadata", + "preferences" + ], + "properties": { + "id": { + "type": "integer", + "description": "Submission unique ID number." + }, + "uuid": { + "type": "string", + "description": "Submitter UUID." + }, + "email": { + "type": "string", + "nullable": true, + "description": "The email address of the submitter." + }, + "slug": { + "type": "string", + "description": "Unique key to be used in the form signing link and embedded form." + }, + "sent_at": { + "type": "string", + "nullable": true, + "description": "The date and time when the signing request was sent to the submitter." + }, + "opened_at": { + "type": "string", + "nullable": true, + "description": "The date and time when the submitter opened the signing form." + }, + "completed_at": { + "type": "string", + "nullable": true, + "description": "The date and time when the submitter completed the signing form." + }, + "declined_at": { + "type": "string", + "nullable": true, + "description": "The date and time when the submitter declined to complete the signing form." + }, + "created_at": { + "type": "string", + "description": "The date and time when the submitter was created." + }, + "updated_at": { + "type": "string", + "description": "The date and time when the submitter was last updated." + }, + "name": { + "type": "string", + "nullable": true, + "description": "Submitter name." + }, + "phone": { + "type": "string", + "nullable": true, + "description": "Submitter phone number." + }, + "external_id": { + "type": "string", + "nullable": true, + "description": "Your application-specific unique string key to identify this submitter within your app." + }, + "status": { + "type": "string", + "description": "The status of signing request for the submitter.", + "enum": [ + "completed", + "declined", + "opened", + "sent", + "awaiting" + ] + }, + "role": { + "type": "string", + "description": "The role of the submitter." + }, + "metadata": { + "type": "object", + "description": "Metadata object with additional submitter information." + }, + "preferences": { + "type": "object", + "description": "Object with submitter preferences." + }, + "embed_src": { + "type": "string", + "description": "The `src` URL value to embed the signing form or sign via a link." + } + } + } + }, + "source": { + "type": "string", + "description": "The source of the submission.", + "enum": [ + "invite", + "bulk", + "api", + "embed", + "link" + ] + }, + "submitters_order": { + "type": "string", + "description": "The order of submitters.", + "enum": [ + "random", + "preserved" + ] + }, + "status": { + "type": "string", + "description": "The status of the submission.", + "enum": [ + "completed", + "declined", + "expired", + "pending" + ] + }, + "schema": { + "type": "array", + "description": "The one-off submission document files.", + "items": { + "type": "object", + "properties": { + "attachment_uuid": { + "type": "string", + "description": "The attachment UUID." + }, + "name": { + "type": "string", + "description": "The attachment name." + } + } + } + }, + "fields": { + "type": "array", + "description": "List of fields to be filled in the one-off submission.", + "items": { + "type": "object", + "required": [ + "uuid", + "submitter_uuid", + "name", + "type", + "required", + "areas" + ], + "properties": { + "uuid": { + "type": "string", + "description": "Unique identifier of the field." + }, + "submitter_uuid": { + "type": "string", + "description": "Unique identifier of the submitter that filled the field." + }, + "name": { + "type": "string", + "description": "Field name." + }, + "type": { + "type": "string", + "description": "Type of the field (e.g., text, signature, date, initials).", + "enum": [ + "heading", + "text", + "signature", + "initials", + "date", + "number", + "image", + "checkbox", + "multiple", + "file", + "radio", + "select", + "cells", + "stamp", + "payment", + "phone", + "verification" + ] + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is required." + }, + "preferences": { + "type": "object", + "properties": { + "font_size": { + "type": "integer", + "description": "Font size of the field value in pixels." + }, + "font_type": { + "type": "string", + "description": "Font type of the field value." + }, + "font": { + "type": "string", + "description": "Font family of the field value." + }, + "color": { + "type": "string", + "description": "Font color of the field value." + }, + "align": { + "type": "string", + "description": "Horizontal alignment of the field text value." + }, + "valign": { + "type": "string", + "description": "Vertical alignment of the field text value." + }, + "format": { + "type": "string", + "description": "The data format for different field types." + }, + "price": { + "type": "number", + "description": "Price value of the payment field. Only for payment fields." + }, + "currency": { + "type": "string", + "description": "Currency value of the payment field. Only for payment fields." + }, + "mask": { + "type": "boolean", + "description": "Indicates if the field is masked on the document." + } + } + }, + "areas": { + "type": "array", + "description": "List of areas where the field is located in the document.", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "attachment_uuid", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X coordinate of the area where the field is located in the document." + }, + "y": { + "type": "number", + "description": "Y coordinate of the area where the field is located in the document." + }, + "w": { + "type": "number", + "description": "Width of the area where the field is located in the document." + }, + "h": { + "type": "number", + "description": "Height of the area where the field is located in the document." + }, + "attachment_uuid": { + "type": "string", + "description": "Unique identifier of the attached document where the field is located." + }, + "page": { + "type": "integer", + "description": "Page number of the attached document where the field is located." + } + } + } + } + } + } + }, + "documents": { + "type": "array", + "description": "List of documents attached to the one-off submission.", + "items": { + "type": "object", + "required": [ + "attachment_uuid", + "name" + ], + "properties": { + "attachment_uuid": { + "type": "string", + "description": "Unique indentifier of attached document to the one-off submission." + }, + "name": { + "type": "string", + "description": "Name of the attached document to the one-off submission." + } + } + } + }, + "expire_at": { + "type": "string", + "description": "Specify the expiration date and time after which the submission becomes unavailable for signature.", + "example": "2024-09-01 12:00:00 UTC" + }, + "created_at": { + "type": "string", + "description": "The date and time when the submission was created." + } + } + }, + "example": { + "id": 5, + "name": "Test Submission", + "submitters": [ + { + "id": 1, + "uuid": "884d545b-3396-49f1-8c07-05b8b2a78755", + "email": "john.doe@example.com", + "slug": "pAMimKcyrLjqVt", + "sent_at": "2025-06-02T15:55:51.310Z", + "opened_at": null, + "completed_at": null, + "declined_at": null, + "created_at": "2025-06-02T15:55:50.320Z", + "updated_at": "2025-06-02T15:55:50.320Z", + "name": "string", + "phone": "+1234567890", + "external_id": "2321", + "metadata": { + "customData": "custom value" + }, + "status": "sent", + "values": [ + { + "field": "Full Name", + "value": "John Doe" + } + ], + "preferences": { + "send_email": true, + "send_sms": false, + "reply_to": "reply@example.com", + "completed_redirect_url": "https://example.com/" + }, + "role": "First Party", + "embed_src": "https://docuseal.com/s/pAMimKcyrLjqVt" + } + ], + "source": "api", + "submitters_order": "preserved", + "status": "pending", + "schema": [ + { + "name": "Demo PDF", + "attachment_uuid": "48d2998f-266b-47e4-beb2-250ab7ccebdf" + } + ], + "fields": [ + { + "name": "Name", + "type": "text", + "required": true, + "uuid": "d0bf3c0c-1928-40c8-80f9-d9f3c6ad4eff", + "submitter_uuid": "0b0bff58-bc9a-475d-b4a9-2f3e5323faf7", + "areas": [ + { + "page": 1, + "attachment_uuid": "48d2998f-266b-47e4-beb2-250ab7ccebdf", + "x": 0.403158189124654, + "y": 0.04211750189825361, + "w": 0.100684625476058, + "h": 0.01423690205011389 + } + ] + } + ], + "expire_at": null, + "created_at": "2025-06-02T15:55:50.270Z" + } + } + } + } + } + } + }, + "/submissions/docx": { + "post": { + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from DOCX", + "description": "The API endpoint provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use [[variable_name]] text tags to define dynamic content variables in the document. See https://www.docuseal.com/examples/demo_template.docx for the specific text variable syntax, including dynamic content tables and list. You can also use the {{signature}} fillable field syntax to define fillable fields, as in a PDF.
Related Guides
Use embedded text field tags to create a fillable form", + "operationId": "createSubmissionFromDocx", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "documents", + "submitters" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document submission.", + "example": "Test Submission Document" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "variables": { + "type": "object", + "description": "Dynamic content variables object", + "example": { + "variable_name": "value" + } + }, + "order": { + "type": "string", + "description": "Pass 'random' to send signature request emails to all parties right away. The order is 'preserved' by default so the second party will receive a signature request email only after the document is signed by the first party.", + "default": "preserved", + "enum": [ + "preserved", + "random" + ] + }, + "completed_redirect_url": { + "type": "string", + "description": "Specify URL to redirect to after the submission completion." + }, + "bcc_completed": { + "type": "string", + "description": "Specify BCC address to send signed documents to after the completion." + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails." + }, + "expire_at": { + "type": "string", + "description": "Specify the expiration date and time after which the submission becomes unavailable for signature.", + "example": "2024-09-01 12:00:00 UTC" + }, + "template_ids": { + "type": "array", + "description": "An optional array of template IDs to use in the submission along with the provided documents. This can be used to create multi-document submissions when some of the required documents exist within templates.", + "items": { + "type": "integer", + "description": "The ID of the template to use for the submission." + } + }, + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "file" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL." + }, + "position": { + "type": "integer", + "description": "Document position in the submission. If not specified, the document will be added in the order it appears in the documents array." + } + } + } + }, + "submitters": { + "type": "array", + "description": "The list of submitters for the submission.", + "items": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the submitter." + }, + "role": { + "type": "string", + "description": "The role name or title of the submitter.", + "example": "First Party" + }, + "email": { + "type": "string", + "description": "The email address of the submitter.", + "format": "email", + "example": "john.doe@example.com" + }, + "phone": { + "type": "string", + "description": "The phone number of the submitter, formatted according to the E.164 standard.", + "example": "+1234567890" + }, + "values": { + "type": "object", + "description": "An object with pre-filled values for the submission. Use field names for keys of the object. For more configurations see `fields` param." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this submitter within your app." + }, + "completed": { + "type": "boolean", + "description": "Pass `true` to mark submitter as completed and auto-signed via API." + }, + "metadata": { + "type": "object", + "description": "Metadata object with additional submitter information.", + "example": "{ \"customField\": \"value\" }" + }, + "send_email": { + "type": "boolean", + "description": "Set `false` to disable signature request emails sending only for this submitter.", + "default": true + }, + "send_sms": { + "type": "boolean", + "description": "Set `true` to send signature request via phone number and SMS.", + "default": false + }, + "reply_to": { + "type": "string", + "description": "Specify Reply-To address to use in the notification emails for this submitter." + }, + "completed_redirect_url": { + "type": "string", + "description": "Submitter specific URL to redirect to after the submission completion." + }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, "require_phone_2fa": { "type": "boolean", "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", @@ -3494,14 +4389,45 @@ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -3621,11 +4547,6 @@ } } }, - "flatten": { - "type": "boolean", - "description": "Remove PDF form fields from the documents.", - "default": false - }, "merge_documents": { "type": "boolean", "description": "Set `true` to merge the documents into a single PDF file.", @@ -4268,6 +5189,10 @@ "type": "string", "description": "Submitter specific URL to redirect to after the submission completion." }, + "order": { + "type": "integer", + "description": "The order of the submitter in the workflow (e.g., 0 for the first signer, 1 for the second, etc.). Use the same order number to create order groups. By default, submitters are ordered as in the submitters array." + }, "require_phone_2fa": { "type": "boolean", "description": "Set to `true` to require phone 2FA verification via a one-time code sent to the phone number in order to access the documents.", @@ -4335,14 +5260,45 @@ "type": "string", "description": "Field description displayed on the signing form. Supports Markdown." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -5403,14 +6359,45 @@ "type": "boolean", "description": "Set `true` to make the field required." }, - "validation_pattern": { - "type": "string", - "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", - "example": "[A-Z]{4}" - }, - "invalid_message": { - "type": "string", - "description": "A custom message to display on pattern validation failure." + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } }, "preferences": { "type": "object", @@ -7749,6 +8736,46 @@ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { @@ -8412,6 +9439,46 @@ "Option B" ] }, + "validation": { + "type": "object", + "properties": { + "pattern": { + "type": "string", + "description": "HTML field validation pattern string based on https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern specification.", + "example": "[A-Z]{4}" + }, + "message": { + "type": "string", + "description": "A custom error message to display on validation failure." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Minimum allowed number value or date depending on field type." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } + ], + "description": "Maximum allowed number value or date depending on field type." + }, + "step": { + "type": "number", + "description": "Increment step for number field. Pass 1 to accept only integers, or 0.01 to accept decimal currency." + } + } + }, "preferences": { "type": "object", "properties": { diff --git a/docs/webhooks/form-webhook.md b/docs/webhooks/form-webhook.md index 439eb924..32c0eb19 100644 --- a/docs/webhooks/form-webhook.md +++ b/docs/webhooks/form-webhook.md @@ -146,6 +146,10 @@ During the form filling and signing process, 3 types of events may occur and are "type": "string", "description": "The submission URL." }, + "variables": { + "type": "object", + "description": "Dynamic content variables object." + }, "created_at": { "type": "string", "description": "The submission creation date.", diff --git a/docs/webhooks/submission-webhook.md b/docs/webhooks/submission-webhook.md index 0ebf659c..15e1bcbd 100644 --- a/docs/webhooks/submission-webhook.md +++ b/docs/webhooks/submission-webhook.md @@ -216,6 +216,10 @@ Get submission creation, completion, expiration, and archiving notifications usi } } }, + "variables": { + "type": "object", + "description": "Dynamic content variables object." + }, "created_by_user": { "type": "object", "properties": { From 7bc21520579a652d8ef6269d0cb041ec226912d3 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sat, 13 Sep 2025 18:10:47 +0300 Subject: [PATCH 08/11] expire disk storage urls --- config/storage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/storage.yml b/config/storage.yml index e6fca35e..389cffd1 100644 --- a/config/storage.yml +++ b/config/storage.yml @@ -1,7 +1,7 @@ disk: service: Disk root: <%= ENV['WORKDIR'] || '.' %>/attachments - public: true + public: <%= ENV['ACTIVE_STORAGE_PUBLIC'] == 'true' %> aws_s3: service: S3 From 86d680cfdf3fe826835b9865f2945b25b8da1bd1 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Mon, 15 Sep 2025 08:57:54 +0300 Subject: [PATCH 09/11] fix variables schema --- lib/submissions/create_from_submitters.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/submissions/create_from_submitters.rb b/lib/submissions/create_from_submitters.rb index 6d5e78c9..5aaef47f 100644 --- a/lib/submissions/create_from_submitters.rb +++ b/lib/submissions/create_from_submitters.rb @@ -142,8 +142,9 @@ module Submissions if template_fields != (submission.template_fields || submission.template.fields) || submitters_attrs.any? { |e| e[:completed].present? } || !with_template || submission.variables.present? submission.template_fields = template_fields - submission.variables_schema = submission.template.variables_schema if submission.variables_schema.blank? submission.template_schema = submission.template.schema if submission.template_schema.blank? + submission.variables_schema = submission.template.variables_schema if submission.template_id && + submission.variables_schema.blank? end submission From 04e7f101be84fbed8b0f97aa837e3d0cbe51fea8 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Mon, 15 Sep 2025 09:10:03 +0300 Subject: [PATCH 10/11] add lock events --- app/controllers/api/submissions_controller.rb | 2 +- .../submissions_download_controller.rb | 2 +- app/jobs/process_submitter_completion_job.rb | 4 +- app/models/lock_event.rb | 25 +++++++ .../20250915060548_create_lock_events.rb | 14 ++++ db/schema.rb | 11 ++- lib/submissions/ensure_audit_generated.rb | 74 +++++++++++++++++++ lib/submissions/ensure_combined_generated.rb | 74 +++++++++++++++++++ lib/submissions/ensure_result_generated.rb | 17 ++--- lib/submissions/serialize_for_api.rb | 2 +- 10 files changed, 210 insertions(+), 15 deletions(-) create mode 100644 app/models/lock_event.rb create mode 100644 db/migrate/20250915060548_create_lock_events.rb create mode 100644 lib/submissions/ensure_audit_generated.rb create mode 100644 lib/submissions/ensure_combined_generated.rb diff --git a/app/controllers/api/submissions_controller.rb b/app/controllers/api/submissions_controller.rb index 193226df..8388f704 100644 --- a/app/controllers/api/submissions_controller.rb +++ b/app/controllers/api/submissions_controller.rb @@ -43,7 +43,7 @@ module Api end if @submission.audit_trail_attachment.blank? && submitters.all?(&:completed_at?) - @submission.audit_trail_attachment = Submissions::GenerateAuditTrail.call(@submission) + @submission.audit_trail_attachment = Submissions::EnsureAuditGenerated.call(@submission) end render json: Submissions::SerializeForApi.call(@submission, submitters, params) diff --git a/app/controllers/submissions_download_controller.rb b/app/controllers/submissions_download_controller.rb index 62836650..4bcd3237 100644 --- a/app/controllers/submissions_download_controller.rb +++ b/app/controllers/submissions_download_controller.rb @@ -70,7 +70,7 @@ class SubmissionsDownloadController < ApplicationController return if submitter.submission.submitters.order(:completed_at).last != submitter attachment = submitter.submission.combined_document_attachment - attachment ||= Submissions::GenerateCombinedAttachment.call(submitter) + attachment ||= Submissions::EnsureCombinedGenerated.call(submitter) filename_format = AccountConfig.find_or_initialize_by(account_id: submitter.account_id, key: AccountConfig::DOCUMENT_FILENAME_FORMAT_KEY)&.value diff --git a/app/jobs/process_submitter_completion_job.rb b/app/jobs/process_submitter_completion_job.rb index a4b58a5a..f2bc4606 100644 --- a/app/jobs/process_submitter_completion_job.rb +++ b/app/jobs/process_submitter_completion_job.rb @@ -14,10 +14,10 @@ class ProcessSubmitterCompletionJob if is_all_completed && submitter.completed_at == submitter.submission.submitters.maximum(:completed_at) if submitter.submission.account.account_configs.exists?(key: AccountConfig::COMBINE_PDF_RESULT_KEY, value: true) - Submissions::GenerateCombinedAttachment.call(submitter) + Submissions::EnsureCombinedGenerated.call(submitter) end - Submissions::GenerateAuditTrail.call(submitter.submission) + Submissions::EnsureAuditGenerated.call(submitter.submission) enqueue_completed_emails(submitter) end diff --git a/app/models/lock_event.rb b/app/models/lock_event.rb new file mode 100644 index 00000000..5b63b034 --- /dev/null +++ b/app/models/lock_event.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: lock_events +# +# id :bigint not null, primary key +# event_name :string not null +# key :string not null +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_lock_events_on_event_name_and_key (event_name,key) UNIQUE WHERE ((event_name)::text = ANY ((ARRAY['start'::character varying, 'complete'::character varying])::text[])) +# index_lock_events_on_key (key) +# +class LockEvent < ApplicationRecord + enum :event_name, { + complete: 'complete', + fail: 'fail', + start: 'start', + retry: 'retry' + }, scope: false +end diff --git a/db/migrate/20250915060548_create_lock_events.rb b/db/migrate/20250915060548_create_lock_events.rb new file mode 100644 index 00000000..4fb101ed --- /dev/null +++ b/db/migrate/20250915060548_create_lock_events.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class CreateLockEvents < ActiveRecord::Migration[8.0] + def change + create_table :lock_events do |t| + t.string :key, index: true, null: false + t.string :event_name, null: false + + t.index %i[event_name key], unique: true, where: "event_name IN ('start', 'complete')" + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 6f4e7406..deff3e5a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2025_09_12_090605) do +ActiveRecord::Schema[8.0].define(version: 2025_09_15_060548) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" enable_extension "plpgsql" @@ -217,6 +217,15 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_12_090605) do t.index ["user_id"], name: "index_encrypted_user_configs_on_user_id" end + create_table "lock_events", force: :cascade do |t| + t.string "key", null: false + t.string "event_name", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["event_name", "key"], name: "index_lock_events_on_event_name_and_key", unique: true, where: "((event_name)::text = ANY ((ARRAY['start'::character varying, 'complete'::character varying])::text[]))" + t.index ["key"], name: "index_lock_events_on_key" + end + create_table "oauth_access_grants", force: :cascade do |t| t.bigint "resource_owner_id", null: false t.bigint "application_id", null: false diff --git a/lib/submissions/ensure_audit_generated.rb b/lib/submissions/ensure_audit_generated.rb new file mode 100644 index 00000000..19e1b186 --- /dev/null +++ b/lib/submissions/ensure_audit_generated.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +module Submissions + module EnsureAuditGenerated + WAIT_FOR_RETRY = 2.seconds + CHECK_EVENT_INTERVAL = 1.second + CHECK_COMPLETE_TIMEOUT = 90.seconds + KEY_PREFIX = 'audit_trail' + + WaitForCompleteTimeout = Class.new(StandardError) + NotCompletedYet = Class.new(StandardError) + + module_function + + def call(submission) + return nil unless submission + + raise NotCompletedYet unless submission.submitters.all?(&:completed_at?) + + key = [KEY_PREFIX, submission.id].join(':') + + if ApplicationRecord.uncached { LockEvent.exists?(key:, event_name: :complete) } + return submission.audit_trail_attachment + end + + events = ApplicationRecord.uncached { LockEvent.where(key:).order(:id).to_a } + + if events.present? && events.last.event_name.in?(%w[start retry]) + wait_for_complete_or_fail(submission) + else + LockEvent.create!(key:, event_name: events.present? ? :retry : :start) + + result = Submissions::GenerateAuditTrail.call(submission) + + LockEvent.create!(key:, event_name: :complete) + + result + end + rescue ActiveRecord::RecordNotUnique + sleep WAIT_FOR_RETRY + + retry + rescue StandardError => e + Rollbar.error(e) if defined?(Rollbar) + Rails.logger.error(e) + + LockEvent.create!(key:, event_name: :fail) + + raise + end + + def wait_for_complete_or_fail(submission) + total_wait_time = 0 + + loop do + sleep CHECK_EVENT_INTERVAL + total_wait_time += CHECK_EVENT_INTERVAL + + last_event = + ApplicationRecord.uncached do + LockEvent.where(key: [KEY_PREFIX, submission.id].join(':')).order(:id).last + end + + if last_event.event_name.in?(%w[complete fail]) + break ApplicationRecord.uncached do + ActiveStorage::Attachment.find_by(record: submission, name: 'audit_trail') + end + end + + raise WaitForCompleteTimeout if total_wait_time > CHECK_COMPLETE_TIMEOUT + end + end + end +end diff --git a/lib/submissions/ensure_combined_generated.rb b/lib/submissions/ensure_combined_generated.rb new file mode 100644 index 00000000..d5c04853 --- /dev/null +++ b/lib/submissions/ensure_combined_generated.rb @@ -0,0 +1,74 @@ +# frozen_string_literal: true + +module Submissions + module EnsureCombinedGenerated + WAIT_FOR_RETRY = 2.seconds + CHECK_EVENT_INTERVAL = 1.second + CHECK_COMPLETE_TIMEOUT = 90.seconds + KEY_PREFIX = 'combined_document' + + WaitForCompleteTimeout = Class.new(StandardError) + NotCompletedYet = Class.new(StandardError) + + module_function + + def call(submitter) + return nil unless submitter + + raise NotCompletedYet unless submitter.completed_at? + + key = [KEY_PREFIX, submitter.id].join(':') + + if ApplicationRecord.uncached { LockEvent.exists?(key:, event_name: :complete) } + return submitter.submission.combined_document_attachment + end + + events = ApplicationRecord.uncached { LockEvent.where(key:).order(:id).to_a } + + if events.present? && events.last.event_name.in?(%w[start retry]) + wait_for_complete_or_fail(submitter) + else + LockEvent.create!(key:, event_name: events.present? ? :retry : :start) + + result = Submissions::GenerateCombinedAttachment.call(submitter) + + LockEvent.create!(key:, event_name: :complete) + + result + end + rescue ActiveRecord::RecordNotUnique + sleep WAIT_FOR_RETRY + + retry + rescue StandardError => e + Rollbar.error(e) if defined?(Rollbar) + Rails.logger.error(e) + + LockEvent.create!(key:, event_name: :fail) + + raise + end + + def wait_for_complete_or_fail(submitter) + total_wait_time = 0 + + loop do + sleep CHECK_EVENT_INTERVAL + total_wait_time += CHECK_EVENT_INTERVAL + + last_event = + ApplicationRecord.uncached do + LockEvent.where(key: [KEY_PREFIX, submitter.id].join(':')).order(:id).last + end + + if last_event.event_name.in?(%w[complete fail]) + break ApplicationRecord.uncached do + ActiveStorage::Attachment.find_by(record: submitter.submission, name: 'combined_document') + end + end + + raise WaitForCompleteTimeout if total_wait_time > CHECK_COMPLETE_TIMEOUT + end + end + end +end diff --git a/lib/submissions/ensure_result_generated.rb b/lib/submissions/ensure_result_generated.rb index 423f3097..29563d49 100644 --- a/lib/submissions/ensure_result_generated.rb +++ b/lib/submissions/ensure_result_generated.rb @@ -16,21 +16,20 @@ module Submissions raise NotCompletedYet unless submitter.completed_at? - return submitter.documents if ApplicationRecord.uncached { submitter.document_generation_events.complete.exists? } + key = ['result_attachments', submitter.id].join(':') - events = - ApplicationRecord.uncached do - DocumentGenerationEvent.where(submitter:).order(:created_at).to_a - end + return submitter.documents if ApplicationRecord.uncached { LockEvent.exists?(key:, event_name: :complete) } + + events = ApplicationRecord.uncached { LockEvent.where(key:).order(:id).to_a } if events.present? && events.last.event_name.in?(%w[start retry]) wait_for_complete_or_fail(submitter) else - submitter.document_generation_events.create!(event_name: events.present? ? :retry : :start) + LockEvent.create!(key:, event_name: events.present? ? :retry : :start) documents = GenerateResultAttachments.call(submitter) - submitter.document_generation_events.create!(event_name: :complete) + LockEvent.create!(key:, event_name: :complete) documents end @@ -42,7 +41,7 @@ module Submissions Rollbar.error(e) if defined?(Rollbar) Rails.logger.error(e) - submitter.document_generation_events.create!(event_name: :fail) + LockEvent.create!(key:, event_name: :fail) raise end @@ -56,7 +55,7 @@ module Submissions last_event = ApplicationRecord.uncached do - DocumentGenerationEvent.where(submitter:).order(:created_at).last + LockEvent.where(key: ['result_attachments', submitter.id].join(':')).order(:id).last end break submitter.documents.reload if last_event.event_name.in?(%w[complete fail]) diff --git a/lib/submissions/serialize_for_api.rb b/lib/submissions/serialize_for_api.rb index d06bbb42..0366ebc5 100644 --- a/lib/submissions/serialize_for_api.rb +++ b/lib/submissions/serialize_for_api.rb @@ -74,7 +74,7 @@ module Submissions if !attachment && params[:include].to_s.include?('combined_document_url') submitter = submitters.max_by(&:completed_at) - attachment = Submissions::GenerateCombinedAttachment.call(submitter) + attachment = Submissions::EnsureCombinedGenerated.call(submitter) end ActiveStorage::Blob.proxy_url(attachment.blob, expires_at:) if attachment From 0361fabb6649c32c955364864ab8c7f0ec22c0c3 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Mon, 15 Sep 2025 10:53:05 +0300 Subject: [PATCH 11/11] fix combined download --- lib/submissions/generate_audit_trail.rb | 12 +++++++++++- lib/submitters.rb | 5 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/submissions/generate_audit_trail.rb b/lib/submissions/generate_audit_trail.rb index 7d793112..6413c68b 100644 --- a/lib/submissions/generate_audit_trail.rb +++ b/lib/submissions/generate_audit_trail.rb @@ -198,7 +198,7 @@ module Submissions composer.draw_box(divider) - documents_data = Submitters.select_attachments_for_download(last_submitter).map do |document| + documents_data = select_attachments(last_submitter).map do |document| original_documents = submission.schema_documents.select do |e| e.uuid == (document.metadata['original_uuid'] || document.uuid) end.presence @@ -479,6 +479,16 @@ module Submissions 'Signed with DocuSeal.com' end + def select_attachments(submitter) + original_documents = submitter.submission.schema_documents.preload(:blob) + is_more_than_two_images = original_documents.count(&:image?) > 1 + + submitter.documents.preload(:blob).reject do |attachment| + is_more_than_two_images && + original_documents.find { |a| a.uuid == (attachment.metadata['original_uuid'] || attachment.uuid) }&.image? + end + end + def maybe_add_background(_canvas, _submission, _page_size); end def show_verify?(submission) diff --git a/lib/submitters.rb b/lib/submitters.rb index 2eef2f9b..5a003419 100644 --- a/lib/submitters.rb +++ b/lib/submitters.rb @@ -94,8 +94,9 @@ module Submitters def select_attachments_for_download(submitter) if AccountConfig.exists?(account_id: submitter.submission.account_id, key: AccountConfig::COMBINE_PDF_RESULT_KEY, - value: true) && submitter.submission.combined_document_attachment - return [submitter.submission.combined_document_attachment] + value: true) && + submitter.submission.submitters.all?(&:completed_at?) + return [submitter.submission.combined_document_attachment || Submissions::EnsureCombinedGenerated.call(submitter)] end original_documents = submitter.submission.schema_documents.preload(:blob)