From e12ec9d9862b07c2482d6d18c739d1c8f0d54433 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Mon, 8 Dec 2025 16:20:54 +0200 Subject: [PATCH 01/16] fix build --- .github/workflows/docker.yml | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0b6c25f9..2eb09ddc 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,27 +1,14 @@ name: Build Docker Images on: - workflow_dispatch: - inputs: - version: - description: Version - type: string - required: true - image: - description: QEMU image - type: string - required: false - default: tonistiigi/binfmt:latest - os: - description: OS - type: string - required: false - default: ubuntu-24.04-arm + push: + tags: + - "*.*.*" jobs: build: - runs-on: ${{ inputs.os }} - timeout-minutes: 20 + runs-on: ubuntu-24.04-arm + timeout-minutes: 30 steps: - name: Checkout code @@ -34,18 +21,16 @@ jobs: uses: docker/metadata-action@v4 with: images: docuseal/docuseal - tags: latest,${{ inputs.version }} + tags: type=semver,pattern={{version}} - name: Set up QEMU uses: docker/setup-qemu-action@v3 - with: - image: ${{ inputs.image }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Create .version file - run: echo ${{ inputs.version }} > .version + run: echo ${{ github.ref_name }} > .version - name: Login to Docker Hub uses: docker/login-action@v3 From 7a33444f9b482be6bed0456c9a3d535e0f5222bd Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Tue, 9 Dec 2025 11:35:30 +0200 Subject: [PATCH 02/16] add invite_by --- app/controllers/api/submissions_controller.rb | 2 +- lib/params/submission_create_validator.rb | 6 +++++- lib/submissions/create_from_submitters.rb | 12 ++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/submissions_controller.rb b/app/controllers/api/submissions_controller.rb index 15223276..9477b456 100644 --- a/app/controllers/api/submissions_controller.rb +++ b/app/controllers/api/submissions_controller.rb @@ -188,7 +188,7 @@ module Api 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, - :require_phone_2fa, :order, + :require_phone_2fa, :order, :invite_by, { metadata: {}, values: {}, roles: [], readonly_fields: [], message: %i[subject body], fields: [:name, :uuid, :default_value, :value, :title, :description, :readonly, :required, :validation_pattern, :invalid_message, diff --git a/lib/params/submission_create_validator.rb b/lib/params/submission_create_validator.rb index 8ce3becf..39b4f3cd 100644 --- a/lib/params/submission_create_validator.rb +++ b/lib/params/submission_create_validator.rb @@ -71,7 +71,11 @@ module Params end def validate_submitter(submitter_params) - required(submitter_params, %i[email phone name]) + if submitter_params['invite_by'].present? + required(submitter_params, :role) + else + required(submitter_params, %i[email phone name]) + end type(submitter_params, :name, String) type(submitter_params, :reply_to, String) diff --git a/lib/submissions/create_from_submitters.rb b/lib/submissions/create_from_submitters.rb index 0ae3b09b..0a7e2705 100644 --- a/lib/submissions/create_from_submitters.rb +++ b/lib/submissions/create_from_submitters.rb @@ -81,7 +81,7 @@ module Submissions next if submission.submitters.blank? - maybe_add_invite_submitters(submission, template) + maybe_add_invite_submitters(submission, template, attrs[:submitters]) submission.template = nil unless with_template @@ -102,8 +102,16 @@ module Submissions end end - def maybe_add_invite_submitters(submission, template) + def maybe_add_invite_submitters(submission, template, submitter_attrs) template.submitters.each_with_index do |item, index| + submitter_attr = submitter_attrs.find { |e| e['role'].to_s.casecmp?(item['name'].to_s) } + + if submitter_attr && submitter_attr['invite_by'].present? + invite_by_uuid = template.submitters.find { |s| s['name'] == submitter_attr['invite_by'] }&.dig('uuid') + + item = item.merge('invite_by_uuid' => invite_by_uuid) if invite_by_uuid + end + next if item['invite_by_uuid'].blank? && item['optional_invite_by_uuid'].blank? next if submission.template_submitters.any? { |e| e['uuid'] == item['uuid'] } From 71aae65bc62d754ceb0724e4e32f10506085aecd Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Tue, 9 Dec 2025 11:46:57 +0200 Subject: [PATCH 03/16] add require email 2fa param --- app/controllers/api/submissions_controller.rb | 4 ++-- app/controllers/api/submitters_controller.rb | 2 +- lib/submitters.rb | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/submissions_controller.rb b/app/controllers/api/submissions_controller.rb index 9477b456..93c2190f 100644 --- a/app/controllers/api/submissions_controller.rb +++ b/app/controllers/api/submissions_controller.rb @@ -182,13 +182,13 @@ module Api def submissions_params permitted_attrs = [ :send_email, :send_sms, :bcc_completed, :completed_redirect_url, :reply_to, :go_to_last, - :require_phone_2fa, :expire_at, :name, + :require_phone_2fa, :require_email_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, - :require_phone_2fa, :order, :invite_by, + :require_phone_2fa, :require_email_2fa, :order, :invite_by, { metadata: {}, values: {}, roles: [], readonly_fields: [], message: %i[subject body], fields: [:name, :uuid, :default_value, :value, :title, :description, :readonly, :required, :validation_pattern, :invalid_message, diff --git a/app/controllers/api/submitters_controller.rb b/app/controllers/api/submitters_controller.rb index e7635591..e56eb8b8 100644 --- a/app/controllers/api/submitters_controller.rb +++ b/app/controllers/api/submitters_controller.rb @@ -84,7 +84,7 @@ module Api submitter_params.permit( :send_email, :send_sms, :reply_to, :completed_redirect_url, :uuid, :name, :email, :role, - :completed, :phone, :application_key, :external_id, :go_to_last, :require_phone_2fa, + :completed, :phone, :application_key, :external_id, :go_to_last, :require_phone_2fa, :require_email_2fa, { metadata: {}, values: {}, readonly_fields: [], message: %i[subject body], fields: [[:name, :uuid, :default_value, :value, :required, :readonly, :validation_pattern, :invalid_message, diff --git a/lib/submitters.rb b/lib/submitters.rb index af8e0c69..4d91bf53 100644 --- a/lib/submitters.rb +++ b/lib/submitters.rb @@ -157,6 +157,7 @@ module Submitters preferences['send_email'] = params['send_email'].in?(TRUE_VALUES) if params.key?('send_email') preferences['send_sms'] = params['send_sms'].in?(TRUE_VALUES) if params.key?('send_sms') preferences['require_phone_2fa'] = params['require_phone_2fa'].in?(TRUE_VALUES) if params.key?('require_phone_2fa') + preferences['require_email_2fa'] = params['require_email_2fa'].in?(TRUE_VALUES) if params.key?('require_email_2fa') preferences['bcc_completed'] = params['bcc_completed'] if params.key?('bcc_completed') preferences['reply_to'] = params['reply_to'] if params.key?('reply_to') preferences['go_to_last'] = params['go_to_last'] if params.key?('go_to_last') From e856cf878758f43cfef77cd740c8736dbf22522f Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Wed, 10 Dec 2025 09:13:55 +0200 Subject: [PATCH 04/16] validate redirect url --- lib/download_utils.rb | 44 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/lib/download_utils.rb b/lib/download_utils.rb index 78316b80..dce5427a 100644 --- a/lib/download_utils.rb +++ b/lib/download_utils.rb @@ -1,7 +1,35 @@ # frozen_string_literal: true module DownloadUtils - LOCALHOSTS = %w[0.0.0.0 127.0.0.1 localhost].freeze + LOCALHOSTS = Set[ + '0.0.0.0', + '127.0.0.1', + '127.0.1.1', + 'localhost', + 'localhost.localdomain', + '::1', + '[::1]', + 'ip6-localhost', + 'ip6-loopback', + '127.0.0.0', + '127.255.255.255', + '::', + '0:0:0:0:0:0:0:1', + '[0:0:0:0:0:0:0:1]', + '0000:0000:0000:0000:0000:0000:0000:0001', + '[0000:0000:0000:0000:0000:0000:0000:0001]', + '::0', + '0::0', + '::ffff:127.0.0.1', + '[::ffff:127.0.0.1]', + '::ffff:7f00:1', + '[::ffff:7f00:1]', + 'local', + 'localhost.local', + 'ip6-localnet', + 'ip6-allnodes', + 'ip6-allrouters' + ].freeze UnableToDownload = Class.new(StandardError) @@ -14,10 +42,7 @@ module DownloadUtils Addressable::URI.parse(url).normalize end - if Docuseal.multitenant? - raise UnableToDownload, "Error loading: #{uri}. Only HTTPS is allowed." if uri.scheme != 'https' - raise UnableToDownload, "Error loading: #{uri}. Can't download from localhost." if uri.host.in?(LOCALHOSTS) - end + validate_uri!(uri) if Docuseal.multitenant? resp = conn.get(uri) @@ -26,9 +51,16 @@ module DownloadUtils resp end + def validate_uri!(uri) + raise UnableToDownload, "Error loading: #{uri}. Only HTTPS is allowed." if uri.scheme != 'https' + raise UnableToDownload, "Error loading: #{uri}. Can't download from localhost." if uri.host.in?(LOCALHOSTS) + end + def conn Faraday.new do |faraday| - faraday.response :follow_redirects + faraday.response :follow_redirects, callback: lambda { |_, new_env| + validate_uri!(new_env[:url]) if Docuseal.multitenant? + } end end end From c71fb044043c1aa4136c6c30791d6e90c5029def Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Wed, 10 Dec 2025 11:51:07 +0200 Subject: [PATCH 05/16] fix mysql migration --- .../20251121092044_add_is_first_to_completed_submitters.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/migrate/20251121092044_add_is_first_to_completed_submitters.rb b/db/migrate/20251121092044_add_is_first_to_completed_submitters.rb index baa59d33..1b3adf0f 100644 --- a/db/migrate/20251121092044_add_is_first_to_completed_submitters.rb +++ b/db/migrate/20251121092044_add_is_first_to_completed_submitters.rb @@ -9,6 +9,8 @@ class AddIsFirstToCompletedSubmitters < ActiveRecord::Migration[8.0] add_index :completed_submitters, %i[account_id completed_at], where: 'is_first = TRUE', name: 'index_completed_submitters_account_id_completed_at_is_first' - add_index :completed_submitters, :submission_id, unique: true, where: 'is_first = TRUE' + + add_index :completed_submitters, :submission_id, unique: adapter_name != 'Mysql2', + where: 'is_first = TRUE' end end From bb752fbc0028ba6d0dee4b7a151e441e78d8d442 Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Thu, 11 Dec 2025 10:28:07 +0200 Subject: [PATCH 06/16] update translations --- app/javascript/submission_form/i18n.js | 28 +++++++++---------- .../submission_form/signature_step.vue | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/javascript/submission_form/i18n.js b/app/javascript/submission_form/i18n.js index b5f02eec..d045eb3a 100644 --- a/app/javascript/submission_form/i18n.js +++ b/app/javascript/submission_form/i18n.js @@ -13,7 +13,7 @@ const en = { esignature_disclosure: 'eSignature Disclosure', signature: 'Signature', initials: 'Initials', - drawn_signature_on_a_touchscreen_device: 'Drawn signature on a touchscreen device', + sign_on_the_touchscreen: 'Sign on the touchscreen', approved: 'Approved', reviewed: 'Reviewed', other: 'Other', @@ -120,7 +120,7 @@ const es = { select_a_reason: 'Selecciona una razón', value_is_invalid: 'El valor no es válido', verification_code_is_invalid: 'El código de verificación no es válido', - drawn_signature_on_a_touchscreen_device: 'Firma dibujada en un dispositivo con pantalla táctil', + sign_on_the_touchscreen: 'Firmar en pantalla táctil', scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Escanea el código QR con la aplicación de la cámara para abrir el formulario en el móvil y dibujar tu firma', by_clicking_you_agree_to_the: 'Al hacer clic en "{button}", usted acepta el', electronic_signature_disclosure: 'Divulgación de Firma Electrónica', @@ -221,7 +221,7 @@ const it = { select_a_reason: 'Seleziona una ragione', value_is_invalid: 'Il valore non è valido', verification_code_is_invalid: 'Il codice di verifica non è valido', - drawn_signature_on_a_touchscreen_device: 'Firma disegnata su un dispositivo con schermo tattile', + sign_on_the_touchscreen: 'Firma su schermo tattile', scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: "Scansiona il codice QR con l'app della fotocamera per aprire il modulo sul cellulare e disegnare la tua firma", by_clicking_you_agree_to_the: 'Cliccando su "{button}", accetti il', electronic_signature_disclosure: 'Divulgazione della Firma Elettronica', @@ -316,7 +316,7 @@ const de = { esignature_disclosure: 'Hinweis zur eSignatur', signature: 'Unterschrift', initials: 'Initialen', - drawn_signature_on_a_touchscreen_device: 'Auf einem Touchscreen-Gerät gezeichnete Unterschrift', + sign_on_the_touchscreen: 'Auf Touchscreen signieren', approved: 'Genehmigt', reviewed: 'Geprüft', other: 'Sonstiges', @@ -417,7 +417,7 @@ const fr = { esignature_disclosure: 'Déclaration eSignature', signature: 'Signature', initials: 'Initiales', - drawn_signature_on_a_touchscreen_device: 'Signature dessinée sur un appareil à écran tactile', + sign_on_the_touchscreen: 'Signer sur écran tactile', approved: 'Approuvé', reviewed: 'Révisé', other: 'Autre', @@ -524,7 +524,7 @@ const pl = { select_a_reason: 'Wybierz powód', value_is_invalid: 'Wartość jest nieprawidłowa', verification_code_is_invalid: 'Kod weryfikacyjny jest nieprawidłowy', - drawn_signature_on_a_touchscreen_device: 'Podpis odręczny na urządzeniu z ekranem dotykowym', + sign_on_the_touchscreen: 'Podpisz na ekranie dotykowym', scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Zeskanuj kod QR za pomocą aplikacji aparatu, aby otworzyć formularz na telefonie i narysować swój podpis', by_clicking_you_agree_to_the: 'Klikając na "{button}", zgadzasz się na', electronic_signature_disclosure: 'Ujawnienie Elektronicznej Sygnatury', @@ -625,7 +625,7 @@ const uk = { select_a_reason: 'Виберіть причину', value_is_invalid: 'Значення є неправильним', verification_code_is_invalid: 'Код підтвердження є неправильним', - drawn_signature_on_a_touchscreen_device: 'Підпис на сенсорному пристрої', + sign_on_the_touchscreen: 'Підписати на сенсорному екрані', scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Скануйте QR-код за допомогою програми камери, щоб відкрити форму на мобільному пристрої та намалювати свій підпис', by_clicking_you_agree_to_the: 'Натиснувши на "{button}", ви погоджуєтеся з', electronic_signature_disclosure: 'Розголошення Електронного Підпису', @@ -726,7 +726,7 @@ const cs = { select_a_reason: 'Vyberte důvod', value_is_invalid: 'Hodnota je neplatná', verification_code_is_invalid: 'Ověřovací kód je neplatný', - drawn_signature_on_a_touchscreen_device: 'Namalovaný podpis na dotykovém zařízení', + sign_on_the_touchscreen: 'Podepsat na dotykové obrazovce', scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Naskenujte QR kód pomocí aplikace fotoaparátu, abyste otevřeli formulář na mobilním zařízení a nakreslili svůj podpis', by_clicking_you_agree_to_the: 'Kliknutím na "{button}" souhlasíte s', electronic_signature_disclosure: 'Zveřejněním Elektronického Podpisu', @@ -827,7 +827,7 @@ const pt = { select_a_reason: 'Selecione um motivo', value_is_invalid: 'Valor é inválido', verification_code_is_invalid: 'Código de verificação é inválido', - drawn_signature_on_a_touchscreen_device: 'Assinatura desenhada em um dispositivo com tela sensível ao toque', + sign_on_the_touchscreen: 'Assinar na tela sensível', scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Escaneie o código QR com o aplicativo da câmera para abrir o formulário no celular e desenhar sua assinatura', by_clicking_you_agree_to_the: 'Ao clicar em "{button}", você concorda com o', electronic_signature_disclosure: 'Divulgação de Assinatura Eletrônica', @@ -928,7 +928,7 @@ const he = { select_a_reason: 'בחר סיבה', value_is_invalid: 'ערך לא תקין', verification_code_is_invalid: 'קוד האימות אינו תקין', - drawn_signature_on_a_touchscreen_device: 'חתימה שנוצרה במכשיר עם מסך מגע', + sign_on_the_touchscreen: 'חתום על מסך המגע', scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'סרוק את קוד ה-QR באמצעות אפליקציית המצלמה כדי לפתוח את הטופס במובייל ולצייר את החתימה שלך', by_clicking_you_agree_to_the: 'על ידי לחיצה על "{button}", אתה מסכים ל', electronic_signature_disclosure: 'חשיפת חתימה אלקטרונית', @@ -1029,7 +1029,7 @@ const nl = { select_a_reason: 'Selecteer een reden', value_is_invalid: 'Waarde is ongeldig', verification_code_is_invalid: 'Verificatiecode is ongeldig', - drawn_signature_on_a_touchscreen_device: 'Getekende handtekening op een apparaat met een touchscreen', + sign_on_the_touchscreen: 'Onderteken op touchscreen', scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'Scan de QR-code met de camera-app om het formulier op mobiel te openen en uw handtekening te tekenen', by_clicking_you_agree_to_the: 'Door op "{button}" te klikken, gaat u akkoord met de', electronic_signature_disclosure: 'Openbaarmaking van Elektronische Handtekening', @@ -1131,7 +1131,7 @@ const ar = { value_is_invalid: 'القيمة غير صالحة', verification_code_is_invalid: 'رمز التحقق غير صالح', already_paid: 'تم الدفع بالفعل', - drawn_signature_on_a_touchscreen_device: 'توقيع مرسوم على جهاز بشاشة تعمل باللمس', + sign_on_the_touchscreen: 'وقع على شاشة اللمس', scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: 'امسح رمز الاستجابة السريعة باستخدام تطبيق الكاميرا لفتح النموذج على الهاتف المحمول ورسم توقيعك', by_clicking_you_agree_to_the: 'بالنقر فوق "{button}"، أنت توافق على', electronic_signature_disclosure: 'كشف التوقيع الإلكتروني', @@ -1229,7 +1229,7 @@ const ko = { reviewed_by: '검토자', authored_by: '작성자', select_a_reason: '이유 선택', - drawn_signature_on_a_touchscreen_device: '터치스크린 장치에서 그린 서명', + sign_on_the_touchscreen: '터치스크린에서 서명', scan_the_qr_code_with_the_camera_app_to_open_the_form_on_mobile_and_draw_your_signature: '카메라 앱으로 QR 코드를 스캔하여 모바일에서 양식을 열고 서명을 그리세요', by_clicking_you_agree_to_the: '"{button}"를 클릭함으로써, 다음에 동의하게 됩니다', electronic_signature_disclosure: '전자 서명 공개', @@ -1326,7 +1326,7 @@ const ja = { esignature_disclosure: '電子署名開示', signature: '署名', initials: 'イニシャル', - drawn_signature_on_a_touchscreen_device: 'タッチスクリーンデバイスで描かれた署名', + sign_on_the_touchscreen: 'タッチスクリーンで署名', approved: '承認済み', reviewed: '確認済み', other: 'その他', diff --git a/app/javascript/submission_form/signature_step.vue b/app/javascript/submission_form/signature_step.vue index cf870735..d3a35b24 100644 --- a/app/javascript/submission_form/signature_step.vue +++ b/app/javascript/submission_form/signature_step.vue @@ -87,7 +87,7 @@ Date: Thu, 11 Dec 2025 10:28:35 +0200 Subject: [PATCH 07/16] add translations --- config/locales/i18n.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/config/locales/i18n.yml b/config/locales/i18n.yml index cfbcaa13..75380e85 100644 --- a/config/locales/i18n.yml +++ b/config/locales/i18n.yml @@ -876,6 +876,7 @@ en: &en you_requested_to_reset_your_password_use_the_link_below_to_continue: You requested to reset your password. Use the link below to continue if_you_didnt_request_this_you_can_ignore_this_email: "If you didn't request this, please ignore this email." your_password_wont_change_until_you_open_the_link_above_and_set_a_new_one: "Your password won't change until you open the link above and set a new one." + too_many_requests_try_again_later: Too many requests, try again later. devise: confirmations: confirmed: Your email address has been successfully confirmed. @@ -1847,6 +1848,7 @@ es: &es you_requested_to_reset_your_password_use_the_link_below_to_continue: Solicitaste restablecer tu contraseña. Usa el enlace a continuación para continuar. if_you_didnt_request_this_you_can_ignore_this_email: "Si no solicitaste esto, puedes ignorar este correo electrónico." your_password_wont_change_until_you_open_the_link_above_and_set_a_new_one: "Tu contraseña no cambiará hasta que abras el enlace anterior y establezcas una nueva." + too_many_requests_try_again_later: Demasiadas solicitudes. Intenta de nuevo más tarde. devise: confirmations: confirmed: Tu dirección de correo electrónico ha sido confirmada correctamente. @@ -2819,6 +2821,7 @@ it: &it you_requested_to_reset_your_password_use_the_link_below_to_continue: Hai richiesto di reimpostare la tua password. Usa il link qui sotto per continuare. if_you_didnt_request_this_you_can_ignore_this_email: "Se non hai richiesto questo, puoi ignorare questa email." your_password_wont_change_until_you_open_the_link_above_and_set_a_new_one: "La tua password non cambierà finché non apri il link sopra e ne imposti una nuova." + too_many_requests_try_again_later: Troppe richieste. Riprova più tardi. devise: confirmations: confirmed: Il tuo indirizzo email è stato confermato con successo. @@ -3787,6 +3790,7 @@ fr: &fr you_requested_to_reset_your_password_use_the_link_below_to_continue: Vous avez demandé à réinitialiser votre mot de passe. Utilisez le lien ci-dessous pour continuer. if_you_didnt_request_this_you_can_ignore_this_email: "Si vous n'avez pas fait cette demande, veuillez ignorer cet e-mail." your_password_wont_change_until_you_open_the_link_above_and_set_a_new_one: "Votre mot de passe ne changera pas tant que vous n’aurez pas ouvert le lien ci-dessus et défini un nouveau mot de passe." + too_many_requests_try_again_later: Trop de demandes. Réessayez plus tard. devise: confirmations: confirmed: Votre adresse e-mail a été confirmée avec succès. @@ -4758,6 +4762,7 @@ pt: &pt you_requested_to_reset_your_password_use_the_link_below_to_continue: Você solicitou a redefinição da sua senha. Use o link abaixo para continuar. if_you_didnt_request_this_you_can_ignore_this_email: "Se você não solicitou isso, pode ignorar este e-mail." your_password_wont_change_until_you_open_the_link_above_and_set_a_new_one: "Sua senha não será alterada até que você abra o link acima e defina uma nova." + too_many_requests_try_again_later: Muitas solicitações. Tente novamente mais tarde. devise: confirmations: confirmed: Seu endereço de e-mail foi confirmado com sucesso. @@ -5729,6 +5734,7 @@ de: &de you_requested_to_reset_your_password_use_the_link_below_to_continue: Sie haben angefordert, Ihr Passwort zurückzusetzen. Verwenden Sie den untenstehenden Link, um fortzufahren. if_you_didnt_request_this_you_can_ignore_this_email: "Wenn Sie dies nicht angefordert haben, können Sie diese E-Mail ignorieren." your_password_wont_change_until_you_open_the_link_above_and_set_a_new_one: "Ihr Passwort wird erst geändert, wenn Sie den obigen Link öffnen und ein neues festlegen." + too_many_requests_try_again_later: Zu viele Anfragen. Versuchen Sie es später erneut. devise: confirmations: confirmed: Ihre E-Mail-Adresse wurde erfolgreich bestätigt. @@ -5938,6 +5944,7 @@ pl: the_sender_has_requested_a_two_factor_authentication_via_one_time_password_sent_to_your_email_html: Nadawca zażądał uwierzytelniania dwuskładnikowego za pośrednictwem hasła jednorazowego wysłanego na Twój adres e-mail %{email}. please_contact_the_requester_to_specify_your_email_for_two_factor_authentication: Skontaktuj się z nadawcą, aby podać swój adres e-mail do uwierzytelniania dwuskładnikowego. rate_limit_exceeded: Przekroczono limit + too_many_requests_try_again_later: Zbyt wiele żądań. Spróbuj ponownie później. uk: require_phone_2fa_to_open: Вимагати двофакторну автентифікацію через телефон для відкриття @@ -6034,6 +6041,7 @@ uk: the_sender_has_requested_a_two_factor_authentication_via_one_time_password_sent_to_your_email_html: Відправник запросив двофакторну автентифікацію за допомогою одноразового пароля, відправленого на вашу електронну пошту %{email}. please_contact_the_requester_to_specify_your_email_for_two_factor_authentication: Будь ласка, зв'яжіться з відправником, щоб вказати вашу електронну пошту для двофакторної автентифікації. rate_limit_exceeded: Перевищено ліміт + too_many_requests_try_again_later: Забагато запитів. Спробуйте пізніше. cs: require_phone_2fa_to_open: Vyžadovat otevření pomocí telefonního 2FA @@ -6130,6 +6138,7 @@ cs: the_sender_has_requested_a_two_factor_authentication_via_one_time_password_sent_to_your_email_html: Odesílatel požádal o dvoufaktorové ověření pomocí jednorázového hesla odeslaného na vaši e-mailovou adresu %{email}. please_contact_the_requester_to_specify_your_email_for_two_factor_authentication: Prosím kontaktujte odesílatele a uveďte svůj e-mail pro dvoufaktorové ověření. rate_limit_exceeded: Překročena hranice + too_many_requests_try_again_later: Příliš mnoho požadavků. Zkuste to později. he: require_phone_2fa_to_open: דרוש אימות דו-שלבי באמצעות טלפון לפתיחה @@ -6226,6 +6235,7 @@ he: the_sender_has_requested_a_two_factor_authentication_via_one_time_password_sent_to_your_email_html: השולח ביקש אימות דו-שלבי באמצעות סיסמה חד-פעמית שנשלחה לכתובת הדוא"ל שלך %{email}. please_contact_the_requester_to_specify_your_email_for_two_factor_authentication: אנא פנה לשולח וציין את כתובת הדוא"ל שלך לאימות דו-שלבי. rate_limit_exceeded: חריגה ממגבלת + too_many_requests_try_again_later: יותר מדי בקשות. נסה שוב מאוחר יותר. nl: &nl templates_that_require_email_or_phone_2fa_cannot_be_used_via_a_shared_link: Sjablonen waarvoor e-mail- of telefoon-2FA vereist is, kunnen niet via een gedeelde link worden gebruikt. @@ -7081,6 +7091,7 @@ nl: &nl you_requested_to_reset_your_password_use_the_link_below_to_continue: Je hebt gevraagd je wachtwoord te resetten. Gebruik de onderstaande link om verder te gaan. if_you_didnt_request_this_you_can_ignore_this_email: "Als je dit niet hebt aangevraagd, kun je deze e-mail negeren." your_password_wont_change_until_you_open_the_link_above_and_set_a_new_one: "Je wachtwoord wordt niet gewijzigd totdat je de bovenstaande link opent en een nieuw wachtwoord instelt." + too_many_requests_try_again_later: Te veel verzoeken. Probeer het later opnieuw. devise: confirmations: confirmed: Je e-mailadres is succesvol bevestigd. @@ -7290,6 +7301,7 @@ ar: the_sender_has_requested_a_two_factor_authentication_via_one_time_password_sent_to_your_email_html: طلب المرسل المصادقة الثنائية عبر كلمة مرور لمرة واحدة مرسلة إلى عنوان بريدك الإلكتروني %{email}. please_contact_the_requester_to_specify_your_email_for_two_factor_authentication: يرجى الاتصال بالمرسل لتحديد عنوان بريدك الإلكتروني للمصادقة الثنائية. rate_limit_exceeded: تم تجاوز الحد المسموح به + too_many_requests_try_again_later: طلبات كثيرة جدًا. حاول مرة أخرى لاحقًا. ko: require_phone_2fa_to_open: 휴대폰 2FA를 열 때 요구함 @@ -7386,6 +7398,7 @@ ko: the_sender_has_requested_a_two_factor_authentication_via_one_time_password_sent_to_your_email_html: 발신자가 %{email} 이메일 주소로 전송된 일회용 비밀번호를 통해 2단계 인증을 요청했습니다. please_contact_the_requester_to_specify_your_email_for_two_factor_authentication: 2단계 인증을 위해 이메일 주소를 지정하려면 발신자에게 문의하세요. rate_limit_exceeded: 속도 제한 초과 + too_many_requests_try_again_later: 요청이 너무 많습니다. 나중에 다시 시도하세요. ja: require_phone_2fa_to_open: 電話による2段階認証が必要です @@ -7482,6 +7495,7 @@ ja: the_sender_has_requested_a_two_factor_authentication_via_one_time_password_sent_to_your_email_html: 送信者は、%{email} メールアドレスに送信されたワンタイムパスワードによる2段階認証を要求しました。 please_contact_the_requester_to_specify_your_email_for_two_factor_authentication: 2段階認証用にメールアドレスを指定するために、送信者にお問い合わせください。 rate_limit_exceeded: レート制限を超えました + too_many_requests_try_again_later: リクエストが多すぎます。後でもう一度お試しください。 en-US: <<: *en From 840ad17258cfc7f41a6cff2dbcbb8395d4af0833 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Thu, 11 Dec 2025 11:11:46 +0200 Subject: [PATCH 08/16] fix locale --- app/jobs/send_submitter_verification_email_job.rb | 4 +++- app/mailers/submitter_mailer.rb | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/jobs/send_submitter_verification_email_job.rb b/app/jobs/send_submitter_verification_email_job.rb index 542d4ae7..a8dec1e4 100644 --- a/app/jobs/send_submitter_verification_email_job.rb +++ b/app/jobs/send_submitter_verification_email_job.rb @@ -6,7 +6,9 @@ class SendSubmitterVerificationEmailJob def perform(params = {}) submitter = Submitter.find(params['submitter_id']) - SubmitterMailer.otp_verification_email(submitter).deliver_now! + locale = params['locale'].presence || submitter.account.locale + + SubmitterMailer.otp_verification_email(submitter, locale:).deliver_now! SubmissionEvent.create!(submitter_id: params['submitter_id'], event_type: 'send_2fa_email', diff --git a/app/mailers/submitter_mailer.rb b/app/mailers/submitter_mailer.rb index a6db0770..18d2f570 100644 --- a/app/mailers/submitter_mailer.rb +++ b/app/mailers/submitter_mailer.rb @@ -144,13 +144,13 @@ class SubmitterMailer < ApplicationMailer end end - def otp_verification_email(submitter) + def otp_verification_email(submitter, locale: nil) @submitter = submitter @otp_code = EmailVerificationCodes.generate([submitter.email.downcase.strip, submitter.slug].join(':')) assign_message_metadata('otp_verification_email', submitter) - I18n.with_locale(submitter.account.locale) do + I18n.with_locale(locale || submitter.account.locale) do mail(to: submitter.email, subject: I18n.t('email_verification')) end end From 676d77554489f5da9450e222aa46da8aab6e115b Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Fri, 12 Dec 2025 09:10:44 +0200 Subject: [PATCH 09/16] fix generation --- lib/submissions/generate_result_attachments.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/submissions/generate_result_attachments.rb b/lib/submissions/generate_result_attachments.rb index e347d2ac..12e74676 100644 --- a/lib/submissions/generate_result_attachments.rb +++ b/lib/submissions/generate_result_attachments.rb @@ -522,10 +522,17 @@ module Submissions if field['type'].in?(%w[multiple radio]) option = field['options']&.find { |o| o['uuid'] == area['option_uuid'] } - option_name = option['value'].presence - option_name ||= "#{I18n.t('option', locale: locale)} #{field['options'].index(option) + 1}" + value = + if option + option_name = option['value'].presence + option_name ||= "#{I18n.t('option', locale: locale)} #{field['options'].index(option) + 1}" - value = Array.wrap(value).include?(option_name) + Array.wrap(value).include?(option_name) + else + Rollbar.error("Invalid option: #{field['uuid']}") if defined?(Rollbar) + + false + end end next unless value == true From d9823feef7ebf90a5966414264306c849c877fd1 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Fri, 12 Dec 2025 09:22:42 +0200 Subject: [PATCH 10/16] fix option --- app/views/submissions/_value.html.erb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/views/submissions/_value.html.erb b/app/views/submissions/_value.html.erb index f0487425..5a8e3d22 100644 --- a/app/views/submissions/_value.html.erb +++ b/app/views/submissions/_value.html.erb @@ -50,12 +50,13 @@ <%= svg_icon('check', class: "aspect-square #{area['w'] > area['h'] ? '!w-auto !h-full' : '!w-full !h-auto'}") %> <% elsif field['type'].in?(%w[multiple radio]) && area['option_uuid'] %> - <% option = field['options']&.find { |o| o['uuid'] == area['option_uuid'] } %> - <% option_name = option['value'].presence || "Option #{field['options'].index(option) + 1}" %> - <% if option && Array.wrap(value).include?(option_name) %> -
- <%= svg_icon('check', class: "aspect-square #{area['w'] > area['h'] ? '!w-auto !h-full' : '!w-full !h-auto'}") %> -
+ <% if (option = field['options']&.find { |o| o['uuid'] == area['option_uuid'] }) %> + <% option_name = option['value'].presence || "Option #{field['options'].index(option) + 1}" %> + <% if Array.wrap(value).include?(option_name) %> +
+ <%= svg_icon('check', class: "aspect-square #{area['w'] > area['h'] ? '!w-auto !h-full' : '!w-full !h-auto'}") %> +
+ <% end %> <% end %> <% elsif field['type'] == 'cells' && area['cell_w'].to_f > 0.0 %> <% cell_width = area['cell_w'] / area['w'] * 100 %> From 4f013ca927bc4881cf4d707ebe6e8dc91ed8d8f7 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Fri, 12 Dec 2025 20:34:53 +0200 Subject: [PATCH 11/16] do not combine with verification --- app/views/submissions/show.html.erb | 2 +- lib/submitters.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/submissions/show.html.erb b/app/views/submissions/show.html.erb index bb1d709f..5ecd9ad9 100644 --- a/app/views/submissions/show.html.erb +++ b/app/views/submissions/show.html.erb @@ -4,7 +4,7 @@ <% font_scale = 1040.0 / PdfUtils::US_LETTER_W %> <% configs = AccountConfig.where(account_id: @submission.account_id, key: [AccountConfig::COMBINE_PDF_RESULT_KEY, AccountConfig::WITH_SIGNATURE_ID, AccountConfig::WITH_SUBMITTER_TIMEZONE_KEY, AccountConfig::WITH_SIGNATURE_ID_REASON_KEY]) %> <% with_signature_id = configs.find { |e| e.key == AccountConfig::WITH_SIGNATURE_ID }&.value == true %> -<% is_combined_enabled = configs.find { |e| e.key == AccountConfig::COMBINE_PDF_RESULT_KEY }&.value == true %> +<% is_combined_enabled = configs.find { |e| e.key == AccountConfig::COMBINE_PDF_RESULT_KEY }&.value == true && !@submission.template_fields&.any? { |f| f['type'] == 'verification' } %> <% with_submitter_timezone = configs.find { |e| e.key == AccountConfig::WITH_SUBMITTER_TIMEZONE_KEY }&.value == true %> <% with_signature_id_reason = configs.find { |e| e.key == AccountConfig::WITH_SIGNATURE_ID_REASON_KEY }&.value != false %>
diff --git a/lib/submitters.rb b/lib/submitters.rb index 4d91bf53..c557dd3e 100644 --- a/lib/submitters.rb +++ b/lib/submitters.rb @@ -106,7 +106,8 @@ module Submitters if AccountConfig.exists?(account_id: submitter.submission.account_id, key: AccountConfig::COMBINE_PDF_RESULT_KEY, value: true) && - submitter.submission.submitters.all?(&:completed_at?) + submitter.submission.submitters.all?(&:completed_at?) && + submitter.submission.template_fields.none? { |f| f['type'] == 'verification' } return [submitter.submission.combined_document_attachment || Submissions::EnsureCombinedGenerated.call(submitter)] end From d7c7efc203b76c2f69435b798168484452737901 Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Fri, 12 Dec 2025 21:44:54 +0200 Subject: [PATCH 12/16] update brakeman ignore rules --- config/brakeman.ignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/brakeman.ignore b/config/brakeman.ignore index 18d7601a..703de070 100644 --- a/config/brakeman.ignore +++ b/config/brakeman.ignore @@ -1,7 +1,7 @@ { "ignored_warnings": [ { - "fingerprint": "bbd1bdad94998e53a48921859065e06cd1595502d4dc40362afcaa90307b591a", + "fingerprint": "de39648cd3f79d51e95e45f05fc77da49b0ad68bf80458061151016c0ef78208", "note": "Permitted parameters are necessary for creating submitters via API" }, { From a621575ffcc3ed29f9646e44f0dda6ae6b1bf8da Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sun, 14 Dec 2025 22:22:45 +0200 Subject: [PATCH 13/16] 11k --- app/views/shared/_github.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shared/_github.html.erb b/app/views/shared/_github.html.erb index c07cc7cc..5bcc786a 100644 --- a/app/views/shared/_github.html.erb +++ b/app/views/shared/_github.html.erb @@ -1,6 +1,6 @@ <%= svg_icon('start', class: 'h-3 w-3') %> - 10k + 11k From 29ff58ed98bbaf4f6a6db608569671ca5ec56c63 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Mon, 15 Dec 2025 10:22:27 +0200 Subject: [PATCH 14/16] fix drawing --- app/javascript/submission_form/form.vue | 2 +- app/javascript/submission_form/initials_step.vue | 6 +++--- app/javascript/submission_form/signature_step.vue | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/javascript/submission_form/form.vue b/app/javascript/submission_form/form.vue index fbd07e74..66b04b64 100644 --- a/app/javascript/submission_form/form.vue +++ b/app/javascript/submission_form/form.vue @@ -537,7 +537,7 @@ />
@@ -57,7 +57,7 @@ @@ -86,7 +86,7 @@
{{ t('by_clicking_you_agree_to_the').replace('{button}', buttonText.charAt(0).toUpperCase() + buttonText.slice(1)) }} Date: Mon, 15 Dec 2025 10:24:23 +0200 Subject: [PATCH 15/16] update docs --- docs/api/csharp.md | 4698 +++++++++--------- docs/api/go.md | 5464 ++++++++++----------- docs/api/java.md | 4676 +++++++++--------- docs/api/javascript.md | 4925 +++++++++---------- docs/api/nodejs.md | 5357 ++++++++++---------- docs/api/php.md | 4893 +++++++++--------- docs/api/python.md | 4937 +++++++++---------- docs/api/ruby.md | 4939 +++++++++---------- docs/api/shell.md | 4688 +++++++++--------- docs/api/typescript.md | 4925 +++++++++---------- docs/embedding/form-builder-angular.md | 17 +- docs/embedding/form-builder-javascript.md | 17 +- docs/embedding/form-builder-react.md | 17 +- docs/embedding/form-builder-vue.md | 17 +- docs/embedding/signing-form-angular.md | 2 +- docs/embedding/signing-form-javascript.md | 2 +- docs/embedding/signing-form-react.md | 2 +- docs/embedding/signing-form-vue.md | 2 +- docs/openapi.json | 539 +- docs/webhooks/submission-webhook.md | 4 + 20 files changed, 24109 insertions(+), 26012 deletions(-) diff --git a/docs/api/csharp.md b/docs/api/csharp.md index 2d4d56a7..a5668413 100644 --- a/docs/api/csharp.md +++ b/docs/api/csharp.md @@ -1,257 +1,3 @@ -### List all templates - -The API endpoint provides the ability to retrieve a list of available document templates. - -```csharp -var client = new RestClient("https://api.docuseal.com/templates"); -var request = new RestRequest("", Method.Get); -request.AddHeader("X-Auth-Token", "API_KEY"); -var response = client.Execute(request); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "List all templates", - "operationId": "getTemplates", - "parameters": [ - { - "name": "q", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates based on the name partial match." - }, - { - "name": "slug", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by unique slug.", - "example": "opaKWh8WWTAcVG" - }, - { - "name": "external_id", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." - }, - { - "name": "folder", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by folder name." - }, - { - "name": "archived", - "in": "query", - "required": false, - "schema": { - "type": "boolean" - }, - "description": "Get only archived templates instead of active ones." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The number of templates to return. Default value is 10. Maximum value is 100." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." - }, - { - "name": "before", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." - } - ] -} -``` - -### Get a template - -The API endpoint provides the functionality to retrieve information about a document template. - -```csharp -var client = new RestClient("https://api.docuseal.com/templates/1000001"); -var request = new RestRequest("", Method.Get); -request.AddHeader("X-Auth-Token", "API_KEY"); -var response = client.Execute(request); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Get a template", - "operationId": "getTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Archive a template - -The API endpoint allows you to archive a document template. - -```csharp -var client = new RestClient("https://api.docuseal.com/templates/1000001"); -var request = new RestRequest("", Method.Delete); -request.AddHeader("X-Auth-Token", "API_KEY"); -var response = client.Execute(request); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Archive a template", - "operationId": "archiveTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Update a template - -The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. - -```csharp -var client = new RestClient("https://api.docuseal.com/templates/1000001"); -var request = new RestRequest("", Method.Put); -request.AddHeader("X-Auth-Token", "API_KEY"); -request.AddHeader("content-type", "application/json"); -request.AddParameter("application/json", "{\"name\":\"New Document Name\",\"folder_name\":\"New Folder\"}", ParameterType.RequestBody); -var response = client.Execute(request); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Update a template", - "operationId": "updateTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the template", - "example": "New Document Name" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be moved.", - "example": "New Folder" - }, - "roles": { - "type": "array", - "description": "An array of submitter role names to update the template with.", - "items": { - "type": "string" - }, - "example": [ - "Agent", - "Customer" - ] - }, - "archived": { - "type": "boolean", - "description": "Set `false` to unarchive template." - } - } - } - } - } - } -} -``` - ### List all submissions The API endpoint provides the ability to retrieve a list of available submissions. @@ -368,6 +114,82 @@ var response = client.Execute(request); } ``` +### Get a submission + +The API endpoint provides the functionality to retrieve information about a submission. + +```csharp +var client = new RestClient("https://api.docuseal.com/submissions/1001"); +var request = new RestRequest("", Method.Get); +request.AddHeader("X-Auth-Token", "API_KEY"); +var response = client.Execute(request); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get a submission", + "operationId": "getSubmission", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + +### Get submission documents + +This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. + +```csharp +var client = new RestClient("https://api.docuseal.com/submissions/1001/documents"); +var request = new RestRequest("", Method.Get); +request.AddHeader("X-Auth-Token", "API_KEY"); +var response = client.Execute(request); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get submission documents", + "operationId": "getSubmissionDocuments", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + ### Create a submission This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).
Related Guides
Send documents for signature via API
Pre-fill PDF document form fields with API @@ -532,6 +354,11 @@ var response = client.Execute(request); "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -683,6 +510,15 @@ var response = client.Execute(request); ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -736,6 +572,13 @@ var response = client.Execute(request); } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -760,14 +603,17 @@ var response = client.Execute(request); } ``` -### Get a submission +### Create a submission from PDF + +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 -The API endpoint provides the functionality to retrieve information about a submission. ```csharp -var client = new RestClient("https://api.docuseal.com/submissions/1001"); -var request = new RestRequest("", Method.Get); +var client = new RestClient("https://api.docuseal.com/submissions/pdf"); +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\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}],\"submitters\":[{\"role\":\"First Party\",\"email\":\"john.doe@example.com\"}]}", ParameterType.RequestBody); var response = client.Execute(request); ``` @@ -781,20 +627,1462 @@ var response = client.Execute(request); "tags": [ "Submissions" ], - "summary": "Get a submission", - "operationId": "getSubmission", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the submission.", - "example": 1001 + "summary": "Create a submission from PDF", + "operationId": "createSubmissionFromPdf", + "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 + }, + "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 file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "Option B" + ] + } + } + } + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } } - ] + } +} +``` + +### 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}} field syntax to define fillable fields, as in a PDF.
Related Guides
Use dynamic content variables in DOCX to create personalized documents + +```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. Variable values can be strings, numbers, arrays, objects, or HTML content used to generate styled text, paragraphs, and tables in DOCX.", + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### Create a submission from HTML + +This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML + +```csharp +var client = new RestClient("https://api.docuseal.com/submissions/html"); +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\",\"documents\":[{\"name\":\"Test Document\",\"html\":\"

Lorem Ipsum is simply dummy text of the\\n\\n\\nand typesetting industry

\\n\"}],\"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 HTML", + "operationId": "createSubmissionFromHtml", + "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 + }, + "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", + "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", + "items": { + "type": "object", + "required": [ + "html" + ], + "properties": { + "name": { + "type": "string", + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" + }, + "html": { + "type": "string", + "description": "HTML document content with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML document content of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML document content of the footer to be displayed on every page." + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } } ``` @@ -836,12 +2124,12 @@ var response = client.Execute(request); } ``` -### Get submission documents +### List all submitters -This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. +The API endpoint provides the ability to retrieve a list of submitters. ```csharp -var client = new RestClient("https://api.docuseal.com/submissions/1001/documents"); +var client = new RestClient("https://api.docuseal.com/submitters"); var request = new RestRequest("", Method.Get); request.AddHeader("X-Auth-Token", "API_KEY"); var response = client.Execute(request); @@ -855,98 +2143,101 @@ var response = client.Execute(request); } ], "tags": [ - "Submissions" + "Submitters" ], - "summary": "Get submission documents", - "operationId": "getSubmissionDocuments", + "summary": "List all submitters", + "operationId": "getSubmitters", "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "submission_id", + "in": "query", + "required": false, "schema": { "type": "integer" }, - "description": "The unique identifier of the submission.", - "example": 1001 + "description": "The submission ID allows you to receive only the submitters related to that specific submission." + }, + { + "name": "q", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters on name, email or phone partial match." + }, + { + "name": "slug", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters by unique slug.", + "example": "zAyL9fH36Havvm" + }, + { + "name": "completed_after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-05 9:32:20", + "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." + }, + { + "name": "completed_before", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-06 19:32:20", + "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + }, + { + "name": "external_id", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + }, + { + "name": "before", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." } ] } ``` -### Create submissions from emails - -This API endpoint allows you to create submissions for a document template and send them to the specified email addresses. This is a simplified version of the POST /submissions API to be used with Zapier or other automation tools. - -```csharp -var client = new RestClient("https://api.docuseal.com/submissions/emails"); -var request = new RestRequest("", Method.Post); -request.AddHeader("X-Auth-Token", "API_KEY"); -request.AddHeader("content-type", "application/json"); -request.AddParameter("application/json", "{\"template_id\":1000001,\"emails\":\"hi@docuseal.com, example@docuseal.com\"}", ParameterType.RequestBody); -var response = client.Execute(request); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create submissions from emails", - "operationId": "createSubmissionsFromEmails", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "template_id", - "emails" - ], - "properties": { - "template_id": { - "type": "integer", - "description": "The unique identifier of the template.", - "example": 1000001 - }, - "emails": { - "type": "string", - "description": "A comma-separated list of email addresses to send the submission to.", - "example": "{{emails}}" - }, - "send_email": { - "type": "boolean", - "description": "Set `false` to disable signature request emails sending.", - "default": true - }, - "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: {{template.name}}, {{submitter.link}}, {{account.name}}." - } - } - } - } - } - } - } - } -} -``` - ### Get a submitter The API endpoint provides functionality to retrieve information about a submitter, along with the submitter documents and field values. @@ -1226,6 +2517,15 @@ var response = client.Execute(request); ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1279,6 +2579,13 @@ var response = client.Execute(request); } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -1293,12 +2600,12 @@ var response = client.Execute(request); } ``` -### List all submitters +### List all templates -The API endpoint provides the ability to retrieve a list of submitters. +The API endpoint provides the ability to retrieve a list of available document templates. ```csharp -var client = new RestClient("https://api.docuseal.com/submitters"); +var client = new RestClient("https://api.docuseal.com/templates"); var request = new RestRequest("", Method.Get); request.AddHeader("X-Auth-Token", "API_KEY"); var response = client.Execute(request); @@ -1312,20 +2619,11 @@ var response = client.Execute(request); } ], "tags": [ - "Submitters" + "Templates" ], - "summary": "List all submitters", - "operationId": "getSubmitters", + "summary": "List all templates", + "operationId": "getTemplates", "parameters": [ - { - "name": "submission_id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The submission ID allows you to receive only the submitters related to that specific submission." - }, { "name": "q", "in": "query", @@ -1333,7 +2631,7 @@ var response = client.Execute(request); "schema": { "type": "string" }, - "description": "Filter submitters on name, email or phone partial match." + "description": "Filter templates based on the name partial match." }, { "name": "slug", @@ -1342,30 +2640,8 @@ var response = client.Execute(request); "schema": { "type": "string" }, - "description": "Filter submitters by unique slug.", - "example": "zAyL9fH36Havvm" - }, - { - "name": "completed_after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-05 9:32:20", - "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." - }, - { - "name": "completed_before", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-06 19:32:20", - "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + "description": "Filter templates by unique slug.", + "example": "opaKWh8WWTAcVG" }, { "name": "external_id", @@ -1374,7 +2650,25 @@ var response = client.Execute(request); "schema": { "type": "string" }, - "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." + }, + { + "name": "folder", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter templates by folder name." + }, + { + "name": "archived", + "in": "query", + "required": false, + "schema": { + "type": "boolean" + }, + "description": "Get only archived templates instead of active ones." }, { "name": "limit", @@ -1383,7 +2677,7 @@ var response = client.Execute(request); "schema": { "type": "integer" }, - "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + "description": "The number of templates to return. Default value is 10. Maximum value is 100." }, { "name": "after", @@ -1392,7 +2686,7 @@ var response = client.Execute(request); "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." }, { "name": "before", @@ -1401,22 +2695,20 @@ var response = client.Execute(request); "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." + "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." } ] } ``` -### Update template documents +### Get a template -The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. +The API endpoint provides the functionality to retrieve information about a document template. ```csharp -var client = new RestClient("https://api.docuseal.com/templates/1000001/documents"); -var request = new RestRequest("", Method.Put); +var client = new RestClient("https://api.docuseal.com/templates/1000001"); +var request = new RestRequest("", Method.Get); request.AddHeader("X-Auth-Token", "API_KEY"); -request.AddHeader("content-type", "application/json"); -request.AddParameter("application/json", "{\"documents\":[{\"file\":\"string\"}]}", ParameterType.RequestBody); var response = client.Execute(request); ``` @@ -1430,8 +2722,8 @@ var response = client.Execute(request); "tags": [ "Templates" ], - "summary": "Update template documents", - "operationId": "addDocumentToTemplate", + "summary": "Get a template", + "operationId": "getTemplate", "parameters": [ { "name": "id", @@ -1440,78 +2732,24 @@ var response = client.Execute(request); "schema": { "type": "integer" }, - "description": "The unique identifier of the documents template.", + "description": "The unique identifier of the document template.", "example": 1000001 } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "documents": { - "type": "array", - "description": "The list of documents to add or replace in the template.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "file": { - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." - }, - "html": { - "type": "string", - "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." - }, - "position": { - "type": "integer", - "description": "Position of the document. By default will be added as the last document in the template.", - "example": 0 - }, - "replace": { - "type": "boolean", - "default": false, - "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." - }, - "remove": { - "type": "boolean", - "default": false, - "description": "Set to `true` to remove existing document at given `position` or with given `name`." - } - } - } - }, - "merge": { - "type": "boolean", - "default": false, - "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." - } - } - } - } - } - } + ] } ``` -### Clone a template +### Create a template from PDF + +The API endpoint provides the functionality to create a fillable document template for a PDF 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 allows you to clone existing template into a new template. ```csharp -var client = new RestClient("https://api.docuseal.com/templates/1000001/clone"); +var client = new RestClient("https://api.docuseal.com/templates/pdf"); var request = new RestRequest("", Method.Post); request.AddHeader("X-Auth-Token", "API_KEY"); request.AddHeader("content-type", "application/json"); -request.AddParameter("application/json", "{\"name\":\"Cloned Template\"}", ParameterType.RequestBody); +request.AddParameter("application/json", "{\"name\":\"Test PDF\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}]}", ParameterType.RequestBody); var response = client.Execute(request); ``` @@ -1525,73 +2763,8 @@ var response = client.Execute(request); "tags": [ "Templates" ], - "summary": "Clone a template", - "operationId": "cloneTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", - "example": "Cloned Template" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be cloned." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app." - } - } - } - } - } - } -} -``` - -### Create a template from HTML - -The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML - -```csharp -var client = new RestClient("https://api.docuseal.com/templates/html"); -var request = new RestRequest("", Method.Post); -request.AddHeader("X-Auth-Token", "API_KEY"); -request.AddHeader("content-type", "application/json"); -request.AddParameter("application/json", "{\"html\":\"

Lorem Ipsum is simply dummy text of the\\n\\n\\nand typesetting industry

\\n\",\"name\":\"Test Template\"}", ParameterType.RequestBody); -var response = client.Execute(request); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Create a template from HTML", - "operationId": "createTemplateFromHtml", + "summary": "Create a template from PDF", + "operationId": "createTemplateFromPdf", "parameters": [], "requestBody": { "required": true, @@ -1600,55 +2773,23 @@ var response = client.Execute(request); "schema": { "type": "object", "required": [ - "html" + "documents" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML template of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML template of the footer to be displayed on every page." - }, "name": { "type": "string", - "description": "Template name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", - "example": "714d974e-83d8-11ee-b962-0242ac120002" + "description": "Name of the template", + "example": "Test PDF" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", + "example": "unique-key" + }, "shared_link": { "type": "boolean", "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", @@ -1656,25 +2797,287 @@ var response = client.Execute(request); }, "documents": { "type": "array", - "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "html" + "name", + "file" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, "name": { "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "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": { + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } } } } + }, + "flatten": { + "type": "boolean", + "description": "Remove PDF form fields from the documents.", + "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 } } } @@ -1789,7 +3192,8 @@ var response = client.Execute(request); "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -1927,6 +3331,15 @@ var response = client.Execute(request); ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1980,6 +3393,13 @@ var response = client.Execute(request); } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -1997,17 +3417,16 @@ var response = client.Execute(request); } ``` -### Create a template from existing PDF - -The API endpoint provides the functionality to create a fillable document template for existing PDF 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 +### Create a template from HTML +The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML ```csharp -var client = new RestClient("https://api.docuseal.com/templates/pdf"); +var client = new RestClient("https://api.docuseal.com/templates/html"); 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 PDF\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}]}", ParameterType.RequestBody); +request.AddParameter("application/json", "{\"html\":\"

Lorem Ipsum is simply dummy text of the\\n\\n\\nand typesetting industry

\\n\",\"name\":\"Test Template\"}", ParameterType.RequestBody); var response = client.Execute(request); ``` @@ -2021,8 +3440,8 @@ var response = client.Execute(request); "tags": [ "Templates" ], - "summary": "Create a template from existing PDF", - "operationId": "createTemplateFromPdf", + "summary": "Create a template from HTML", + "operationId": "createTemplateFromHtml", "parameters": [], "requestBody": { "required": true, @@ -2031,246 +3450,78 @@ var response = client.Execute(request); "schema": { "type": "object", "required": [ - "documents" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML template of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML template of the footer to be displayed on every page." + }, "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "Template name. Random uuid will be assigned when not specified.", + "example": "Test Template" + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", + "example": "714d974e-83d8-11ee-b962-0242ac120002" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" + "shared_link": { + "type": "boolean", + "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", + "default": true }, "documents": { "type": "array", + "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "name", - "file" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, "name": { "type": "string", - "description": "Name of the document." - }, - "file": { - "example": "base64", - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - }, - "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 - } - } - } - } - } - }, - "flatten": { - "type": "boolean", - "description": "Remove PDF form fields from the document.", - "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 + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" } } } @@ -2283,6 +3534,71 @@ var response = client.Execute(request); } ``` +### Clone a template + +The API endpoint allows you to clone existing template into a new template. + +```csharp +var client = new RestClient("https://api.docuseal.com/templates/1000001/clone"); +var request = new RestRequest("", Method.Post); +request.AddHeader("X-Auth-Token", "API_KEY"); +request.AddHeader("content-type", "application/json"); +request.AddParameter("application/json", "{\"name\":\"Cloned Template\"}", ParameterType.RequestBody); +var response = client.Execute(request); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Clone a template", + "operationId": "cloneTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", + "example": "Cloned Template" + }, + "folder_name": { + "type": "string", + "description": "The folder's name to which the template should be cloned." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app." + } + } + } + } + } + } +} +``` + ### Merge templates The API endpoint allows you to merge multiple templates with documents and fields into a new combined template. @@ -2367,994 +3683,16 @@ 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. 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 +### Update a template +The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. ```csharp -var client = new RestClient("https://api.docuseal.com/submissions/pdf"); -var request = new RestRequest("", Method.Post); +var client = new RestClient("https://api.docuseal.com/templates/1000001"); +var request = new RestRequest("", Method.Put); request.AddHeader("X-Auth-Token", "API_KEY"); request.AddHeader("content-type", "application/json"); -request.AddParameter("application/json", "{\"name\":\"Test Submission Document\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}],\"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 PDF", - "operationId": "createSubmissionFromPdf", - "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 - }, - "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - } - } - } - }, - "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}}." - } - } - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a submission from HTML - -This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML - -```csharp -var client = new RestClient("https://api.docuseal.com/submissions/html"); -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\",\"documents\":[{\"name\":\"Test Document\",\"html\":\"

Lorem Ipsum is simply dummy text of the\\n\\n\\nand typesetting industry

\\n\"}],\"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 HTML", - "operationId": "createSubmissionFromHtml", - "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 - }, - "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", - "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", - "items": { - "type": "object", - "required": [ - "html" - ], - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" - }, - "html": { - "type": "string", - "description": "HTML document content with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML document content of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML document content of the footer to be displayed on every page." - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a template from PDF - -The API endpoint provides the functionality to create a fillable document template for a PDF 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 - - -```csharp -var client = new RestClient("https://api.docuseal.com/templates/pdf"); -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 PDF\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}]}", ParameterType.RequestBody); +request.AddParameter("application/json", "{\"name\":\"New Document Name\",\"folder_name\":\"New Folder\"}", ParameterType.RequestBody); var response = client.Execute(request); ``` @@ -3368,304 +3706,51 @@ var response = client.Execute(request); "tags": [ "Templates" ], - "summary": "Create a template from PDF", - "operationId": "createTemplateFromPdf", - "parameters": [], + "summary": "Update a template", + "operationId": "updateTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", - "required": [ - "documents" - ], "properties": { "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "The name of the template", + "example": "New Document Name" }, "folder_name": { "type": "string", - "description": "The folder's name to which the template should be created." + "description": "The folder's name to which the template should be moved.", + "example": "New Folder" }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" - }, - "shared_link": { - "type": "boolean", - "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", - "default": true - }, - "documents": { + "roles": { "type": "array", + "description": "An array of submitter role names to update the template with.", "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "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": { - "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 - } - } - } - } - } - } - } - } + "type": "string" + }, + "example": [ + "Agent", + "Customer" + ] }, - "flatten": { + "archived": { "type": "boolean", - "description": "Remove PDF form fields from the documents.", - "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 + "description": "Set `false` to unarchive template." } } } @@ -3675,16 +3760,16 @@ var response = client.Execute(request); } ``` -### Create a submission from DOCX +### Update template documents -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 +The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. ```csharp -var client = new RestClient("https://api.docuseal.com/submissions/docx"); -var request = new RestRequest("", Method.Post); +var client = new RestClient("https://api.docuseal.com/templates/1000001/documents"); +var request = new RestRequest("", Method.Put); 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); +request.AddParameter("application/json", "{\"documents\":[{\"file\":\"string\"}]}", ParameterType.RequestBody); var response = client.Execute(request); ``` @@ -3696,406 +3781,71 @@ var response = client.Execute(request); } ], "tags": [ - "Submissions" + "Templates" + ], + "summary": "Update template documents", + "operationId": "addDocumentToTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } ], - "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", + "description": "The list of documents to add or replace in the template.", "items": { "type": "object", - "required": [ - "name", - "file" - ], "properties": { "name": { "type": "string", - "description": "Name of the document." + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Template" }, "file": { - "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 or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." + }, + "html": { + "type": "string", + "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or 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." + "description": "Position of the document. By default will be added as the last document in the template.", + "example": 0 + }, + "replace": { + "type": "boolean", + "default": false, + "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." + }, + "remove": { + "type": "boolean", + "default": false, + "description": "Set to `true` to remove existing document at given `position` or with given `name`." } } } }, - "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": { + "merge": { "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 + "default": false, + "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." } } } @@ -4105,3 +3855,41 @@ var response = client.Execute(request); } ``` +### Archive a template + +The API endpoint allows you to archive a document template. + +```csharp +var client = new RestClient("https://api.docuseal.com/templates/1000001"); +var request = new RestRequest("", Method.Delete); +request.AddHeader("X-Auth-Token", "API_KEY"); +var response = client.Execute(request); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Archive a template", + "operationId": "archiveTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ] +} +``` + diff --git a/docs/api/go.md b/docs/api/go.md index c0622ea8..a141ac3a 100644 --- a/docs/api/go.md +++ b/docs/api/go.md @@ -1,343 +1,3 @@ -### List all templates - -The API endpoint provides the ability to retrieve a list of available document templates. - -```go -package main - -import ( - "fmt" - "net/http" - "io" -) - -func main() { - - url := "https://api.docuseal.com/templates" - - req, _ := http.NewRequest("GET", url, nil) - - req.Header.Add("X-Auth-Token", "API_KEY") - - 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": [ - "Templates" - ], - "summary": "List all templates", - "operationId": "getTemplates", - "parameters": [ - { - "name": "q", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates based on the name partial match." - }, - { - "name": "slug", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by unique slug.", - "example": "opaKWh8WWTAcVG" - }, - { - "name": "external_id", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." - }, - { - "name": "folder", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by folder name." - }, - { - "name": "archived", - "in": "query", - "required": false, - "schema": { - "type": "boolean" - }, - "description": "Get only archived templates instead of active ones." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The number of templates to return. Default value is 10. Maximum value is 100." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." - }, - { - "name": "before", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." - } - ] -} -``` - -### Get a template - -The API endpoint provides the functionality to retrieve information about a document template. - -```go -package main - -import ( - "fmt" - "net/http" - "io" -) - -func main() { - - url := "https://api.docuseal.com/templates/1000001" - - req, _ := http.NewRequest("GET", url, nil) - - req.Header.Add("X-Auth-Token", "API_KEY") - - 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": [ - "Templates" - ], - "summary": "Get a template", - "operationId": "getTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Archive a template - -The API endpoint allows you to archive a document template. - -```go -package main - -import ( - "fmt" - "net/http" - "io" -) - -func main() { - - url := "https://api.docuseal.com/templates/1000001" - - req, _ := http.NewRequest("DELETE", url, nil) - - req.Header.Add("X-Auth-Token", "API_KEY") - - 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": [ - "Templates" - ], - "summary": "Archive a template", - "operationId": "archiveTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Update a template - -The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. - -```go -package main - -import ( - "fmt" - "strings" - "net/http" - "io" -) - -func main() { - - url := "https://api.docuseal.com/templates/1000001" - - payload := strings.NewReader("{\"name\":\"New Document Name\",\"folder_name\":\"New Folder\"}") - - req, _ := http.NewRequest("PUT", 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": [ - "Templates" - ], - "summary": "Update a template", - "operationId": "updateTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the template", - "example": "New Document Name" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be moved.", - "example": "New Folder" - }, - "roles": { - "type": "array", - "description": "An array of submitter role names to update the template with.", - "items": { - "type": "string" - }, - "example": [ - "Agent", - "Customer" - ] - }, - "archived": { - "type": "boolean", - "description": "Set `false` to unarchive template." - } - } - } - } - } - } -} -``` - ### List all submissions The API endpoint provides the ability to retrieve a list of available submissions. @@ -475,6 +135,124 @@ func main() { } ``` +### Get a submission + +The API endpoint provides the functionality to retrieve information about a submission. + +```go +package main + +import ( + "fmt" + "net/http" + "io" +) + +func main() { + + url := "https://api.docuseal.com/submissions/1001" + + req, _ := http.NewRequest("GET", url, nil) + + req.Header.Add("X-Auth-Token", "API_KEY") + + 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": "Get a submission", + "operationId": "getSubmission", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + +### Get submission documents + +This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. + +```go +package main + +import ( + "fmt" + "net/http" + "io" +) + +func main() { + + url := "https://api.docuseal.com/submissions/1001/documents" + + req, _ := http.NewRequest("GET", url, nil) + + req.Header.Add("X-Auth-Token", "API_KEY") + + 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": "Get submission documents", + "operationId": "getSubmissionDocuments", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + ### Create a submission This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).
Related Guides
Send documents for signature via API
Pre-fill PDF document form fields with API @@ -662,6 +440,11 @@ func main() { "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -813,6 +596,15 @@ func main() { ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -866,6 +658,13 @@ func main() { } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -890,26 +689,31 @@ func main() { } ``` -### Get a submission +### Create a submission from PDF + +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 -The API endpoint provides the functionality to retrieve information about a submission. ```go package main import ( "fmt" + "strings" "net/http" "io" ) func main() { - url := "https://api.docuseal.com/submissions/1001" + url := "https://api.docuseal.com/submissions/pdf" - req, _ := http.NewRequest("GET", url, nil) + payload := strings.NewReader("{\"name\":\"Test Submission Document\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}],\"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) @@ -932,20 +736,1508 @@ func main() { "tags": [ "Submissions" ], - "summary": "Get a submission", - "operationId": "getSubmission", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the submission.", - "example": 1001 + "summary": "Create a submission from PDF", + "operationId": "createSubmissionFromPdf", + "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 + }, + "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 file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "Option B" + ] + } + } + } + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } } - ] + } +} +``` + +### 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}} field syntax to define fillable fields, as in a PDF.
Related Guides
Use dynamic content variables in DOCX to create personalized documents + +```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. Variable values can be strings, numbers, arrays, objects, or HTML content used to generate styled text, paragraphs, and tables in DOCX.", + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### Create a submission from HTML + +This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML + +```go +package main + +import ( + "fmt" + "strings" + "net/http" + "io" +) + +func main() { + + url := "https://api.docuseal.com/submissions/html" + + payload := strings.NewReader("{\"name\":\"Test Submission Document\",\"documents\":[{\"name\":\"Test Document\",\"html\":\"

Lorem Ipsum is simply dummy text of the\\n\\n\\nand typesetting industry

\\n\"}],\"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 HTML", + "operationId": "createSubmissionFromHtml", + "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 + }, + "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", + "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", + "items": { + "type": "object", + "required": [ + "html" + ], + "properties": { + "name": { + "type": "string", + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" + }, + "html": { + "type": "string", + "description": "HTML document content with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML document content of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML document content of the footer to be displayed on every page." + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } } ``` @@ -1008,9 +2300,9 @@ func main() { } ``` -### Get submission documents +### List all submitters -This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. +The API endpoint provides the ability to retrieve a list of submitters. ```go package main @@ -1023,7 +2315,7 @@ import ( func main() { - url := "https://api.docuseal.com/submissions/1001/documents" + url := "https://api.docuseal.com/submitters" req, _ := http.NewRequest("GET", url, nil) @@ -1048,121 +2340,101 @@ func main() { } ], "tags": [ - "Submissions" + "Submitters" ], - "summary": "Get submission documents", - "operationId": "getSubmissionDocuments", + "summary": "List all submitters", + "operationId": "getSubmitters", "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "submission_id", + "in": "query", + "required": false, "schema": { "type": "integer" }, - "description": "The unique identifier of the submission.", - "example": 1001 + "description": "The submission ID allows you to receive only the submitters related to that specific submission." + }, + { + "name": "q", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters on name, email or phone partial match." + }, + { + "name": "slug", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters by unique slug.", + "example": "zAyL9fH36Havvm" + }, + { + "name": "completed_after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-05 9:32:20", + "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." + }, + { + "name": "completed_before", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-06 19:32:20", + "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + }, + { + "name": "external_id", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + }, + { + "name": "before", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." } ] } ``` -### Create submissions from emails - -This API endpoint allows you to create submissions for a document template and send them to the specified email addresses. This is a simplified version of the POST /submissions API to be used with Zapier or other automation tools. - -```go -package main - -import ( - "fmt" - "strings" - "net/http" - "io" -) - -func main() { - - url := "https://api.docuseal.com/submissions/emails" - - payload := strings.NewReader("{\"template_id\":1000001,\"emails\":\"hi@docuseal.com, example@docuseal.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 submissions from emails", - "operationId": "createSubmissionsFromEmails", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "template_id", - "emails" - ], - "properties": { - "template_id": { - "type": "integer", - "description": "The unique identifier of the template.", - "example": 1000001 - }, - "emails": { - "type": "string", - "description": "A comma-separated list of email addresses to send the submission to.", - "example": "{{emails}}" - }, - "send_email": { - "type": "boolean", - "description": "Set `false` to disable signature request emails sending.", - "default": true - }, - "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: {{template.name}}, {{submitter.link}}, {{account.name}}." - } - } - } - } - } - } - } - } -} -``` - ### Get a submitter The API endpoint provides functionality to retrieve information about a submitter, along with the submitter documents and field values. @@ -1486,6 +2758,15 @@ func main() { ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1539,6 +2820,13 @@ func main() { } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -1553,9 +2841,9 @@ func main() { } ``` -### List all submitters +### List all templates -The API endpoint provides the ability to retrieve a list of submitters. +The API endpoint provides the ability to retrieve a list of available document templates. ```go package main @@ -1568,7 +2856,7 @@ import ( func main() { - url := "https://api.docuseal.com/submitters" + url := "https://api.docuseal.com/templates" req, _ := http.NewRequest("GET", url, nil) @@ -1593,20 +2881,11 @@ func main() { } ], "tags": [ - "Submitters" + "Templates" ], - "summary": "List all submitters", - "operationId": "getSubmitters", + "summary": "List all templates", + "operationId": "getTemplates", "parameters": [ - { - "name": "submission_id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The submission ID allows you to receive only the submitters related to that specific submission." - }, { "name": "q", "in": "query", @@ -1614,7 +2893,7 @@ func main() { "schema": { "type": "string" }, - "description": "Filter submitters on name, email or phone partial match." + "description": "Filter templates based on the name partial match." }, { "name": "slug", @@ -1623,30 +2902,8 @@ func main() { "schema": { "type": "string" }, - "description": "Filter submitters by unique slug.", - "example": "zAyL9fH36Havvm" - }, - { - "name": "completed_after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-05 9:32:20", - "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." - }, - { - "name": "completed_before", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-06 19:32:20", - "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + "description": "Filter templates by unique slug.", + "example": "opaKWh8WWTAcVG" }, { "name": "external_id", @@ -1655,7 +2912,25 @@ func main() { "schema": { "type": "string" }, - "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." + }, + { + "name": "folder", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter templates by folder name." + }, + { + "name": "archived", + "in": "query", + "required": false, + "schema": { + "type": "boolean" + }, + "description": "Get only archived templates instead of active ones." }, { "name": "limit", @@ -1664,7 +2939,7 @@ func main() { "schema": { "type": "integer" }, - "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + "description": "The number of templates to return. Default value is 10. Maximum value is 100." }, { "name": "after", @@ -1673,7 +2948,7 @@ func main() { "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." }, { "name": "before", @@ -1682,36 +2957,32 @@ func main() { "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." + "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." } ] } ``` -### Update template documents +### Get a template -The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. +The API endpoint provides the functionality to retrieve information about a document template. ```go package main import ( "fmt" - "strings" "net/http" "io" ) func main() { - url := "https://api.docuseal.com/templates/1000001/documents" + url := "https://api.docuseal.com/templates/1000001" - payload := strings.NewReader("{\"documents\":[{\"file\":\"string\"}]}") - - req, _ := http.NewRequest("PUT", url, payload) + req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-Auth-Token", "API_KEY") - req.Header.Add("content-type", "application/json") res, _ := http.DefaultClient.Do(req) @@ -1734,8 +3005,8 @@ func main() { "tags": [ "Templates" ], - "summary": "Update template documents", - "operationId": "addDocumentToTemplate", + "summary": "Get a template", + "operationId": "getTemplate", "parameters": [ { "name": "id", @@ -1744,71 +3015,17 @@ func main() { "schema": { "type": "integer" }, - "description": "The unique identifier of the documents template.", + "description": "The unique identifier of the document template.", "example": 1000001 } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "documents": { - "type": "array", - "description": "The list of documents to add or replace in the template.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "file": { - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." - }, - "html": { - "type": "string", - "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." - }, - "position": { - "type": "integer", - "description": "Position of the document. By default will be added as the last document in the template.", - "example": 0 - }, - "replace": { - "type": "boolean", - "default": false, - "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." - }, - "remove": { - "type": "boolean", - "default": false, - "description": "Set to `true` to remove existing document at given `position` or with given `name`." - } - } - } - }, - "merge": { - "type": "boolean", - "default": false, - "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." - } - } - } - } - } - } + ] } ``` -### Clone a template +### Create a template from PDF + +The API endpoint provides the functionality to create a fillable document template for a PDF 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 allows you to clone existing template into a new template. ```go package main @@ -1822,9 +3039,9 @@ import ( func main() { - url := "https://api.docuseal.com/templates/1000001/clone" + url := "https://api.docuseal.com/templates/pdf" - payload := strings.NewReader("{\"name\":\"Cloned Template\"}") + payload := strings.NewReader("{\"name\":\"Test PDF\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}]}") req, _ := http.NewRequest("POST", url, payload) @@ -1852,39 +3069,674 @@ func main() { "tags": [ "Templates" ], - "summary": "Clone a template", - "operationId": "cloneTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], + "summary": "Create a template from PDF", + "operationId": "createTemplateFromPdf", + "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", + "required": [ + "documents" + ], "properties": { "name": { "type": "string", - "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", - "example": "Cloned Template" + "description": "Name of the template", + "example": "Test PDF" }, "folder_name": { "type": "string", - "description": "The folder's name to which the template should be cloned." + "description": "The folder's name to which the template should be created." }, "external_id": { "type": "string", - "description": "Your application-specific unique string key to identify this template within your app." + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", + "example": "unique-key" + }, + "shared_link": { + "type": "boolean", + "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", + "default": true + }, + "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 file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "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": { + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "flatten": { + "type": "boolean", + "description": "Remove PDF form fields from the documents.", + "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 + } + } + } + } + } + } +} +``` + +### Create a template from Word DOCX + +The API endpoint provides the functionality to create a fillable document template for existing Microsoft Word document. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.docx 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 +package main + +import ( + "fmt" + "strings" + "net/http" + "io" +) + +func main() { + + url := "https://api.docuseal.com/templates/docx" + + payload := strings.NewReader("{\"name\":\"Test DOCX\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\"}]}") + + 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": [ + "Templates" + ], + "summary": "Create a template from Word DOCX", + "operationId": "createTemplateFromDocx", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "documents" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the template", + "example": "Test DOCX" + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new document.", + "example": "unique-key" + }, + "folder_name": { + "type": "string", + "description": "The folder's name to which the template should be created." + }, + "shared_link": { + "type": "boolean", + "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", + "default": true + }, + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "file" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document." + }, + "file": { + "type": "string", + "example": "base64", + "format": "base64", + "description": "Base64-encoded content of the DOCX file or downloadable file URL" + }, + "fields": { + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1." + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "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": { + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + } + } } } } @@ -2034,10 +3886,9 @@ func main() { } ``` -### Create a template from Word DOCX - -The API endpoint provides the functionality to create a fillable document template for existing Microsoft Word document. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.docx 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 +### Clone a template +The API endpoint allows you to clone existing template into a new template. ```go package main @@ -2051,9 +3902,9 @@ import ( func main() { - url := "https://api.docuseal.com/templates/docx" + url := "https://api.docuseal.com/templates/1000001/clone" - payload := strings.NewReader("{\"name\":\"Test DOCX\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\"}]}") + payload := strings.NewReader("{\"name\":\"Cloned Template\"}") req, _ := http.NewRequest("POST", url, payload) @@ -2081,595 +3932,39 @@ func main() { "tags": [ "Templates" ], - "summary": "Create a template from Word DOCX", - "operationId": "createTemplateFromDocx", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "documents" - ], - "properties": { - "name": { - "type": "string", - "description": "Name of the template", - "example": "Test DOCX" - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new document.", - "example": "unique-key" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be created." - }, - "shared_link": { - "type": "boolean", - "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", - "default": true - }, - "documents": { - "type": "array", - "items": { - "type": "object", - "required": [ - "name", - "file" - ], - "properties": { - "name": { - "type": "string", - "description": "Name of the document." - }, - "file": { - "type": "string", - "example": "base64", - "format": "base64", - "description": "Base64-encoded content of the DOCX file or downloadable file URL" - }, - "fields": { - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1." - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "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": { - "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 - } - } - } - } - } - } - } - } - } - } - } - } - } - } -} -``` - -### Create a template from existing PDF - -The API endpoint provides the functionality to create a fillable document template for existing PDF 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 - - -```go -package main - -import ( - "fmt" - "strings" - "net/http" - "io" -) - -func main() { - - url := "https://api.docuseal.com/templates/pdf" - - payload := strings.NewReader("{\"name\":\"Test PDF\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}]}") - - 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": [ + "summary": "Clone a template", + "operationId": "cloneTemplate", + "parameters": [ { - "AuthToken": [] + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 } ], - "tags": [ - "Templates" - ], - "summary": "Create a template from existing PDF", - "operationId": "createTemplateFromPdf", - "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", - "required": [ - "documents" - ], "properties": { "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", + "example": "Cloned Template" }, "folder_name": { "type": "string", - "description": "The folder's name to which the template should be created." + "description": "The folder's name to which the template should be cloned." }, "external_id": { "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" - }, - "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - }, - "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 - } - } - } - } - } - }, - "flatten": { - "type": "boolean", - "description": "Remove PDF form fields from the document.", - "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 - } - } - } + "description": "Your application-specific unique string key to identify this template within your app." } } } @@ -2786,10 +4081,9 @@ func main() { } ``` -### Create a submission from PDF - -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 +### Update a template +The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. ```go package main @@ -2803,1034 +4097,11 @@ import ( func main() { - url := "https://api.docuseal.com/submissions/pdf" + url := "https://api.docuseal.com/templates/1000001" - payload := strings.NewReader("{\"name\":\"Test Submission Document\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}],\"submitters\":[{\"role\":\"First Party\",\"email\":\"john.doe@example.com\"}]}") + payload := strings.NewReader("{\"name\":\"New Document Name\",\"folder_name\":\"New Folder\"}") - 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 PDF", - "operationId": "createSubmissionFromPdf", - "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 - }, - "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - } - } - } - }, - "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}}." - } - } - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a submission from HTML - -This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML - -```go -package main - -import ( - "fmt" - "strings" - "net/http" - "io" -) - -func main() { - - url := "https://api.docuseal.com/submissions/html" - - payload := strings.NewReader("{\"name\":\"Test Submission Document\",\"documents\":[{\"name\":\"Test Document\",\"html\":\"

Lorem Ipsum is simply dummy text of the\\n\\n\\nand typesetting industry

\\n\"}],\"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 HTML", - "operationId": "createSubmissionFromHtml", - "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 - }, - "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", - "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", - "items": { - "type": "object", - "required": [ - "html" - ], - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" - }, - "html": { - "type": "string", - "description": "HTML document content with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML document content of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML document content of the footer to be displayed on every page." - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a template from PDF - -The API endpoint provides the functionality to create a fillable document template for a PDF 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 - - -```go -package main - -import ( - "fmt" - "strings" - "net/http" - "io" -) - -func main() { - - url := "https://api.docuseal.com/templates/pdf" - - payload := strings.NewReader("{\"name\":\"Test PDF\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}]}") - - req, _ := http.NewRequest("POST", url, payload) + req, _ := http.NewRequest("PUT", url, payload) req.Header.Add("X-Auth-Token", "API_KEY") req.Header.Add("content-type", "application/json") @@ -3856,304 +4127,51 @@ func main() { "tags": [ "Templates" ], - "summary": "Create a template from PDF", - "operationId": "createTemplateFromPdf", - "parameters": [], + "summary": "Update a template", + "operationId": "updateTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", - "required": [ - "documents" - ], "properties": { "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "The name of the template", + "example": "New Document Name" }, "folder_name": { "type": "string", - "description": "The folder's name to which the template should be created." + "description": "The folder's name to which the template should be moved.", + "example": "New Folder" }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" - }, - "shared_link": { - "type": "boolean", - "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", - "default": true - }, - "documents": { + "roles": { "type": "array", + "description": "An array of submitter role names to update the template with.", "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "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": { - "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 - } - } - } - } - } - } - } - } + "type": "string" + }, + "example": [ + "Agent", + "Customer" + ] }, - "flatten": { + "archived": { "type": "boolean", - "description": "Remove PDF form fields from the documents.", - "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 + "description": "Set `false` to unarchive template." } } } @@ -4163,9 +4181,9 @@ func main() { } ``` -### Create a submission from DOCX +### Update template documents -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 +The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. ```go package main @@ -4179,11 +4197,11 @@ import ( func main() { - url := "https://api.docuseal.com/submissions/docx" + url := "https://api.docuseal.com/templates/1000001/documents" - 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\"}]}") + payload := strings.NewReader("{\"documents\":[{\"file\":\"string\"}]}") - req, _ := http.NewRequest("POST", url, payload) + req, _ := http.NewRequest("PUT", url, payload) req.Header.Add("X-Auth-Token", "API_KEY") req.Header.Add("content-type", "application/json") @@ -4207,406 +4225,71 @@ func main() { } ], "tags": [ - "Submissions" + "Templates" + ], + "summary": "Update template documents", + "operationId": "addDocumentToTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } ], - "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", + "description": "The list of documents to add or replace in the template.", "items": { "type": "object", - "required": [ - "name", - "file" - ], "properties": { "name": { "type": "string", - "description": "Name of the document." + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Template" }, "file": { - "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 or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." + }, + "html": { + "type": "string", + "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or 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." + "description": "Position of the document. By default will be added as the last document in the template.", + "example": 0 + }, + "replace": { + "type": "boolean", + "default": false, + "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." + }, + "remove": { + "type": "boolean", + "default": false, + "description": "Set to `true` to remove existing document at given `position` or with given `name`." } } } }, - "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": { + "merge": { "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 + "default": false, + "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." } } } @@ -4616,3 +4299,62 @@ func main() { } ``` +### Archive a template + +The API endpoint allows you to archive a document template. + +```go +package main + +import ( + "fmt" + "net/http" + "io" +) + +func main() { + + url := "https://api.docuseal.com/templates/1000001" + + req, _ := http.NewRequest("DELETE", url, nil) + + req.Header.Add("X-Auth-Token", "API_KEY") + + 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": [ + "Templates" + ], + "summary": "Archive a template", + "operationId": "archiveTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ] +} +``` + diff --git a/docs/api/java.md b/docs/api/java.md index 83375022..59b55aad 100644 --- a/docs/api/java.md +++ b/docs/api/java.md @@ -1,253 +1,3 @@ -### List all templates - -The API endpoint provides the ability to retrieve a list of available document templates. - -```java -HttpResponse response = Unirest.get("https://api.docuseal.com/templates") - .header("X-Auth-Token", "API_KEY") - .asString(); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "List all templates", - "operationId": "getTemplates", - "parameters": [ - { - "name": "q", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates based on the name partial match." - }, - { - "name": "slug", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by unique slug.", - "example": "opaKWh8WWTAcVG" - }, - { - "name": "external_id", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." - }, - { - "name": "folder", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by folder name." - }, - { - "name": "archived", - "in": "query", - "required": false, - "schema": { - "type": "boolean" - }, - "description": "Get only archived templates instead of active ones." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The number of templates to return. Default value is 10. Maximum value is 100." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." - }, - { - "name": "before", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." - } - ] -} -``` - -### Get a template - -The API endpoint provides the functionality to retrieve information about a document template. - -```java -HttpResponse response = Unirest.get("https://api.docuseal.com/templates/1000001") - .header("X-Auth-Token", "API_KEY") - .asString(); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Get a template", - "operationId": "getTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Archive a template - -The API endpoint allows you to archive a document template. - -```java -HttpResponse response = Unirest.delete("https://api.docuseal.com/templates/1000001") - .header("X-Auth-Token", "API_KEY") - .asString(); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Archive a template", - "operationId": "archiveTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Update a template - -The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. - -```java -HttpResponse response = Unirest.put("https://api.docuseal.com/templates/1000001") - .header("X-Auth-Token", "API_KEY") - .header("content-type", "application/json") - .body("{\"name\":\"New Document Name\",\"folder_name\":\"New Folder\"}") - .asString(); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Update a template", - "operationId": "updateTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the template", - "example": "New Document Name" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be moved.", - "example": "New Folder" - }, - "roles": { - "type": "array", - "description": "An array of submitter role names to update the template with.", - "items": { - "type": "string" - }, - "example": [ - "Agent", - "Customer" - ] - }, - "archived": { - "type": "boolean", - "description": "Set `false` to unarchive template." - } - } - } - } - } - } -} -``` - ### List all submissions The API endpoint provides the ability to retrieve a list of available submissions. @@ -363,6 +113,80 @@ HttpResponse response = Unirest.get("https://api.docuseal.com/submission } ``` +### Get a submission + +The API endpoint provides the functionality to retrieve information about a submission. + +```java +HttpResponse response = Unirest.get("https://api.docuseal.com/submissions/1001") + .header("X-Auth-Token", "API_KEY") + .asString(); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get a submission", + "operationId": "getSubmission", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + +### Get submission documents + +This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. + +```java +HttpResponse response = Unirest.get("https://api.docuseal.com/submissions/1001/documents") + .header("X-Auth-Token", "API_KEY") + .asString(); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get submission documents", + "operationId": "getSubmissionDocuments", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + ### Create a submission This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).
Related Guides
Send documents for signature via API
Pre-fill PDF document form fields with API @@ -526,6 +350,11 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/submissio "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -677,6 +506,15 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/submissio ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -730,6 +568,13 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/submissio } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -754,13 +599,16 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/submissio } ``` -### Get a submission +### Create a submission from PDF + +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 -The API endpoint provides the functionality to retrieve information about a submission. ```java -HttpResponse response = Unirest.get("https://api.docuseal.com/submissions/1001") +HttpResponse response = Unirest.post("https://api.docuseal.com/submissions/pdf") .header("X-Auth-Token", "API_KEY") + .header("content-type", "application/json") + .body("{\"name\":\"Test Submission Document\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}],\"submitters\":[{\"role\":\"First Party\",\"email\":\"john.doe@example.com\"}]}") .asString(); ``` @@ -774,20 +622,1460 @@ HttpResponse response = Unirest.get("https://api.docuseal.com/submission "tags": [ "Submissions" ], - "summary": "Get a submission", - "operationId": "getSubmission", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the submission.", - "example": 1001 + "summary": "Create a submission from PDF", + "operationId": "createSubmissionFromPdf", + "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 + }, + "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 file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "Option B" + ] + } + } + } + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } } - ] + } +} +``` + +### 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}} field syntax to define fillable fields, as in a PDF.
Related Guides
Use dynamic content variables in DOCX to create personalized documents + +```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. Variable values can be strings, numbers, arrays, objects, or HTML content used to generate styled text, paragraphs, and tables in DOCX.", + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### Create a submission from HTML + +This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML + +```java +HttpResponse response = Unirest.post("https://api.docuseal.com/submissions/html") + .header("X-Auth-Token", "API_KEY") + .header("content-type", "application/json") + .body("{\"name\":\"Test Submission Document\",\"documents\":[{\"name\":\"Test Document\",\"html\":\"

Lorem Ipsum is simply dummy text of the\\n\\n\\nand typesetting industry

\\n\"}],\"submitters\":[{\"role\":\"First Party\",\"email\":\"john.doe@example.com\"}]}") + .asString(); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from HTML", + "operationId": "createSubmissionFromHtml", + "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 + }, + "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", + "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", + "items": { + "type": "object", + "required": [ + "html" + ], + "properties": { + "name": { + "type": "string", + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" + }, + "html": { + "type": "string", + "description": "HTML document content with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML document content of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML document content of the footer to be displayed on every page." + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } } ``` @@ -828,12 +2116,12 @@ HttpResponse response = Unirest.delete("https://api.docuseal.com/submiss } ``` -### Get submission documents +### List all submitters -This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. +The API endpoint provides the ability to retrieve a list of submitters. ```java -HttpResponse response = Unirest.get("https://api.docuseal.com/submissions/1001/documents") +HttpResponse response = Unirest.get("https://api.docuseal.com/submitters") .header("X-Auth-Token", "API_KEY") .asString(); ``` @@ -846,97 +2134,101 @@ HttpResponse response = Unirest.get("https://api.docuseal.com/submission } ], "tags": [ - "Submissions" + "Submitters" ], - "summary": "Get submission documents", - "operationId": "getSubmissionDocuments", + "summary": "List all submitters", + "operationId": "getSubmitters", "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "submission_id", + "in": "query", + "required": false, "schema": { "type": "integer" }, - "description": "The unique identifier of the submission.", - "example": 1001 + "description": "The submission ID allows you to receive only the submitters related to that specific submission." + }, + { + "name": "q", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters on name, email or phone partial match." + }, + { + "name": "slug", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters by unique slug.", + "example": "zAyL9fH36Havvm" + }, + { + "name": "completed_after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-05 9:32:20", + "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." + }, + { + "name": "completed_before", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-06 19:32:20", + "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + }, + { + "name": "external_id", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + }, + { + "name": "before", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." } ] } ``` -### Create submissions from emails - -This API endpoint allows you to create submissions for a document template and send them to the specified email addresses. This is a simplified version of the POST /submissions API to be used with Zapier or other automation tools. - -```java -HttpResponse response = Unirest.post("https://api.docuseal.com/submissions/emails") - .header("X-Auth-Token", "API_KEY") - .header("content-type", "application/json") - .body("{\"template_id\":1000001,\"emails\":\"hi@docuseal.com, example@docuseal.com\"}") - .asString(); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create submissions from emails", - "operationId": "createSubmissionsFromEmails", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "template_id", - "emails" - ], - "properties": { - "template_id": { - "type": "integer", - "description": "The unique identifier of the template.", - "example": 1000001 - }, - "emails": { - "type": "string", - "description": "A comma-separated list of email addresses to send the submission to.", - "example": "{{emails}}" - }, - "send_email": { - "type": "boolean", - "description": "Set `false` to disable signature request emails sending.", - "default": true - }, - "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: {{template.name}}, {{submitter.link}}, {{account.name}}." - } - } - } - } - } - } - } - } -} -``` - ### Get a submitter The API endpoint provides functionality to retrieve information about a submitter, along with the submitter documents and field values. @@ -1214,6 +2506,15 @@ HttpResponse response = Unirest.put("https://api.docuseal.com/submitters ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1267,6 +2568,13 @@ HttpResponse response = Unirest.put("https://api.docuseal.com/submitters } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -1281,12 +2589,12 @@ HttpResponse response = Unirest.put("https://api.docuseal.com/submitters } ``` -### List all submitters +### List all templates -The API endpoint provides the ability to retrieve a list of submitters. +The API endpoint provides the ability to retrieve a list of available document templates. ```java -HttpResponse response = Unirest.get("https://api.docuseal.com/submitters") +HttpResponse response = Unirest.get("https://api.docuseal.com/templates") .header("X-Auth-Token", "API_KEY") .asString(); ``` @@ -1299,20 +2607,11 @@ HttpResponse response = Unirest.get("https://api.docuseal.com/submitters } ], "tags": [ - "Submitters" + "Templates" ], - "summary": "List all submitters", - "operationId": "getSubmitters", + "summary": "List all templates", + "operationId": "getTemplates", "parameters": [ - { - "name": "submission_id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The submission ID allows you to receive only the submitters related to that specific submission." - }, { "name": "q", "in": "query", @@ -1320,7 +2619,7 @@ HttpResponse response = Unirest.get("https://api.docuseal.com/submitters "schema": { "type": "string" }, - "description": "Filter submitters on name, email or phone partial match." + "description": "Filter templates based on the name partial match." }, { "name": "slug", @@ -1329,30 +2628,8 @@ HttpResponse response = Unirest.get("https://api.docuseal.com/submitters "schema": { "type": "string" }, - "description": "Filter submitters by unique slug.", - "example": "zAyL9fH36Havvm" - }, - { - "name": "completed_after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-05 9:32:20", - "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." - }, - { - "name": "completed_before", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-06 19:32:20", - "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + "description": "Filter templates by unique slug.", + "example": "opaKWh8WWTAcVG" }, { "name": "external_id", @@ -1361,7 +2638,25 @@ HttpResponse response = Unirest.get("https://api.docuseal.com/submitters "schema": { "type": "string" }, - "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." + }, + { + "name": "folder", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter templates by folder name." + }, + { + "name": "archived", + "in": "query", + "required": false, + "schema": { + "type": "boolean" + }, + "description": "Get only archived templates instead of active ones." }, { "name": "limit", @@ -1370,7 +2665,7 @@ HttpResponse response = Unirest.get("https://api.docuseal.com/submitters "schema": { "type": "integer" }, - "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + "description": "The number of templates to return. Default value is 10. Maximum value is 100." }, { "name": "after", @@ -1379,7 +2674,7 @@ HttpResponse response = Unirest.get("https://api.docuseal.com/submitters "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." }, { "name": "before", @@ -1388,21 +2683,19 @@ HttpResponse response = Unirest.get("https://api.docuseal.com/submitters "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." + "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." } ] } ``` -### Update template documents +### Get a template -The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. +The API endpoint provides the functionality to retrieve information about a document template. ```java -HttpResponse response = Unirest.put("https://api.docuseal.com/templates/1000001/documents") +HttpResponse response = Unirest.get("https://api.docuseal.com/templates/1000001") .header("X-Auth-Token", "API_KEY") - .header("content-type", "application/json") - .body("{\"documents\":[{\"file\":\"string\"}]}") .asString(); ``` @@ -1416,8 +2709,8 @@ HttpResponse response = Unirest.put("https://api.docuseal.com/templates/ "tags": [ "Templates" ], - "summary": "Update template documents", - "operationId": "addDocumentToTemplate", + "summary": "Get a template", + "operationId": "getTemplate", "parameters": [ { "name": "id", @@ -1426,77 +2719,23 @@ HttpResponse response = Unirest.put("https://api.docuseal.com/templates/ "schema": { "type": "integer" }, - "description": "The unique identifier of the documents template.", + "description": "The unique identifier of the document template.", "example": 1000001 } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "documents": { - "type": "array", - "description": "The list of documents to add or replace in the template.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "file": { - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." - }, - "html": { - "type": "string", - "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." - }, - "position": { - "type": "integer", - "description": "Position of the document. By default will be added as the last document in the template.", - "example": 0 - }, - "replace": { - "type": "boolean", - "default": false, - "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." - }, - "remove": { - "type": "boolean", - "default": false, - "description": "Set to `true` to remove existing document at given `position` or with given `name`." - } - } - } - }, - "merge": { - "type": "boolean", - "default": false, - "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." - } - } - } - } - } - } + ] } ``` -### Clone a template +### Create a template from PDF + +The API endpoint provides the functionality to create a fillable document template for a PDF 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 allows you to clone existing template into a new template. ```java -HttpResponse response = Unirest.post("https://api.docuseal.com/templates/1000001/clone") +HttpResponse response = Unirest.post("https://api.docuseal.com/templates/pdf") .header("X-Auth-Token", "API_KEY") .header("content-type", "application/json") - .body("{\"name\":\"Cloned Template\"}") + .body("{\"name\":\"Test PDF\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}]}") .asString(); ``` @@ -1510,72 +2749,8 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates "tags": [ "Templates" ], - "summary": "Clone a template", - "operationId": "cloneTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", - "example": "Cloned Template" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be cloned." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app." - } - } - } - } - } - } -} -``` - -### Create a template from HTML - -The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML - -```java -HttpResponse response = Unirest.post("https://api.docuseal.com/templates/html") - .header("X-Auth-Token", "API_KEY") - .header("content-type", "application/json") - .body("{\"html\":\"

Lorem Ipsum is simply dummy text of the\\n\\n\\nand typesetting industry

\\n\",\"name\":\"Test Template\"}") - .asString(); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Create a template from HTML", - "operationId": "createTemplateFromHtml", + "summary": "Create a template from PDF", + "operationId": "createTemplateFromPdf", "parameters": [], "requestBody": { "required": true, @@ -1584,55 +2759,23 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates "schema": { "type": "object", "required": [ - "html" + "documents" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML template of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML template of the footer to be displayed on every page." - }, "name": { "type": "string", - "description": "Template name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", - "example": "714d974e-83d8-11ee-b962-0242ac120002" + "description": "Name of the template", + "example": "Test PDF" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", + "example": "unique-key" + }, "shared_link": { "type": "boolean", "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", @@ -1640,25 +2783,287 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates }, "documents": { "type": "array", - "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "html" + "name", + "file" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, "name": { "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "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": { + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } } } } + }, + "flatten": { + "type": "boolean", + "description": "Remove PDF form fields from the documents.", + "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 } } } @@ -1772,7 +3177,8 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -1910,6 +3316,15 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1963,6 +3378,13 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -1980,16 +3402,15 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates } ``` -### Create a template from existing PDF - -The API endpoint provides the functionality to create a fillable document template for existing PDF 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 +### Create a template from HTML +The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML ```java -HttpResponse response = Unirest.post("https://api.docuseal.com/templates/pdf") +HttpResponse response = Unirest.post("https://api.docuseal.com/templates/html") .header("X-Auth-Token", "API_KEY") .header("content-type", "application/json") - .body("{\"name\":\"Test PDF\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}]}") + .body("{\"html\":\"

Lorem Ipsum is simply dummy text of the\\n\\n\\nand typesetting industry

\\n\",\"name\":\"Test Template\"}") .asString(); ``` @@ -2003,8 +3424,8 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates "tags": [ "Templates" ], - "summary": "Create a template from existing PDF", - "operationId": "createTemplateFromPdf", + "summary": "Create a template from HTML", + "operationId": "createTemplateFromHtml", "parameters": [], "requestBody": { "required": true, @@ -2013,246 +3434,78 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates "schema": { "type": "object", "required": [ - "documents" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML template of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML template of the footer to be displayed on every page." + }, "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "Template name. Random uuid will be assigned when not specified.", + "example": "Test Template" + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", + "example": "714d974e-83d8-11ee-b962-0242ac120002" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" + "shared_link": { + "type": "boolean", + "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", + "default": true }, "documents": { "type": "array", + "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "name", - "file" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, "name": { "type": "string", - "description": "Name of the document." - }, - "file": { - "example": "base64", - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - }, - "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 - } - } - } - } - } - }, - "flatten": { - "type": "boolean", - "description": "Remove PDF form fields from the document.", - "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 + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" } } } @@ -2265,6 +3518,70 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates } ``` +### Clone a template + +The API endpoint allows you to clone existing template into a new template. + +```java +HttpResponse response = Unirest.post("https://api.docuseal.com/templates/1000001/clone") + .header("X-Auth-Token", "API_KEY") + .header("content-type", "application/json") + .body("{\"name\":\"Cloned Template\"}") + .asString(); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Clone a template", + "operationId": "cloneTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", + "example": "Cloned Template" + }, + "folder_name": { + "type": "string", + "description": "The folder's name to which the template should be cloned." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app." + } + } + } + } + } + } +} +``` + ### Merge templates The API endpoint allows you to merge multiple templates with documents and fields into a new combined template. @@ -2348,991 +3665,15 @@ 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. 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 +### Update a template +The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. ```java -HttpResponse response = Unirest.post("https://api.docuseal.com/submissions/pdf") +HttpResponse response = Unirest.put("https://api.docuseal.com/templates/1000001") .header("X-Auth-Token", "API_KEY") .header("content-type", "application/json") - .body("{\"name\":\"Test Submission Document\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}],\"submitters\":[{\"role\":\"First Party\",\"email\":\"john.doe@example.com\"}]}") - .asString(); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create a submission from PDF", - "operationId": "createSubmissionFromPdf", - "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 - }, - "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - } - } - } - }, - "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}}." - } - } - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a submission from HTML - -This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML - -```java -HttpResponse response = Unirest.post("https://api.docuseal.com/submissions/html") - .header("X-Auth-Token", "API_KEY") - .header("content-type", "application/json") - .body("{\"name\":\"Test Submission Document\",\"documents\":[{\"name\":\"Test Document\",\"html\":\"

Lorem Ipsum is simply dummy text of the\\n\\n\\nand typesetting industry

\\n\"}],\"submitters\":[{\"role\":\"First Party\",\"email\":\"john.doe@example.com\"}]}") - .asString(); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create a submission from HTML", - "operationId": "createSubmissionFromHtml", - "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 - }, - "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", - "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", - "items": { - "type": "object", - "required": [ - "html" - ], - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" - }, - "html": { - "type": "string", - "description": "HTML document content with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML document content of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML document content of the footer to be displayed on every page." - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a template from PDF - -The API endpoint provides the functionality to create a fillable document template for a PDF 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 - - -```java -HttpResponse response = Unirest.post("https://api.docuseal.com/templates/pdf") - .header("X-Auth-Token", "API_KEY") - .header("content-type", "application/json") - .body("{\"name\":\"Test PDF\",\"documents\":[{\"name\":\"string\",\"file\":\"base64\",\"fields\":[{\"name\":\"string\",\"areas\":[{\"x\":0,\"y\":0,\"w\":0,\"h\":0,\"page\":1}]}]}]}") + .body("{\"name\":\"New Document Name\",\"folder_name\":\"New Folder\"}") .asString(); ``` @@ -3346,304 +3687,51 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates "tags": [ "Templates" ], - "summary": "Create a template from PDF", - "operationId": "createTemplateFromPdf", - "parameters": [], + "summary": "Update a template", + "operationId": "updateTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", - "required": [ - "documents" - ], "properties": { "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "The name of the template", + "example": "New Document Name" }, "folder_name": { "type": "string", - "description": "The folder's name to which the template should be created." + "description": "The folder's name to which the template should be moved.", + "example": "New Folder" }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" - }, - "shared_link": { - "type": "boolean", - "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", - "default": true - }, - "documents": { + "roles": { "type": "array", + "description": "An array of submitter role names to update the template with.", "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "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": { - "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 - } - } - } - } - } - } - } - } + "type": "string" + }, + "example": [ + "Agent", + "Customer" + ] }, - "flatten": { + "archived": { "type": "boolean", - "description": "Remove PDF form fields from the documents.", - "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 + "description": "Set `false` to unarchive template." } } } @@ -3653,15 +3741,15 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/templates } ``` -### Create a submission from DOCX +### Update template documents -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 +The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. ```java -HttpResponse response = Unirest.post("https://api.docuseal.com/submissions/docx") +HttpResponse response = Unirest.put("https://api.docuseal.com/templates/1000001/documents") .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\"}]}") + .body("{\"documents\":[{\"file\":\"string\"}]}") .asString(); ``` @@ -3673,406 +3761,71 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/submissio } ], "tags": [ - "Submissions" + "Templates" + ], + "summary": "Update template documents", + "operationId": "addDocumentToTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } ], - "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", + "description": "The list of documents to add or replace in the template.", "items": { "type": "object", - "required": [ - "name", - "file" - ], "properties": { "name": { "type": "string", - "description": "Name of the document." + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Template" }, "file": { - "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 or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." + }, + "html": { + "type": "string", + "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or 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." + "description": "Position of the document. By default will be added as the last document in the template.", + "example": 0 + }, + "replace": { + "type": "boolean", + "default": false, + "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." + }, + "remove": { + "type": "boolean", + "default": false, + "description": "Set to `true` to remove existing document at given `position` or with given `name`." } } } }, - "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": { + "merge": { "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 + "default": false, + "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." } } } @@ -4082,3 +3835,40 @@ HttpResponse response = Unirest.post("https://api.docuseal.com/submissio } ``` +### Archive a template + +The API endpoint allows you to archive a document template. + +```java +HttpResponse response = Unirest.delete("https://api.docuseal.com/templates/1000001") + .header("X-Auth-Token", "API_KEY") + .asString(); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Archive a template", + "operationId": "archiveTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ] +} +``` + diff --git a/docs/api/javascript.md b/docs/api/javascript.md index c0635531..297f4c4c 100644 --- a/docs/api/javascript.md +++ b/docs/api/javascript.md @@ -1,262 +1,3 @@ -### List all templates - -The API endpoint provides the ability to retrieve a list of available document templates. - -```javascript -const docuseal = require("@docuseal/api"); - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const { data, pagination } = await docuseal.listTemplates({ limit: 10 }); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "List all templates", - "operationId": "getTemplates", - "parameters": [ - { - "name": "q", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates based on the name partial match." - }, - { - "name": "slug", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by unique slug.", - "example": "opaKWh8WWTAcVG" - }, - { - "name": "external_id", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." - }, - { - "name": "folder", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by folder name." - }, - { - "name": "archived", - "in": "query", - "required": false, - "schema": { - "type": "boolean" - }, - "description": "Get only archived templates instead of active ones." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The number of templates to return. Default value is 10. Maximum value is 100." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." - }, - { - "name": "before", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." - } - ] -} -``` - -### Get a template - -The API endpoint provides the functionality to retrieve information about a document template. - -```javascript -const docuseal = require("@docuseal/api"); - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const template = await docuseal.getTemplate(1000001); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Get a template", - "operationId": "getTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Archive a template - -The API endpoint allows you to archive a document template. - -```javascript -const docuseal = require("@docuseal/api"); - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -await docuseal.archiveTemplate(1000001); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Archive a template", - "operationId": "archiveTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Update a template - -The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. - -```javascript -const docuseal = require("@docuseal/api"); - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const template = await docuseal.updateTemplate(1000001, { - name: "New Document Name", - folder_name: "New Folder" -}); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Update a template", - "operationId": "updateTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the template", - "example": "New Document Name" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be moved.", - "example": "New Folder" - }, - "roles": { - "type": "array", - "description": "An array of submitter role names to update the template with.", - "items": { - "type": "string" - }, - "example": [ - "Agent", - "Customer" - ] - }, - "archived": { - "type": "boolean", - "description": "Set `false` to unarchive template." - } - } - } - } - } - } -} -``` - ### List all submissions The API endpoint provides the ability to retrieve a list of available submissions. @@ -374,6 +115,84 @@ const { data, pagination } = await docuseal.listSubmissions({ limit: 10 }); } ``` +### Get a submission + +The API endpoint provides the functionality to retrieve information about a submission. + +```javascript +const docuseal = require("@docuseal/api"); + +docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); + +const submission = await docuseal.getSubmission(1001); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get a submission", + "operationId": "getSubmission", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + +### Get submission documents + +This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. + +```javascript +const docuseal = require("@docuseal/api"); + +docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); + +const submission = await docuseal.getSubmissionDocuments(1001); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get submission documents", + "operationId": "getSubmissionDocuments", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + ### Create a submission This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).
Related Guides
Send documents for signature via API
Pre-fill PDF document form fields with API @@ -546,6 +365,11 @@ const submission = await docuseal.createSubmission({ "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -697,6 +521,15 @@ const submission = await docuseal.createSubmission({ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -750,6 +583,13 @@ const submission = await docuseal.createSubmission({ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -774,16 +614,45 @@ const submission = await docuseal.createSubmission({ } ``` -### Get a submission +### Create a submission from PDF + +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 -The API endpoint provides the functionality to retrieve information about a submission. ```javascript const docuseal = require("@docuseal/api"); docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const submission = await docuseal.getSubmission(1001); +const submission = await docuseal.createSubmissionFromPdf({ + name: "Test Submission Document", + documents: [ + { + name: "string", + file: "base64", + fields: [ + { + name: "string", + areas: [ + { + x: 0, + y: 0, + w: 0, + h: 0, + page: 1 + } + ] + } + ] + } + ], + submitters: [ + { + role: "First Party", + email: "john.doe@example.com" + } + ] +}); ``` ```json @@ -796,20 +665,1499 @@ const submission = await docuseal.getSubmission(1001); "tags": [ "Submissions" ], - "summary": "Get a submission", - "operationId": "getSubmission", - "parameters": [ + "summary": "Create a submission from PDF", + "operationId": "createSubmissionFromPdf", + "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 + }, + "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 file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "Option B" + ] + } + } + } + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### 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}} field syntax to define fillable fields, as in a PDF.
Related Guides
Use dynamic content variables in DOCX to create personalized documents + +```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": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the submission.", - "example": 1001 + 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. Variable values can be strings, numbers, arrays, objects, or HTML content used to generate styled text, paragraphs, and tables in DOCX.", + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### Create a submission from HTML + +This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML + +```javascript +const docuseal = require("@docuseal/api"); + +docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); + +const submission = await docuseal.createSubmissionFromHtml({ + name: "Test Submission Document", + documents: [ + { + name: "Test Document", + html: `

Lorem Ipsum is simply dummy text of the + + +and typesetting industry

+` + } + ], + submitters: [ + { + role: "First Party", + email: "john.doe@example.com" + } + ] +}); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from HTML", + "operationId": "createSubmissionFromHtml", + "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 + }, + "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", + "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", + "items": { + "type": "object", + "required": [ + "html" + ], + "properties": { + "name": { + "type": "string", + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" + }, + "html": { + "type": "string", + "description": "HTML document content with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML document content of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML document content of the footer to be displayed on every page." + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } } ``` @@ -852,16 +2200,16 @@ await docuseal.archiveSubmission(1001); } ``` -### Get submission documents +### List all submitters -This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. +The API endpoint provides the ability to retrieve a list of submitters. ```javascript const docuseal = require("@docuseal/api"); docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const submission = await docuseal.getSubmissionDocuments(1001); +const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); ``` ```json @@ -872,100 +2220,101 @@ const submission = await docuseal.getSubmissionDocuments(1001); } ], "tags": [ - "Submissions" + "Submitters" ], - "summary": "Get submission documents", - "operationId": "getSubmissionDocuments", + "summary": "List all submitters", + "operationId": "getSubmitters", "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "submission_id", + "in": "query", + "required": false, "schema": { "type": "integer" }, - "description": "The unique identifier of the submission.", - "example": 1001 + "description": "The submission ID allows you to receive only the submitters related to that specific submission." + }, + { + "name": "q", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters on name, email or phone partial match." + }, + { + "name": "slug", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters by unique slug.", + "example": "zAyL9fH36Havvm" + }, + { + "name": "completed_after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-05 9:32:20", + "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." + }, + { + "name": "completed_before", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-06 19:32:20", + "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + }, + { + "name": "external_id", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + }, + { + "name": "before", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." } ] } ``` -### Create submissions from emails - -This API endpoint allows you to create submissions for a document template and send them to the specified email addresses. This is a simplified version of the POST /submissions API to be used with Zapier or other automation tools. - -```javascript -const docuseal = require("@docuseal/api"); - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const submission = await docuseal.createSubmissionFromEmails({ - template_id: 1000001, - emails: "hi@docuseal.com, example@docuseal.com" -}); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create submissions from emails", - "operationId": "createSubmissionsFromEmails", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "template_id", - "emails" - ], - "properties": { - "template_id": { - "type": "integer", - "description": "The unique identifier of the template.", - "example": 1000001 - }, - "emails": { - "type": "string", - "description": "A comma-separated list of email addresses to send the submission to.", - "example": "{{emails}}" - }, - "send_email": { - "type": "boolean", - "description": "Set `false` to disable signature request emails sending.", - "default": true - }, - "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: {{template.name}}, {{submitter.link}}, {{account.name}}." - } - } - } - } - } - } - } - } -} -``` - ### Get a submitter The API endpoint provides functionality to retrieve information about a submitter, along with the submitter documents and field values. @@ -1253,6 +2602,15 @@ const submitter = await docuseal.updateSubmitter(500001, { ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1306,6 +2664,13 @@ const submitter = await docuseal.updateSubmitter(500001, { } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -1320,16 +2685,16 @@ const submitter = await docuseal.updateSubmitter(500001, { } ``` -### List all submitters +### List all templates -The API endpoint provides the ability to retrieve a list of submitters. +The API endpoint provides the ability to retrieve a list of available document templates. ```javascript const docuseal = require("@docuseal/api"); docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); +const { data, pagination } = await docuseal.listTemplates({ limit: 10 }); ``` ```json @@ -1340,20 +2705,11 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); } ], "tags": [ - "Submitters" + "Templates" ], - "summary": "List all submitters", - "operationId": "getSubmitters", + "summary": "List all templates", + "operationId": "getTemplates", "parameters": [ - { - "name": "submission_id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The submission ID allows you to receive only the submitters related to that specific submission." - }, { "name": "q", "in": "query", @@ -1361,7 +2717,7 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); "schema": { "type": "string" }, - "description": "Filter submitters on name, email or phone partial match." + "description": "Filter templates based on the name partial match." }, { "name": "slug", @@ -1370,30 +2726,8 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); "schema": { "type": "string" }, - "description": "Filter submitters by unique slug.", - "example": "zAyL9fH36Havvm" - }, - { - "name": "completed_after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-05 9:32:20", - "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." - }, - { - "name": "completed_before", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-06 19:32:20", - "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + "description": "Filter templates by unique slug.", + "example": "opaKWh8WWTAcVG" }, { "name": "external_id", @@ -1402,7 +2736,25 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); "schema": { "type": "string" }, - "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." + }, + { + "name": "folder", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter templates by folder name." + }, + { + "name": "archived", + "in": "query", + "required": false, + "schema": { + "type": "boolean" + }, + "description": "Get only archived templates instead of active ones." }, { "name": "limit", @@ -1411,7 +2763,7 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); "schema": { "type": "integer" }, - "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + "description": "The number of templates to return. Default value is 10. Maximum value is 100." }, { "name": "after", @@ -1420,7 +2772,7 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." }, { "name": "before", @@ -1429,25 +2781,81 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." + "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." } ] } ``` -### Update template documents +### Get a template -The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. +The API endpoint provides the functionality to retrieve information about a document template. ```javascript const docuseal = require("@docuseal/api"); docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const template = await docuseal.updateTemplateDocuments(1000001, { +const template = await docuseal.getTemplate(1000001); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Get a template", + "operationId": "getTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ] +} +``` + +### Create a template from PDF + +The API endpoint provides the functionality to create a fillable document template for a PDF 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 + + +```javascript +const docuseal = require("@docuseal/api"); + +docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); + +const template = await docuseal.createTemplateFromPdf({ + name: "Test PDF", documents: [ { - file: "string" + name: "string", + file: "base64", + fields: [ + { + name: "string", + areas: [ + { + x: 0, + y: 0, + w: 0, + h: 0, + page: 1 + } + ] + } + ] } ] }); @@ -1463,179 +2871,8 @@ const template = await docuseal.updateTemplateDocuments(1000001, { "tags": [ "Templates" ], - "summary": "Update template documents", - "operationId": "addDocumentToTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "documents": { - "type": "array", - "description": "The list of documents to add or replace in the template.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "file": { - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." - }, - "html": { - "type": "string", - "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." - }, - "position": { - "type": "integer", - "description": "Position of the document. By default will be added as the last document in the template.", - "example": 0 - }, - "replace": { - "type": "boolean", - "default": false, - "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." - }, - "remove": { - "type": "boolean", - "default": false, - "description": "Set to `true` to remove existing document at given `position` or with given `name`." - } - } - } - }, - "merge": { - "type": "boolean", - "default": false, - "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." - } - } - } - } - } - } -} -``` - -### Clone a template - -The API endpoint allows you to clone existing template into a new template. - -```javascript -const docuseal = require("@docuseal/api"); - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const template = await docuseal.cloneTemplate(1000001, { - name: "Cloned Template" -}); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Clone a template", - "operationId": "cloneTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", - "example": "Cloned Template" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be cloned." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app." - } - } - } - } - } - } -} -``` - -### Create a template from HTML - -The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML - -```javascript -const docuseal = require("@docuseal/api"); - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const template = await docuseal.createTemplateFromHtml({ - html: `

Lorem Ipsum is simply dummy text of the - - -and typesetting industry

-`, - name: "Test Template" -}); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Create a template from HTML", - "operationId": "createTemplateFromHtml", + "summary": "Create a template from PDF", + "operationId": "createTemplateFromPdf", "parameters": [], "requestBody": { "required": true, @@ -1644,55 +2881,23 @@ and typesetting industry

"schema": { "type": "object", "required": [ - "html" + "documents" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML template of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML template of the footer to be displayed on every page." - }, "name": { "type": "string", - "description": "Template name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", - "example": "714d974e-83d8-11ee-b962-0242ac120002" + "description": "Name of the template", + "example": "Test PDF" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", + "example": "unique-key" + }, "shared_link": { "type": "boolean", "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", @@ -1700,25 +2905,287 @@ and typesetting industry

}, "documents": { "type": "array", - "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "html" + "name", + "file" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, "name": { "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "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": { + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } } } } + }, + "flatten": { + "type": "boolean", + "description": "Remove PDF form fields from the documents.", + "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 } } } @@ -1840,7 +3307,8 @@ const template = await docuseal.createTemplateFromDocx({ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -1978,6 +3446,15 @@ const template = await docuseal.createTemplateFromDocx({ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -2031,6 +3508,13 @@ const template = await docuseal.createTemplateFromDocx({ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -2048,38 +3532,26 @@ const template = await docuseal.createTemplateFromDocx({ } ``` -### Create a template from existing PDF - -The API endpoint provides the functionality to create a fillable document template for existing PDF 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 +### Create a template from HTML +The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML ```javascript const docuseal = require("@docuseal/api"); docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const template = await docuseal.createTemplateFromPdf({ - name: "Test PDF", - documents: [ - { - name: "string", - file: "base64", - fields: [ - { - name: "string", - areas: [ - { - x: 0, - y: 0, - w: 0, - h: 0, - page: 1 - } - ] - } - ] - } - ] +const template = await docuseal.createTemplateFromHtml({ + html: `

Lorem Ipsum is simply dummy text of the + + +and typesetting industry

+`, + name: "Test Template" }); ``` @@ -2093,8 +3565,8 @@ const template = await docuseal.createTemplateFromPdf({ "tags": [ "Templates" ], - "summary": "Create a template from existing PDF", - "operationId": "createTemplateFromPdf", + "summary": "Create a template from HTML", + "operationId": "createTemplateFromHtml", "parameters": [], "requestBody": { "required": true, @@ -2103,246 +3575,78 @@ const template = await docuseal.createTemplateFromPdf({ "schema": { "type": "object", "required": [ - "documents" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML template of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML template of the footer to be displayed on every page." + }, "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "Template name. Random uuid will be assigned when not specified.", + "example": "Test Template" + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", + "example": "714d974e-83d8-11ee-b962-0242ac120002" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" + "shared_link": { + "type": "boolean", + "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", + "default": true }, "documents": { "type": "array", + "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "name", - "file" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, "name": { "type": "string", - "description": "Name of the document." - }, - "file": { - "example": "base64", - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - }, - "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 - } - } - } - } - } - }, - "flatten": { - "type": "boolean", - "description": "Remove PDF form fields from the document.", - "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 + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" } } } @@ -2355,6 +3659,72 @@ const template = await docuseal.createTemplateFromPdf({ } ``` +### Clone a template + +The API endpoint allows you to clone existing template into a new template. + +```javascript +const docuseal = require("@docuseal/api"); + +docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); + +const template = await docuseal.cloneTemplate(1000001, { + name: "Cloned Template" +}); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Clone a template", + "operationId": "cloneTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", + "example": "Cloned Template" + }, + "folder_name": { + "type": "string", + "description": "The folder's name to which the template should be cloned." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app." + } + } + } + } + } + } +} +``` + ### Merge templates The API endpoint allows you to merge multiple templates with documents and fields into a new combined template. @@ -2444,44 +3814,18 @@ 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. 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 +### Update a template +The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. ```javascript const docuseal = require("@docuseal/api"); docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const submission = await docuseal.createSubmissionFromPdf({ - name: "Test Submission Document", - documents: [ - { - name: "string", - file: "base64", - fields: [ - { - name: "string", - areas: [ - { - x: 0, - y: 0, - w: 0, - h: 0, - page: 1 - } - ] - } - ] - } - ], - submitters: [ - { - role: "First Party", - email: "john.doe@example.com" - } - ] +const template = await docuseal.updateTemplate(1000001, { + name: "New Document Name", + folder_name: "New Folder" }); ``` @@ -2493,507 +3837,53 @@ const submission = await docuseal.createSubmissionFromPdf({ } ], "tags": [ - "Submissions" + "Templates" + ], + "summary": "Update a template", + "operationId": "updateTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } ], - "summary": "Create a submission from PDF", - "operationId": "createSubmissionFromPdf", - "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" + "description": "The name of the template", + "example": "New Document Name" }, - "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 - }, - "order": { + "folder_name": { "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" + "description": "The folder's name to which the template should be moved.", + "example": "New Folder" + }, + "roles": { + "type": "array", + "description": "An array of submitter role names to update the template with.", + "items": { + "type": "string" + }, + "example": [ + "Agent", + "Customer" ] }, - "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - } - } - } - }, - "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}}." - } - } - }, - "flatten": { + "archived": { "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 + "description": "Set `false` to unarchive template." } } } @@ -3003,502 +3893,19 @@ const submission = await docuseal.createSubmissionFromPdf({ } ``` -### Create a submission from HTML +### Update template documents -This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML +The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. ```javascript const docuseal = require("@docuseal/api"); docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const submission = await docuseal.createSubmissionFromHtml({ - name: "Test Submission Document", +const template = await docuseal.updateTemplateDocuments(1000001, { documents: [ { - name: "Test Document", - html: `

Lorem Ipsum is simply dummy text of the - - -and typesetting industry

-` - } - ], - submitters: [ - { - role: "First Party", - email: "john.doe@example.com" - } - ] -}); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create a submission from HTML", - "operationId": "createSubmissionFromHtml", - "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 - }, - "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", - "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", - "items": { - "type": "object", - "required": [ - "html" - ], - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" - }, - "html": { - "type": "string", - "description": "HTML document content with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML document content of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML document content of the footer to be displayed on every page." - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a template from PDF - -The API endpoint provides the functionality to create a fillable document template for a PDF 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 - - -```javascript -const docuseal = require("@docuseal/api"); - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const template = await docuseal.createTemplateFromPdf({ - name: "Test PDF", - documents: [ - { - name: "string", - file: "base64", - fields: [ - { - name: "string", - areas: [ - { - x: 0, - y: 0, - w: 0, - h: 0, - page: 1 - } - ] - } - ] + file: "string" } ] }); @@ -3514,304 +3921,69 @@ const template = await docuseal.createTemplateFromPdf({ "tags": [ "Templates" ], - "summary": "Create a template from PDF", - "operationId": "createTemplateFromPdf", - "parameters": [], + "summary": "Update template documents", + "operationId": "addDocumentToTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", - "required": [ - "documents" - ], "properties": { - "name": { - "type": "string", - "description": "Name of the template", - "example": "Test PDF" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be created." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" - }, - "shared_link": { - "type": "boolean", - "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", - "default": true - }, "documents": { "type": "array", + "description": "The list of documents to add or replace in the template.", "items": { "type": "object", - "required": [ - "name", - "file" - ], "properties": { "name": { "type": "string", - "description": "Name of the document." + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Template" }, "file": { - "example": "base64", "type": "string", "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "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": { - "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 - } - } - } - } - } + "html": { + "type": "string", + "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." + }, + "position": { + "type": "integer", + "description": "Position of the document. By default will be added as the last document in the template.", + "example": 0 + }, + "replace": { + "type": "boolean", + "default": false, + "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." + }, + "remove": { + "type": "boolean", + "default": false, + "description": "Set to `true` to remove existing document at given `position` or with given `name`." } } } }, - "flatten": { + "merge": { "type": "boolean", - "description": "Remove PDF form fields from the documents.", - "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 + "default": false, + "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." } } } @@ -3821,33 +3993,16 @@ const template = await docuseal.createTemplateFromPdf({ } ``` -### Create a submission from DOCX +### Archive a template -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 +The API endpoint allows you to archive a document template. ```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" - } - ] -}); +await docuseal.archiveTemplate(1000001); ``` ```json @@ -3858,412 +4013,22 @@ const submission = await docuseal.createSubmissionFromDocx({ } ], "tags": [ - "Submissions" + "Templates" ], - "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 - } - } - } - } + "summary": "Archive a template", + "operationId": "archiveTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 } - } + ] } ``` diff --git a/docs/api/nodejs.md b/docs/api/nodejs.md index d5865715..c1e00c63 100644 --- a/docs/api/nodejs.md +++ b/docs/api/nodejs.md @@ -1,283 +1,3 @@ -### List all templates - -The API endpoint provides the ability to retrieve a list of available document templates. - -```nodejs -const fetch = require("node-fetch"); - -const resp = await fetch("https://api.docuseal.com/templates", { - method: "GET", - headers: { - "X-Auth-Token": "API_KEY" - } -}); - -const { data, pagination } = await resp.json(); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "List all templates", - "operationId": "getTemplates", - "parameters": [ - { - "name": "q", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates based on the name partial match." - }, - { - "name": "slug", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by unique slug.", - "example": "opaKWh8WWTAcVG" - }, - { - "name": "external_id", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." - }, - { - "name": "folder", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by folder name." - }, - { - "name": "archived", - "in": "query", - "required": false, - "schema": { - "type": "boolean" - }, - "description": "Get only archived templates instead of active ones." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The number of templates to return. Default value is 10. Maximum value is 100." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." - }, - { - "name": "before", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." - } - ] -} -``` - -### Get a template - -The API endpoint provides the functionality to retrieve information about a document template. - -```nodejs -const fetch = require("node-fetch"); - -const resp = await fetch("https://api.docuseal.com/templates/1000001", { - method: "GET", - headers: { - "X-Auth-Token": "API_KEY" - } -}); - -const template = await resp.json(); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Get a template", - "operationId": "getTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Archive a template - -The API endpoint allows you to archive a document template. - -```nodejs -const fetch = require("node-fetch"); - -const resp = await fetch("https://api.docuseal.com/templates/1000001", { - method: "DELETE", - headers: { - "X-Auth-Token": "API_KEY" - } -}); - -await resp.json(); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Archive a template", - "operationId": "archiveTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Update a template - -The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. - -```nodejs -const fetch = require("node-fetch"); - -const resp = await fetch("https://api.docuseal.com/templates/1000001", { - method: "PUT", - headers: { - "X-Auth-Token": "API_KEY" - }, - body: JSON.stringify({ - name: "New Document Name", - folder_name: "New Folder" - }) -}); - -const template = await resp.json(); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Update a template", - "operationId": "updateTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the template", - "example": "New Document Name" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be moved.", - "example": "New Folder" - }, - "roles": { - "type": "array", - "description": "An array of submitter role names to update the template with.", - "items": { - "type": "string" - }, - "example": [ - "Agent", - "Customer" - ] - }, - "archived": { - "type": "boolean", - "description": "Set `false` to unarchive template." - } - } - } - } - } - } -} -``` - ### List all submissions The API endpoint provides the ability to retrieve a list of available submissions. @@ -400,6 +120,94 @@ const { data, pagination } = await resp.json(); } ``` +### Get a submission + +The API endpoint provides the functionality to retrieve information about a submission. + +```nodejs +const fetch = require("node-fetch"); + +const resp = await fetch("https://api.docuseal.com/submissions/1001", { + method: "GET", + headers: { + "X-Auth-Token": "API_KEY" + } +}); + +const submission = await resp.json(); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get a submission", + "operationId": "getSubmission", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + +### Get submission documents + +This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. + +```nodejs +const fetch = require("node-fetch"); + +const resp = await fetch("https://api.docuseal.com/submissions/1001/documents", { + method: "GET", + headers: { + "X-Auth-Token": "API_KEY" + } +}); + +const submission = await resp.json(); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get submission documents", + "operationId": "getSubmissionDocuments", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + ### Create a submission This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).
Related Guides
Send documents for signature via API
Pre-fill PDF document form fields with API @@ -578,6 +386,11 @@ const submitters = await resp.json(); "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -729,6 +542,15 @@ const submitters = await resp.json(); ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -782,6 +604,13 @@ const submitters = await resp.json(); } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -806,18 +635,48 @@ const submitters = await resp.json(); } ``` -### Get a submission +### Create a submission from PDF + +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 -The API endpoint provides the functionality to retrieve information about a submission. ```nodejs const fetch = require("node-fetch"); -const resp = await fetch("https://api.docuseal.com/submissions/1001", { - method: "GET", +const resp = await fetch("https://api.docuseal.com/submissions/pdf", { + method: "POST", headers: { "X-Auth-Token": "API_KEY" - } + }, + body: JSON.stringify({ + name: "Test Submission Document", + documents: [ + { + name: "string", + file: "base64", + fields: [ + { + name: "string", + areas: [ + { + x: 0, + y: 0, + w: 0, + h: 0, + page: 1 + } + ] + } + ] + } + ], + submitters: [ + { + role: "First Party", + email: "john.doe@example.com" + } + ] + }) }); const submission = await resp.json(); @@ -833,20 +692,1511 @@ const submission = await resp.json(); "tags": [ "Submissions" ], - "summary": "Get a submission", - "operationId": "getSubmission", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the submission.", - "example": 1001 + "summary": "Create a submission from PDF", + "operationId": "createSubmissionFromPdf", + "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 + }, + "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 file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "Option B" + ] + } + } + } + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } } - ] + } +} +``` + +### 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}} field syntax to define fillable fields, as in a PDF.
Related Guides
Use dynamic content variables in DOCX to create personalized documents + +```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. Variable values can be strings, numbers, arrays, objects, or HTML content used to generate styled text, paragraphs, and tables in DOCX.", + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### Create a submission from HTML + +This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML + +```nodejs +const fetch = require("node-fetch"); + +const resp = await fetch("https://api.docuseal.com/submissions/html", { + method: "POST", + headers: { + "X-Auth-Token": "API_KEY" + }, + body: JSON.stringify({ + name: "Test Submission Document", + documents: [ + { + name: "Test Document", + html: `

Lorem Ipsum is simply dummy text of the + + +and typesetting industry

+` + } + ], + submitters: [ + { + role: "First Party", + email: "john.doe@example.com" + } + ] + }) +}); + +const submission = await resp.json(); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from HTML", + "operationId": "createSubmissionFromHtml", + "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 + }, + "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", + "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", + "items": { + "type": "object", + "required": [ + "html" + ], + "properties": { + "name": { + "type": "string", + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" + }, + "html": { + "type": "string", + "description": "HTML document content with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML document content of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML document content of the footer to be displayed on every page." + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } } ``` @@ -894,21 +2244,21 @@ await resp.json(); } ``` -### Get submission documents +### List all submitters -This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. +The API endpoint provides the ability to retrieve a list of submitters. ```nodejs const fetch = require("node-fetch"); -const resp = await fetch("https://api.docuseal.com/submissions/1001/documents", { +const resp = await fetch("https://api.docuseal.com/submitters", { method: "GET", headers: { "X-Auth-Token": "API_KEY" } }); -const submission = await resp.json(); +const { data, pagination } = await resp.json(); ``` ```json @@ -919,106 +2269,101 @@ const submission = await resp.json(); } ], "tags": [ - "Submissions" + "Submitters" ], - "summary": "Get submission documents", - "operationId": "getSubmissionDocuments", + "summary": "List all submitters", + "operationId": "getSubmitters", "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "submission_id", + "in": "query", + "required": false, "schema": { "type": "integer" }, - "description": "The unique identifier of the submission.", - "example": 1001 + "description": "The submission ID allows you to receive only the submitters related to that specific submission." + }, + { + "name": "q", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters on name, email or phone partial match." + }, + { + "name": "slug", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters by unique slug.", + "example": "zAyL9fH36Havvm" + }, + { + "name": "completed_after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-05 9:32:20", + "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." + }, + { + "name": "completed_before", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-06 19:32:20", + "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + }, + { + "name": "external_id", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + }, + { + "name": "before", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." } ] } ``` -### Create submissions from emails - -This API endpoint allows you to create submissions for a document template and send them to the specified email addresses. This is a simplified version of the POST /submissions API to be used with Zapier or other automation tools. - -```nodejs -const fetch = require("node-fetch"); - -const resp = await fetch("https://api.docuseal.com/submissions/emails", { - method: "POST", - headers: { - "X-Auth-Token": "API_KEY" - }, - body: JSON.stringify({ - template_id: 1000001, - emails: "hi@docuseal.com, example@docuseal.com" - }) -}); - -const submitters = await resp.json(); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create submissions from emails", - "operationId": "createSubmissionsFromEmails", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "template_id", - "emails" - ], - "properties": { - "template_id": { - "type": "integer", - "description": "The unique identifier of the template.", - "example": 1000001 - }, - "emails": { - "type": "string", - "description": "A comma-separated list of email addresses to send the submission to.", - "example": "{{emails}}" - }, - "send_email": { - "type": "boolean", - "description": "Set `false` to disable signature request emails sending.", - "default": true - }, - "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: {{template.name}}, {{submitter.link}}, {{account.name}}." - } - } - } - } - } - } - } - } -} -``` - ### Get a submitter The API endpoint provides functionality to retrieve information about a submitter, along with the submitter documents and field values. @@ -1317,6 +2662,15 @@ const submitter = await resp.json(); ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1370,6 +2724,13 @@ const submitter = await resp.json(); } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -1384,14 +2745,14 @@ const submitter = await resp.json(); } ``` -### List all submitters +### List all templates -The API endpoint provides the ability to retrieve a list of submitters. +The API endpoint provides the ability to retrieve a list of available document templates. ```nodejs const fetch = require("node-fetch"); -const resp = await fetch("https://api.docuseal.com/submitters", { +const resp = await fetch("https://api.docuseal.com/templates", { method: "GET", headers: { "X-Auth-Token": "API_KEY" @@ -1409,20 +2770,11 @@ const { data, pagination } = await resp.json(); } ], "tags": [ - "Submitters" + "Templates" ], - "summary": "List all submitters", - "operationId": "getSubmitters", + "summary": "List all templates", + "operationId": "getTemplates", "parameters": [ - { - "name": "submission_id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The submission ID allows you to receive only the submitters related to that specific submission." - }, { "name": "q", "in": "query", @@ -1430,7 +2782,7 @@ const { data, pagination } = await resp.json(); "schema": { "type": "string" }, - "description": "Filter submitters on name, email or phone partial match." + "description": "Filter templates based on the name partial match." }, { "name": "slug", @@ -1439,30 +2791,8 @@ const { data, pagination } = await resp.json(); "schema": { "type": "string" }, - "description": "Filter submitters by unique slug.", - "example": "zAyL9fH36Havvm" - }, - { - "name": "completed_after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-05 9:32:20", - "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." - }, - { - "name": "completed_before", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-06 19:32:20", - "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + "description": "Filter templates by unique slug.", + "example": "opaKWh8WWTAcVG" }, { "name": "external_id", @@ -1471,7 +2801,25 @@ const { data, pagination } = await resp.json(); "schema": { "type": "string" }, - "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." + }, + { + "name": "folder", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter templates by folder name." + }, + { + "name": "archived", + "in": "query", + "required": false, + "schema": { + "type": "boolean" + }, + "description": "Get only archived templates instead of active ones." }, { "name": "limit", @@ -1480,7 +2828,7 @@ const { data, pagination } = await resp.json(); "schema": { "type": "integer" }, - "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + "description": "The number of templates to return. Default value is 10. Maximum value is 100." }, { "name": "after", @@ -1489,7 +2837,7 @@ const { data, pagination } = await resp.json(); "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." }, { "name": "before", @@ -1498,28 +2846,89 @@ const { data, pagination } = await resp.json(); "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." + "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." } ] } ``` -### Update template documents +### Get a template -The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. +The API endpoint provides the functionality to retrieve information about a document template. ```nodejs const fetch = require("node-fetch"); -const resp = await fetch("https://api.docuseal.com/templates/1000001/documents", { - method: "PUT", +const resp = await fetch("https://api.docuseal.com/templates/1000001", { + method: "GET", + headers: { + "X-Auth-Token": "API_KEY" + } +}); + +const template = await resp.json(); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Get a template", + "operationId": "getTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ] +} +``` + +### Create a template from PDF + +The API endpoint provides the functionality to create a fillable document template for a PDF 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 + + +```nodejs +const fetch = require("node-fetch"); + +const resp = await fetch("https://api.docuseal.com/templates/pdf", { + method: "POST", headers: { "X-Auth-Token": "API_KEY" }, body: JSON.stringify({ + name: "Test PDF", documents: [ { - file: "string" + name: "string", + file: "base64", + fields: [ + { + name: "string", + areas: [ + { + x: 0, + y: 0, + w: 0, + h: 0, + page: 1 + } + ] + } + ] } ] }) @@ -1538,69 +2947,321 @@ const template = await resp.json(); "tags": [ "Templates" ], - "summary": "Update template documents", - "operationId": "addDocumentToTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], + "summary": "Create a template from PDF", + "operationId": "createTemplateFromPdf", + "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", + "required": [ + "documents" + ], "properties": { + "name": { + "type": "string", + "description": "Name of the template", + "example": "Test PDF" + }, + "folder_name": { + "type": "string", + "description": "The folder's name to which the template should be created." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", + "example": "unique-key" + }, + "shared_link": { + "type": "boolean", + "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", + "default": true + }, "documents": { "type": "array", - "description": "The list of documents to add or replace in the template.", "items": { "type": "object", + "required": [ + "name", + "file" + ], "properties": { "name": { "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Template" + "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. Leave it empty if you create a new document using HTML param." + "description": "Base64-encoded content of the PDF file or downloadable file URL." }, - "html": { - "type": "string", - "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." - }, - "position": { - "type": "integer", - "description": "Position of the document. By default will be added as the last document in the template.", - "example": 0 - }, - "replace": { - "type": "boolean", - "default": false, - "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." - }, - "remove": { - "type": "boolean", - "default": false, - "description": "Set to `true` to remove existing document at given `position` or with given `name`." + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "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": { + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } } } } }, - "merge": { + "flatten": { "type": "boolean", - "default": false, - "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." + "description": "Remove PDF form fields from the documents.", + "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 } } } @@ -1610,20 +3271,27 @@ const template = await resp.json(); } ``` -### Clone a template +### Create a template from Word DOCX + +The API endpoint provides the functionality to create a fillable document template for existing Microsoft Word document. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.docx 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 allows you to clone existing template into a new template. ```nodejs const fetch = require("node-fetch"); -const resp = await fetch("https://api.docuseal.com/templates/1000001/clone", { +const resp = await fetch("https://api.docuseal.com/templates/docx", { method: "POST", headers: { "X-Auth-Token": "API_KEY" }, body: JSON.stringify({ - name: "Cloned Template" + name: "Test DOCX", + documents: [ + { + name: "string", + file: "base64" + } + ] }) }); @@ -1640,39 +3308,303 @@ const template = await resp.json(); "tags": [ "Templates" ], - "summary": "Clone a template", - "operationId": "cloneTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], + "summary": "Create a template from Word DOCX", + "operationId": "createTemplateFromDocx", + "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", + "required": [ + "documents" + ], "properties": { "name": { "type": "string", - "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", - "example": "Cloned Template" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be cloned." + "description": "Name of the template", + "example": "Test DOCX" }, "external_id": { "type": "string", - "description": "Your application-specific unique string key to identify this template within your app." + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new document.", + "example": "unique-key" + }, + "folder_name": { + "type": "string", + "description": "The folder's name to which the template should be created." + }, + "shared_link": { + "type": "boolean", + "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", + "default": true + }, + "documents": { + "type": "array", + "items": { + "type": "object", + "required": [ + "name", + "file" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the document." + }, + "file": { + "type": "string", + "example": "base64", + "format": "base64", + "description": "Base64-encoded content of the DOCX file or downloadable file URL" + }, + "fields": { + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1." + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "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": { + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + } + } } } } @@ -1815,27 +3747,20 @@ const template = await resp.json(); } ``` -### Create a template from Word DOCX - -The API endpoint provides the functionality to create a fillable document template for existing Microsoft Word document. Use {{Field Name;role=Signer1;type=date}} text tags to define fillable fields in the document. See https://www.docuseal.com/examples/fieldtags.docx 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 +### Clone a template +The API endpoint allows you to clone existing template into a new template. ```nodejs const fetch = require("node-fetch"); -const resp = await fetch("https://api.docuseal.com/templates/docx", { +const resp = await fetch("https://api.docuseal.com/templates/1000001/clone", { method: "POST", headers: { "X-Auth-Token": "API_KEY" }, body: JSON.stringify({ - name: "Test DOCX", - documents: [ - { - name: "string", - file: "base64" - } - ] + name: "Cloned Template" }) }); @@ -1852,599 +3777,39 @@ const template = await resp.json(); "tags": [ "Templates" ], - "summary": "Create a template from Word DOCX", - "operationId": "createTemplateFromDocx", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "documents" - ], - "properties": { - "name": { - "type": "string", - "description": "Name of the template", - "example": "Test DOCX" - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new document.", - "example": "unique-key" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be created." - }, - "shared_link": { - "type": "boolean", - "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", - "default": true - }, - "documents": { - "type": "array", - "items": { - "type": "object", - "required": [ - "name", - "file" - ], - "properties": { - "name": { - "type": "string", - "description": "Name of the document." - }, - "file": { - "type": "string", - "example": "base64", - "format": "base64", - "description": "Base64-encoded content of the DOCX file or downloadable file URL" - }, - "fields": { - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1." - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "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": { - "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 - } - } - } - } - } - } - } - } - } - } - } - } - } - } -} -``` - -### Create a template from existing PDF - -The API endpoint provides the functionality to create a fillable document template for existing PDF 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 - - -```nodejs -const fetch = require("node-fetch"); - -const resp = await fetch("https://api.docuseal.com/templates/pdf", { - method: "POST", - headers: { - "X-Auth-Token": "API_KEY" - }, - body: JSON.stringify({ - name: "Test PDF", - documents: [ - { - name: "string", - file: "base64", - fields: [ - { - name: "string", - areas: [ - { - x: 0, - y: 0, - w: 0, - h: 0, - page: 1 - } - ] - } - ] - } - ] - }) -}); - -const template = await resp.json(); -``` - -```json -{ - "security": [ + "summary": "Clone a template", + "operationId": "cloneTemplate", + "parameters": [ { - "AuthToken": [] + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 } ], - "tags": [ - "Templates" - ], - "summary": "Create a template from existing PDF", - "operationId": "createTemplateFromPdf", - "parameters": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", - "required": [ - "documents" - ], "properties": { "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", + "example": "Cloned Template" }, "folder_name": { "type": "string", - "description": "The folder's name to which the template should be created." + "description": "The folder's name to which the template should be cloned." }, "external_id": { "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" - }, - "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - }, - "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 - } - } - } - } - } - }, - "flatten": { - "type": "boolean", - "description": "Remove PDF form fields from the document.", - "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 - } - } - } + "description": "Your application-specific unique string key to identify this template within your app." } } } @@ -2549,51 +3914,25 @@ 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. 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 +### Update a template +The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. ```nodejs const fetch = require("node-fetch"); -const resp = await fetch("https://api.docuseal.com/submissions/pdf", { - method: "POST", +const resp = await fetch("https://api.docuseal.com/templates/1000001", { + method: "PUT", headers: { "X-Auth-Token": "API_KEY" }, body: JSON.stringify({ - name: "Test Submission Document", - documents: [ - { - name: "string", - file: "base64", - fields: [ - { - name: "string", - areas: [ - { - x: 0, - y: 0, - w: 0, - h: 0, - page: 1 - } - ] - } - ] - } - ], - submitters: [ - { - role: "First Party", - email: "john.doe@example.com" - } - ] + name: "New Document Name", + folder_name: "New Folder" }) }); -const submission = await resp.json(); +const template = await resp.json(); ``` ```json @@ -2604,979 +3943,53 @@ const submission = await resp.json(); } ], "tags": [ - "Submissions" + "Templates" ], - "summary": "Create a submission from PDF", - "operationId": "createSubmissionFromPdf", - "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 - }, - "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - } - } - } - }, - "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}}." - } - } - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a submission from HTML - -This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML - -```nodejs -const fetch = require("node-fetch"); - -const resp = await fetch("https://api.docuseal.com/submissions/html", { - method: "POST", - headers: { - "X-Auth-Token": "API_KEY" - }, - body: JSON.stringify({ - name: "Test Submission Document", - documents: [ - { - name: "Test Document", - html: `

Lorem Ipsum is simply dummy text of the - - -and typesetting industry

-` - } - ], - submitters: [ - { - role: "First Party", - email: "john.doe@example.com" - } - ] - }) -}); - -const submission = await resp.json(); -``` - -```json -{ - "security": [ + "summary": "Update a template", + "operationId": "updateTemplate", + "parameters": [ { - "AuthToken": [] + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 } ], - "tags": [ - "Submissions" - ], - "summary": "Create a submission from HTML", - "operationId": "createSubmissionFromHtml", - "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" + "description": "The name of the template", + "example": "New Document Name" }, - "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 - }, - "order": { + "folder_name": { "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" + "description": "The folder's name to which the template should be moved.", + "example": "New Folder" + }, + "roles": { + "type": "array", + "description": "An array of submitter role names to update the template with.", + "items": { + "type": "string" + }, + "example": [ + "Agent", + "Customer" ] }, - "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", - "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", - "items": { - "type": "object", - "required": [ - "html" - ], - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" - }, - "html": { - "type": "string", - "description": "HTML document content with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML document content of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML document content of the footer to be displayed on every page." - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "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": { + "archived": { "type": "boolean", - "description": "Set `true` to merge the documents into a single PDF file.", - "default": false + "description": "Set `false` to unarchive template." } } } @@ -3586,39 +3999,22 @@ const submission = await resp.json(); } ``` -### Create a template from PDF - -The API endpoint provides the functionality to create a fillable document template for a PDF 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 +### Update template documents +The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. ```nodejs const fetch = require("node-fetch"); -const resp = await fetch("https://api.docuseal.com/templates/pdf", { - method: "POST", +const resp = await fetch("https://api.docuseal.com/templates/1000001/documents", { + method: "PUT", headers: { "X-Auth-Token": "API_KEY" }, body: JSON.stringify({ - name: "Test PDF", documents: [ { - name: "string", - file: "base64", - fields: [ - { - name: "string", - areas: [ - { - x: 0, - y: 0, - w: 0, - h: 0, - page: 1 - } - ] - } - ] + file: "string" } ] }) @@ -3637,304 +4033,69 @@ const template = await resp.json(); "tags": [ "Templates" ], - "summary": "Create a template from PDF", - "operationId": "createTemplateFromPdf", - "parameters": [], + "summary": "Update template documents", + "operationId": "addDocumentToTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", - "required": [ - "documents" - ], "properties": { - "name": { - "type": "string", - "description": "Name of the template", - "example": "Test PDF" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be created." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" - }, - "shared_link": { - "type": "boolean", - "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", - "default": true - }, "documents": { "type": "array", + "description": "The list of documents to add or replace in the template.", "items": { "type": "object", - "required": [ - "name", - "file" - ], "properties": { "name": { "type": "string", - "description": "Name of the document." + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Template" }, "file": { - "example": "base64", "type": "string", "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "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": { - "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 - } - } - } - } - } + "html": { + "type": "string", + "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." + }, + "position": { + "type": "integer", + "description": "Position of the document. By default will be added as the last document in the template.", + "example": 0 + }, + "replace": { + "type": "boolean", + "default": false, + "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." + }, + "remove": { + "type": "boolean", + "default": false, + "description": "Set to `true` to remove existing document at given `position` or with given `name`." } } } }, - "flatten": { + "merge": { "type": "boolean", - "description": "Remove PDF form fields from the documents.", - "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 + "default": false, + "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." } } } @@ -3944,39 +4105,21 @@ const template = await resp.json(); } ``` -### Create a submission from DOCX +### Archive a template -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 +The API endpoint allows you to archive a document template. ```nodejs const fetch = require("node-fetch"); -const resp = await fetch("https://api.docuseal.com/submissions/docx", { - method: "POST", +const resp = await fetch("https://api.docuseal.com/templates/1000001", { + method: "DELETE", 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(); +await resp.json(); ``` ```json @@ -3987,412 +4130,22 @@ const submitters = await resp.json(); } ], "tags": [ - "Submissions" + "Templates" ], - "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 - } - } - } - } + "summary": "Archive a template", + "operationId": "archiveTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 } - } + ] } ``` diff --git a/docs/api/php.md b/docs/api/php.md index 81c10af2..a56fe2ca 100644 --- a/docs/api/php.md +++ b/docs/api/php.md @@ -1,254 +1,3 @@ -### List all templates - -The API endpoint provides the ability to retrieve a list of available document templates. - -```php -$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); - -$docuseal->listTemplates(['limit' => 10]); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "List all templates", - "operationId": "getTemplates", - "parameters": [ - { - "name": "q", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates based on the name partial match." - }, - { - "name": "slug", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by unique slug.", - "example": "opaKWh8WWTAcVG" - }, - { - "name": "external_id", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." - }, - { - "name": "folder", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by folder name." - }, - { - "name": "archived", - "in": "query", - "required": false, - "schema": { - "type": "boolean" - }, - "description": "Get only archived templates instead of active ones." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The number of templates to return. Default value is 10. Maximum value is 100." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." - }, - { - "name": "before", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." - } - ] -} -``` - -### Get a template - -The API endpoint provides the functionality to retrieve information about a document template. - -```php -$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); - -$docuseal->getTemplate(1000001); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Get a template", - "operationId": "getTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Archive a template - -The API endpoint allows you to archive a document template. - -```php -$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); - -$docuseal->archiveTemplate(1000001); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Archive a template", - "operationId": "archiveTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Update a template - -The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. - -```php -$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); - -$docuseal->updateTemplate(1000001, [ - 'name' => 'New Document Name', - 'folder_name' => 'New Folder' -]); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Update a template", - "operationId": "updateTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the template", - "example": "New Document Name" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be moved.", - "example": "New Folder" - }, - "roles": { - "type": "array", - "description": "An array of submitter role names to update the template with.", - "items": { - "type": "string" - }, - "example": [ - "Agent", - "Customer" - ] - }, - "archived": { - "type": "boolean", - "description": "Set `false` to unarchive template." - } - } - } - } - } - } -} -``` - ### List all submissions The API endpoint provides the ability to retrieve a list of available submissions. @@ -364,6 +113,80 @@ $docuseal->listSubmissions(['limit' => 10]); } ``` +### Get a submission + +The API endpoint provides the functionality to retrieve information about a submission. + +```php +$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); + +$docuseal->getSubmission(1001); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get a submission", + "operationId": "getSubmission", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + +### Get submission documents + +This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. + +```php +$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); + +$docuseal->getSubmissionDocuments(1001); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get submission documents", + "operationId": "getSubmissionDocuments", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + ### Create a submission This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).
Related Guides
Send documents for signature via API
Pre-fill PDF document form fields with API @@ -534,6 +357,11 @@ $docuseal->createSubmission([ "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -685,6 +513,15 @@ $docuseal->createSubmission([ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -738,6 +575,13 @@ $docuseal->createSubmission([ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -762,14 +606,43 @@ $docuseal->createSubmission([ } ``` -### Get a submission +### Create a submission from PDF + +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 -The API endpoint provides the functionality to retrieve information about a submission. ```php $docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); -$docuseal->getSubmission(1001); +$docuseal->createSubmissionFromPdf([ + 'name' => 'Test Submission Document', + 'documents' => [ + [ + 'name' => 'string', + 'file' => 'base64', + 'fields' => [ + [ + 'name' => 'string', + 'areas' => [ + [ + 'x' => 0, + 'y' => 0, + 'w' => 0, + 'h' => 0, + 'page' => 1 + ] + ] + ] + ] + ] + ], + 'submitters' => [ + [ + 'role' => 'First Party', + 'email' => 'john.doe@example.com' + ] + ] +]); ``` ```json @@ -782,20 +655,1495 @@ $docuseal->getSubmission(1001); "tags": [ "Submissions" ], - "summary": "Get a submission", - "operationId": "getSubmission", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the submission.", - "example": 1001 + "summary": "Create a submission from PDF", + "operationId": "createSubmissionFromPdf", + "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 + }, + "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 file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "Option B" + ] + } + } + } + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } } + } +} +``` + +### 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}} field syntax to define fillable fields, as in a PDF.
Related Guides
Use dynamic content variables in DOCX to create personalized documents + +```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. Variable values can be strings, numbers, arrays, objects, or HTML content used to generate styled text, paragraphs, and tables in DOCX.", + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### Create a submission from HTML + +This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML + +```php +$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); + +$docuseal->createSubmissionFromHtml([ + 'name' => 'Test Submission Document', + 'documents' => [ + [ + 'name' => 'Test Document', + 'html' => '

Lorem Ipsum is simply dummy text of the + + +and typesetting industry

+' + ] + ], + 'submitters' => [ + [ + 'role' => 'First Party', + 'email' => 'john.doe@example.com' + ] + ] +]); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from HTML", + "operationId": "createSubmissionFromHtml", + "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 + }, + "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", + "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", + "items": { + "type": "object", + "required": [ + "html" + ], + "properties": { + "name": { + "type": "string", + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" + }, + "html": { + "type": "string", + "description": "HTML document content with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML document content of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML document content of the footer to be displayed on every page." + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } } ``` @@ -836,14 +2184,14 @@ $docuseal->archiveSubmission(1001); } ``` -### Get submission documents +### List all submitters -This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. +The API endpoint provides the ability to retrieve a list of submitters. ```php $docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); -$docuseal->getSubmissionDocuments(1001); +$docuseal->listSubmitters(['limit' => 10]); ``` ```json @@ -854,98 +2202,101 @@ $docuseal->getSubmissionDocuments(1001); } ], "tags": [ - "Submissions" + "Submitters" ], - "summary": "Get submission documents", - "operationId": "getSubmissionDocuments", + "summary": "List all submitters", + "operationId": "getSubmitters", "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "submission_id", + "in": "query", + "required": false, "schema": { "type": "integer" }, - "description": "The unique identifier of the submission.", - "example": 1001 + "description": "The submission ID allows you to receive only the submitters related to that specific submission." + }, + { + "name": "q", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters on name, email or phone partial match." + }, + { + "name": "slug", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters by unique slug.", + "example": "zAyL9fH36Havvm" + }, + { + "name": "completed_after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-05 9:32:20", + "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." + }, + { + "name": "completed_before", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-06 19:32:20", + "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + }, + { + "name": "external_id", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + }, + { + "name": "before", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." } ] } ``` -### Create submissions from emails - -This API endpoint allows you to create submissions for a document template and send them to the specified email addresses. This is a simplified version of the POST /submissions API to be used with Zapier or other automation tools. - -```php -$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); - -$docuseal->createSubmissionFromEmails([ - 'template_id' => 1000001, - 'emails' => 'hi@docuseal.com, example@docuseal.com' -]); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create submissions from emails", - "operationId": "createSubmissionsFromEmails", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "template_id", - "emails" - ], - "properties": { - "template_id": { - "type": "integer", - "description": "The unique identifier of the template.", - "example": 1000001 - }, - "emails": { - "type": "string", - "description": "A comma-separated list of email addresses to send the submission to.", - "example": "{{emails}}" - }, - "send_email": { - "type": "boolean", - "description": "Set `false` to disable signature request emails sending.", - "default": true - }, - "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: {{template.name}}, {{submitter.link}}, {{account.name}}." - } - } - } - } - } - } - } - } -} -``` - ### Get a submitter The API endpoint provides functionality to retrieve information about a submitter, along with the submitter documents and field values. @@ -1229,6 +2580,15 @@ $docuseal->updateSubmitter(500001, [ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1282,6 +2642,13 @@ $docuseal->updateSubmitter(500001, [ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -1296,14 +2663,14 @@ $docuseal->updateSubmitter(500001, [ } ``` -### List all submitters +### List all templates -The API endpoint provides the ability to retrieve a list of submitters. +The API endpoint provides the ability to retrieve a list of available document templates. ```php $docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); -$docuseal->listSubmitters(['limit' => 10]); +$docuseal->listTemplates(['limit' => 10]); ``` ```json @@ -1314,20 +2681,11 @@ $docuseal->listSubmitters(['limit' => 10]); } ], "tags": [ - "Submitters" + "Templates" ], - "summary": "List all submitters", - "operationId": "getSubmitters", + "summary": "List all templates", + "operationId": "getTemplates", "parameters": [ - { - "name": "submission_id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The submission ID allows you to receive only the submitters related to that specific submission." - }, { "name": "q", "in": "query", @@ -1335,7 +2693,7 @@ $docuseal->listSubmitters(['limit' => 10]); "schema": { "type": "string" }, - "description": "Filter submitters on name, email or phone partial match." + "description": "Filter templates based on the name partial match." }, { "name": "slug", @@ -1344,30 +2702,8 @@ $docuseal->listSubmitters(['limit' => 10]); "schema": { "type": "string" }, - "description": "Filter submitters by unique slug.", - "example": "zAyL9fH36Havvm" - }, - { - "name": "completed_after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-05 9:32:20", - "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." - }, - { - "name": "completed_before", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-06 19:32:20", - "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + "description": "Filter templates by unique slug.", + "example": "opaKWh8WWTAcVG" }, { "name": "external_id", @@ -1376,7 +2712,25 @@ $docuseal->listSubmitters(['limit' => 10]); "schema": { "type": "string" }, - "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." + }, + { + "name": "folder", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter templates by folder name." + }, + { + "name": "archived", + "in": "query", + "required": false, + "schema": { + "type": "boolean" + }, + "description": "Get only archived templates instead of active ones." }, { "name": "limit", @@ -1385,7 +2739,7 @@ $docuseal->listSubmitters(['limit' => 10]); "schema": { "type": "integer" }, - "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + "description": "The number of templates to return. Default value is 10. Maximum value is 100." }, { "name": "after", @@ -1394,7 +2748,7 @@ $docuseal->listSubmitters(['limit' => 10]); "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." }, { "name": "before", @@ -1403,23 +2757,77 @@ $docuseal->listSubmitters(['limit' => 10]); "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." + "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." } ] } ``` -### Update template documents +### Get a template -The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. +The API endpoint provides the functionality to retrieve information about a document template. ```php $docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); -$docuseal->updateTemplateDocuments(1000001, [ +$docuseal->getTemplate(1000001); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Get a template", + "operationId": "getTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ] +} +``` + +### Create a template from PDF + +The API endpoint provides the functionality to create a fillable document template for a PDF 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 + + +```php +$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); + +$docuseal->createTemplateFromPdf([ + 'name' => 'Test PDF', 'documents' => [ [ - 'file' => 'string' + 'name' => 'string', + 'file' => 'base64', + 'fields' => [ + [ + 'name' => 'string', + 'areas' => [ + [ + 'x' => 0, + 'y' => 0, + 'w' => 0, + 'h' => 0, + 'page' => 1 + ] + ] + ] + ] ] ] ]); @@ -1435,175 +2843,8 @@ $docuseal->updateTemplateDocuments(1000001, [ "tags": [ "Templates" ], - "summary": "Update template documents", - "operationId": "addDocumentToTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "documents": { - "type": "array", - "description": "The list of documents to add or replace in the template.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "file": { - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." - }, - "html": { - "type": "string", - "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." - }, - "position": { - "type": "integer", - "description": "Position of the document. By default will be added as the last document in the template.", - "example": 0 - }, - "replace": { - "type": "boolean", - "default": false, - "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." - }, - "remove": { - "type": "boolean", - "default": false, - "description": "Set to `true` to remove existing document at given `position` or with given `name`." - } - } - } - }, - "merge": { - "type": "boolean", - "default": false, - "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." - } - } - } - } - } - } -} -``` - -### Clone a template - -The API endpoint allows you to clone existing template into a new template. - -```php -$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); - -$docuseal->cloneTemplate(1000001, [ - 'name' => 'Cloned Template' -]); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Clone a template", - "operationId": "cloneTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", - "example": "Cloned Template" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be cloned." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app." - } - } - } - } - } - } -} -``` - -### Create a template from HTML - -The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML - -```php -$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); - -$docuseal->createTemplateFromHtml([ - 'html' => '

Lorem Ipsum is simply dummy text of the - - -and typesetting industry

-', - 'name' => 'Test Template' -]); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Create a template from HTML", - "operationId": "createTemplateFromHtml", + "summary": "Create a template from PDF", + "operationId": "createTemplateFromPdf", "parameters": [], "requestBody": { "required": true, @@ -1612,55 +2853,23 @@ and typesetting industry

"schema": { "type": "object", "required": [ - "html" + "documents" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML template of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML template of the footer to be displayed on every page." - }, "name": { "type": "string", - "description": "Template name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", - "example": "714d974e-83d8-11ee-b962-0242ac120002" + "description": "Name of the template", + "example": "Test PDF" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", + "example": "unique-key" + }, "shared_link": { "type": "boolean", "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", @@ -1668,25 +2877,287 @@ and typesetting industry

}, "documents": { "type": "array", - "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "html" + "name", + "file" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, "name": { "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "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": { + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } } } } + }, + "flatten": { + "type": "boolean", + "description": "Remove PDF form fields from the documents.", + "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 } } } @@ -1806,7 +3277,8 @@ $docuseal->createTemplateFromDocx([ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -1944,6 +3416,15 @@ $docuseal->createTemplateFromDocx([ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1997,6 +3478,13 @@ $docuseal->createTemplateFromDocx([ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -2014,36 +3502,24 @@ $docuseal->createTemplateFromDocx([ } ``` -### Create a template from existing PDF - -The API endpoint provides the functionality to create a fillable document template for existing PDF 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 +### Create a template from HTML +The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML ```php $docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); -$docuseal->createTemplateFromPdf([ - 'name' => 'Test PDF', - 'documents' => [ - [ - 'name' => 'string', - 'file' => 'base64', - 'fields' => [ - [ - 'name' => 'string', - 'areas' => [ - [ - 'x' => 0, - 'y' => 0, - 'w' => 0, - 'h' => 0, - 'page' => 1 - ] - ] - ] - ] - ] - ] +$docuseal->createTemplateFromHtml([ + 'html' => '

Lorem Ipsum is simply dummy text of the + + +and typesetting industry

+', + 'name' => 'Test Template' ]); ``` @@ -2057,8 +3533,8 @@ $docuseal->createTemplateFromPdf([ "tags": [ "Templates" ], - "summary": "Create a template from existing PDF", - "operationId": "createTemplateFromPdf", + "summary": "Create a template from HTML", + "operationId": "createTemplateFromHtml", "parameters": [], "requestBody": { "required": true, @@ -2067,246 +3543,78 @@ $docuseal->createTemplateFromPdf([ "schema": { "type": "object", "required": [ - "documents" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML template of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML template of the footer to be displayed on every page." + }, "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "Template name. Random uuid will be assigned when not specified.", + "example": "Test Template" + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", + "example": "714d974e-83d8-11ee-b962-0242ac120002" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" + "shared_link": { + "type": "boolean", + "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", + "default": true }, "documents": { "type": "array", + "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "name", - "file" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, "name": { "type": "string", - "description": "Name of the document." - }, - "file": { - "example": "base64", - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - }, - "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 - } - } - } - } - } - }, - "flatten": { - "type": "boolean", - "description": "Remove PDF form fields from the document.", - "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 + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" } } } @@ -2319,6 +3627,70 @@ $docuseal->createTemplateFromPdf([ } ``` +### Clone a template + +The API endpoint allows you to clone existing template into a new template. + +```php +$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); + +$docuseal->cloneTemplate(1000001, [ + 'name' => 'Cloned Template' +]); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Clone a template", + "operationId": "cloneTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", + "example": "Cloned Template" + }, + "folder_name": { + "type": "string", + "description": "The folder's name to which the template should be cloned." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app." + } + } + } + } + } + } +} +``` + ### Merge templates The API endpoint allows you to merge multiple templates with documents and fields into a new combined template. @@ -2406,42 +3778,16 @@ $docuseal->mergeTemplates([ } ``` -### Create a submission from PDF - -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 +### Update a template +The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. ```php $docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); -$docuseal->createSubmissionFromPdf([ - 'name' => 'Test Submission Document', - 'documents' => [ - [ - 'name' => 'string', - 'file' => 'base64', - 'fields' => [ - [ - 'name' => 'string', - 'areas' => [ - [ - 'x' => 0, - 'y' => 0, - 'w' => 0, - 'h' => 0, - 'page' => 1 - ] - ] - ] - ] - ] - ], - 'submitters' => [ - [ - 'role' => 'First Party', - 'email' => 'john.doe@example.com' - ] - ] +$docuseal->updateTemplate(1000001, [ + 'name' => 'New Document Name', + 'folder_name' => 'New Folder' ]); ``` @@ -2453,971 +3799,53 @@ $docuseal->createSubmissionFromPdf([ } ], "tags": [ - "Submissions" + "Templates" ], - "summary": "Create a submission from PDF", - "operationId": "createSubmissionFromPdf", - "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 - }, - "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - } - } - } - }, - "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}}." - } - } - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a submission from HTML - -This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML - -```php -$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); - -$docuseal->createSubmissionFromHtml([ - 'name' => 'Test Submission Document', - 'documents' => [ - [ - 'name' => 'Test Document', - 'html' => '

Lorem Ipsum is simply dummy text of the - - -and typesetting industry

-' - ] - ], - 'submitters' => [ - [ - 'role' => 'First Party', - 'email' => 'john.doe@example.com' - ] - ] -]); -``` - -```json -{ - "security": [ + "summary": "Update a template", + "operationId": "updateTemplate", + "parameters": [ { - "AuthToken": [] + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 } ], - "tags": [ - "Submissions" - ], - "summary": "Create a submission from HTML", - "operationId": "createSubmissionFromHtml", - "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" + "description": "The name of the template", + "example": "New Document Name" }, - "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 - }, - "order": { + "folder_name": { "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" + "description": "The folder's name to which the template should be moved.", + "example": "New Folder" + }, + "roles": { + "type": "array", + "description": "An array of submitter role names to update the template with.", + "items": { + "type": "string" + }, + "example": [ + "Agent", + "Customer" ] }, - "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", - "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", - "items": { - "type": "object", - "required": [ - "html" - ], - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" - }, - "html": { - "type": "string", - "description": "HTML document content with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML document content of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML document content of the footer to be displayed on every page." - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "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": { + "archived": { "type": "boolean", - "description": "Set `true` to merge the documents into a single PDF file.", - "default": false + "description": "Set `false` to unarchive template." } } } @@ -3427,34 +3855,17 @@ and typesetting industry

} ``` -### Create a template from PDF - -The API endpoint provides the functionality to create a fillable document template for a PDF 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 +### Update template documents +The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. ```php $docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.com'); -$docuseal->createTemplateFromPdf([ - 'name' => 'Test PDF', +$docuseal->updateTemplateDocuments(1000001, [ 'documents' => [ [ - 'name' => 'string', - 'file' => 'base64', - 'fields' => [ - [ - 'name' => 'string', - 'areas' => [ - [ - 'x' => 0, - 'y' => 0, - 'w' => 0, - 'h' => 0, - 'page' => 1 - ] - ] - ] - ] + 'file' => 'string' ] ] ]); @@ -3470,304 +3881,69 @@ $docuseal->createTemplateFromPdf([ "tags": [ "Templates" ], - "summary": "Create a template from PDF", - "operationId": "createTemplateFromPdf", - "parameters": [], + "summary": "Update template documents", + "operationId": "addDocumentToTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", - "required": [ - "documents" - ], "properties": { - "name": { - "type": "string", - "description": "Name of the template", - "example": "Test PDF" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be created." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" - }, - "shared_link": { - "type": "boolean", - "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", - "default": true - }, "documents": { "type": "array", + "description": "The list of documents to add or replace in the template.", "items": { "type": "object", - "required": [ - "name", - "file" - ], "properties": { "name": { "type": "string", - "description": "Name of the document." + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Template" }, "file": { - "example": "base64", "type": "string", "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "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": { - "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 - } - } - } - } - } + "html": { + "type": "string", + "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." + }, + "position": { + "type": "integer", + "description": "Position of the document. By default will be added as the last document in the template.", + "example": 0 + }, + "replace": { + "type": "boolean", + "default": false, + "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." + }, + "remove": { + "type": "boolean", + "default": false, + "description": "Set to `true` to remove existing document at given `position` or with given `name`." } } } }, - "flatten": { + "merge": { "type": "boolean", - "description": "Remove PDF form fields from the documents.", - "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 + "default": false, + "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." } } } @@ -3777,31 +3953,14 @@ $docuseal->createTemplateFromPdf([ } ``` -### Create a submission from DOCX +### Archive a template -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 +The API endpoint allows you to archive a document template. ```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' - ] - ] -]); +$docuseal->archiveTemplate(1000001); ``` ```json @@ -3812,412 +3971,22 @@ $docuseal->createSubmissionFromDocx([ } ], "tags": [ - "Submissions" + "Templates" ], - "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 - } - } - } - } + "summary": "Archive a template", + "operationId": "archiveTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 } - } + ] } ``` diff --git a/docs/api/python.md b/docs/api/python.md index 07dc3bbd..28940996 100644 --- a/docs/api/python.md +++ b/docs/api/python.md @@ -1,266 +1,3 @@ -### List all templates - -The API endpoint provides the ability to retrieve a list of available document templates. - -```python -from docuseal import docuseal - -docuseal.key = "API_KEY" -docuseal.url = "https://api.docuseal.com" - -docuseal.list_submissions({ "limit": 10 }) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "List all templates", - "operationId": "getTemplates", - "parameters": [ - { - "name": "q", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates based on the name partial match." - }, - { - "name": "slug", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by unique slug.", - "example": "opaKWh8WWTAcVG" - }, - { - "name": "external_id", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." - }, - { - "name": "folder", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by folder name." - }, - { - "name": "archived", - "in": "query", - "required": false, - "schema": { - "type": "boolean" - }, - "description": "Get only archived templates instead of active ones." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The number of templates to return. Default value is 10. Maximum value is 100." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." - }, - { - "name": "before", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." - } - ] -} -``` - -### Get a template - -The API endpoint provides the functionality to retrieve information about a document template. - -```python -from docuseal import docuseal - -docuseal.key = "API_KEY" -docuseal.url = "https://api.docuseal.com" - -docuseal.get_template(1000001) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Get a template", - "operationId": "getTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Archive a template - -The API endpoint allows you to archive a document template. - -```python -from docuseal import docuseal - -docuseal.key = "API_KEY" -docuseal.url = "https://api.docuseal.com" - -docuseal.archive_template(1000001) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Archive a template", - "operationId": "archiveTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Update a template - -The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. - -```python -from docuseal import docuseal - -docuseal.key = "API_KEY" -docuseal.url = "https://api.docuseal.com" - -docuseal.update_template(1000001, { - "name": "New Document Name", - "folder_name": "New Folder" -}) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Update a template", - "operationId": "updateTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the template", - "example": "New Document Name" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be moved.", - "example": "New Folder" - }, - "roles": { - "type": "array", - "description": "An array of submitter role names to update the template with.", - "items": { - "type": "string" - }, - "example": [ - "Agent", - "Customer" - ] - }, - "archived": { - "type": "boolean", - "description": "Set `false` to unarchive template." - } - } - } - } - } - } -} -``` - ### List all submissions The API endpoint provides the ability to retrieve a list of available submissions. @@ -379,6 +116,86 @@ docuseal.list_submissions({ "limit": 10 }) } ``` +### Get a submission + +The API endpoint provides the functionality to retrieve information about a submission. + +```python +from docuseal import docuseal + +docuseal.key = "API_KEY" +docuseal.url = "https://api.docuseal.com" + +docuseal.get_submission(1001) +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get a submission", + "operationId": "getSubmission", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + +### Get submission documents + +This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. + +```python +from docuseal import docuseal + +docuseal.key = "API_KEY" +docuseal.url = "https://api.docuseal.com" + +docuseal.get_submission_documents(1001) +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get submission documents", + "operationId": "getSubmissionDocuments", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + ### Create a submission This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).
Related Guides
Send documents for signature via API
Pre-fill PDF document form fields with API @@ -552,6 +369,11 @@ docuseal.create_submission({ "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -703,6 +525,15 @@ docuseal.create_submission({ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -756,6 +587,13 @@ docuseal.create_submission({ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -780,9 +618,10 @@ docuseal.create_submission({ } ``` -### Get a submission +### Create a submission from PDF + +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 -The API endpoint provides the functionality to retrieve information about a submission. ```python from docuseal import docuseal @@ -790,7 +629,35 @@ from docuseal import docuseal docuseal.key = "API_KEY" docuseal.url = "https://api.docuseal.com" -docuseal.get_submission(1001) +docuseal.create_submission_from_pdf({ + "name": "Test Submission Document", + "documents": [ + { + "name": "string", + "file": "base64", + "fields": [ + { + "name": "string", + "areas": [ + { + "x": 0, + "y": 0, + "w": 0, + "h": 0, + "page": 1 + } + ] + } + ] + } + ], + "submitters": [ + { + "role": "First Party", + "email": "john.doe@example.com" + } + ] +}) ``` ```json @@ -803,20 +670,1501 @@ docuseal.get_submission(1001) "tags": [ "Submissions" ], - "summary": "Get a submission", - "operationId": "getSubmission", - "parameters": [ + "summary": "Create a submission from PDF", + "operationId": "createSubmissionFromPdf", + "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 + }, + "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 file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "Option B" + ] + } + } + } + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### 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}} field syntax to define fillable fields, as in a PDF.
Related Guides
Use dynamic content variables in DOCX to create personalized documents + +```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": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the submission.", - "example": 1001 + "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. Variable values can be strings, numbers, arrays, objects, or HTML content used to generate styled text, paragraphs, and tables in DOCX.", + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### Create a submission from HTML + +This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML + +```python +from docuseal import docuseal + +docuseal.key = "API_KEY" +docuseal.url = "https://api.docuseal.com" + +docuseal.create_submission_from_html({ + "name": "Test Submission Document", + "documents": [ + { + "name": "Test Document", + "html": """

Lorem Ipsum is simply dummy text of the + + +and typesetting industry

+""" + } + ], + "submitters": [ + { + "role": "First Party", + "email": "john.doe@example.com" + } + ] +}) +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from HTML", + "operationId": "createSubmissionFromHtml", + "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 + }, + "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", + "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", + "items": { + "type": "object", + "required": [ + "html" + ], + "properties": { + "name": { + "type": "string", + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" + }, + "html": { + "type": "string", + "description": "HTML document content with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML document content of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML document content of the footer to be displayed on every page." + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } } ``` @@ -860,9 +2208,9 @@ docuseal.archive_submission(1001) } ``` -### Get submission documents +### List all submitters -This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. +The API endpoint provides the ability to retrieve a list of submitters. ```python from docuseal import docuseal @@ -870,7 +2218,7 @@ from docuseal import docuseal docuseal.key = "API_KEY" docuseal.url = "https://api.docuseal.com" -docuseal.get_submission_documents(1001) +docuseal.list_submissions({ "limit": 10 }) ``` ```json @@ -881,101 +2229,101 @@ docuseal.get_submission_documents(1001) } ], "tags": [ - "Submissions" + "Submitters" ], - "summary": "Get submission documents", - "operationId": "getSubmissionDocuments", + "summary": "List all submitters", + "operationId": "getSubmitters", "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "submission_id", + "in": "query", + "required": false, "schema": { "type": "integer" }, - "description": "The unique identifier of the submission.", - "example": 1001 + "description": "The submission ID allows you to receive only the submitters related to that specific submission." + }, + { + "name": "q", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters on name, email or phone partial match." + }, + { + "name": "slug", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters by unique slug.", + "example": "zAyL9fH36Havvm" + }, + { + "name": "completed_after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-05 9:32:20", + "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." + }, + { + "name": "completed_before", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-06 19:32:20", + "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + }, + { + "name": "external_id", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + }, + { + "name": "before", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." } ] } ``` -### Create submissions from emails - -This API endpoint allows you to create submissions for a document template and send them to the specified email addresses. This is a simplified version of the POST /submissions API to be used with Zapier or other automation tools. - -```python -from docuseal import docuseal - -docuseal.key = "API_KEY" -docuseal.url = "https://api.docuseal.com" - -docuseal.create_submission_from_emails({ - "template_id": 1000001, - "emails": "hi@docuseal.com, example@docuseal.com" -}) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create submissions from emails", - "operationId": "createSubmissionsFromEmails", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "template_id", - "emails" - ], - "properties": { - "template_id": { - "type": "integer", - "description": "The unique identifier of the template.", - "example": 1000001 - }, - "emails": { - "type": "string", - "description": "A comma-separated list of email addresses to send the submission to.", - "example": "{{emails}}" - }, - "send_email": { - "type": "boolean", - "description": "Set `false` to disable signature request emails sending.", - "default": true - }, - "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: {{template.name}}, {{submitter.link}}, {{account.name}}." - } - } - } - } - } - } - } - } -} -``` - ### Get a submitter The API endpoint provides functionality to retrieve information about a submitter, along with the submitter documents and field values. @@ -1265,6 +2613,15 @@ docuseal.update_submitter(500001, { ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1318,6 +2675,13 @@ docuseal.update_submitter(500001, { } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -1332,9 +2696,9 @@ docuseal.update_submitter(500001, { } ``` -### List all submitters +### List all templates -The API endpoint provides the ability to retrieve a list of submitters. +The API endpoint provides the ability to retrieve a list of available document templates. ```python from docuseal import docuseal @@ -1353,20 +2717,11 @@ docuseal.list_submissions({ "limit": 10 }) } ], "tags": [ - "Submitters" + "Templates" ], - "summary": "List all submitters", - "operationId": "getSubmitters", + "summary": "List all templates", + "operationId": "getTemplates", "parameters": [ - { - "name": "submission_id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The submission ID allows you to receive only the submitters related to that specific submission." - }, { "name": "q", "in": "query", @@ -1374,7 +2729,7 @@ docuseal.list_submissions({ "limit": 10 }) "schema": { "type": "string" }, - "description": "Filter submitters on name, email or phone partial match." + "description": "Filter templates based on the name partial match." }, { "name": "slug", @@ -1383,30 +2738,8 @@ docuseal.list_submissions({ "limit": 10 }) "schema": { "type": "string" }, - "description": "Filter submitters by unique slug.", - "example": "zAyL9fH36Havvm" - }, - { - "name": "completed_after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-05 9:32:20", - "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." - }, - { - "name": "completed_before", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-06 19:32:20", - "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + "description": "Filter templates by unique slug.", + "example": "opaKWh8WWTAcVG" }, { "name": "external_id", @@ -1415,7 +2748,25 @@ docuseal.list_submissions({ "limit": 10 }) "schema": { "type": "string" }, - "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." + }, + { + "name": "folder", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter templates by folder name." + }, + { + "name": "archived", + "in": "query", + "required": false, + "schema": { + "type": "boolean" + }, + "description": "Get only archived templates instead of active ones." }, { "name": "limit", @@ -1424,7 +2775,7 @@ docuseal.list_submissions({ "limit": 10 }) "schema": { "type": "integer" }, - "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + "description": "The number of templates to return. Default value is 10. Maximum value is 100." }, { "name": "after", @@ -1433,7 +2784,7 @@ docuseal.list_submissions({ "limit": 10 }) "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." }, { "name": "before", @@ -1442,15 +2793,15 @@ docuseal.list_submissions({ "limit": 10 }) "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." + "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." } ] } ``` -### Update template documents +### Get a template -The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. +The API endpoint provides the functionality to retrieve information about a document template. ```python from docuseal import docuseal @@ -1458,10 +2809,67 @@ from docuseal import docuseal docuseal.key = "API_KEY" docuseal.url = "https://api.docuseal.com" -docuseal.update_template_documents(1000001, { +docuseal.get_template(1000001) +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Get a template", + "operationId": "getTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ] +} +``` + +### Create a template from PDF + +The API endpoint provides the functionality to create a fillable document template for a PDF 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 + + +```python +from docuseal import docuseal + +docuseal.key = "API_KEY" +docuseal.url = "https://api.docuseal.com" + +docuseal.create_template_from_pdf({ + "name": "Test PDF", "documents": [ { - "file": "string" + "name": "string", + "file": "base64", + "fields": [ + { + "name": "string", + "areas": [ + { + "x": 0, + "y": 0, + "w": 0, + "h": 0, + "page": 1 + } + ] + } + ] } ] }) @@ -1477,181 +2885,8 @@ docuseal.update_template_documents(1000001, { "tags": [ "Templates" ], - "summary": "Update template documents", - "operationId": "addDocumentToTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "documents": { - "type": "array", - "description": "The list of documents to add or replace in the template.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "file": { - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." - }, - "html": { - "type": "string", - "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." - }, - "position": { - "type": "integer", - "description": "Position of the document. By default will be added as the last document in the template.", - "example": 0 - }, - "replace": { - "type": "boolean", - "default": false, - "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." - }, - "remove": { - "type": "boolean", - "default": false, - "description": "Set to `true` to remove existing document at given `position` or with given `name`." - } - } - } - }, - "merge": { - "type": "boolean", - "default": false, - "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." - } - } - } - } - } - } -} -``` - -### Clone a template - -The API endpoint allows you to clone existing template into a new template. - -```python -from docuseal import docuseal - -docuseal.key = "API_KEY" -docuseal.url = "https://api.docuseal.com" - -docuseal.clone_template(1000001, { - "name": "Cloned Template" -}) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Clone a template", - "operationId": "cloneTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", - "example": "Cloned Template" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be cloned." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app." - } - } - } - } - } - } -} -``` - -### Create a template from HTML - -The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML - -```python -from docuseal import docuseal - -docuseal.key = "API_KEY" -docuseal.url = "https://api.docuseal.com" - -docuseal.create_template_from_html({ - "html": """

Lorem Ipsum is simply dummy text of the - - -and typesetting industry

-""", - "name": "Test Template" -}) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Create a template from HTML", - "operationId": "createTemplateFromHtml", + "summary": "Create a template from PDF", + "operationId": "createTemplateFromPdf", "parameters": [], "requestBody": { "required": true, @@ -1660,55 +2895,23 @@ and typesetting industry

"schema": { "type": "object", "required": [ - "html" + "documents" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML template of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML template of the footer to be displayed on every page." - }, "name": { "type": "string", - "description": "Template name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", - "example": "714d974e-83d8-11ee-b962-0242ac120002" + "description": "Name of the template", + "example": "Test PDF" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", + "example": "unique-key" + }, "shared_link": { "type": "boolean", "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", @@ -1716,25 +2919,287 @@ and typesetting industry

}, "documents": { "type": "array", - "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "html" + "name", + "file" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, "name": { "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "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": { + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } } } } + }, + "flatten": { + "type": "boolean", + "description": "Remove PDF form fields from the documents.", + "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 } } } @@ -1857,7 +3322,8 @@ docuseal.create_template_from_docx({ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -1995,6 +3461,15 @@ docuseal.create_template_from_docx({ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -2048,6 +3523,13 @@ docuseal.create_template_from_docx({ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -2065,10 +3547,9 @@ docuseal.create_template_from_docx({ } ``` -### Create a template from existing PDF - -The API endpoint provides the functionality to create a fillable document template for existing PDF 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 +### Create a template from HTML +The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML ```python from docuseal import docuseal @@ -2076,28 +3557,17 @@ from docuseal import docuseal docuseal.key = "API_KEY" docuseal.url = "https://api.docuseal.com" -docuseal.create_template_from_pdf({ - "name": "Test PDF", - "documents": [ - { - "name": "string", - "file": "base64", - "fields": [ - { - "name": "string", - "areas": [ - { - "x": 0, - "y": 0, - "w": 0, - "h": 0, - "page": 1 - } - ] - } - ] - } - ] +docuseal.create_template_from_html({ + "html": """

Lorem Ipsum is simply dummy text of the + + +and typesetting industry

+""", + "name": "Test Template" }) ``` @@ -2111,8 +3581,8 @@ docuseal.create_template_from_pdf({ "tags": [ "Templates" ], - "summary": "Create a template from existing PDF", - "operationId": "createTemplateFromPdf", + "summary": "Create a template from HTML", + "operationId": "createTemplateFromHtml", "parameters": [], "requestBody": { "required": true, @@ -2121,246 +3591,78 @@ docuseal.create_template_from_pdf({ "schema": { "type": "object", "required": [ - "documents" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML template of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML template of the footer to be displayed on every page." + }, "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "Template name. Random uuid will be assigned when not specified.", + "example": "Test Template" + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", + "example": "714d974e-83d8-11ee-b962-0242ac120002" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" + "shared_link": { + "type": "boolean", + "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", + "default": true }, "documents": { "type": "array", + "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "name", - "file" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, "name": { "type": "string", - "description": "Name of the document." - }, - "file": { - "example": "base64", - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - }, - "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 - } - } - } - } - } - }, - "flatten": { - "type": "boolean", - "description": "Remove PDF form fields from the document.", - "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 + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" } } } @@ -2373,6 +3675,73 @@ docuseal.create_template_from_pdf({ } ``` +### Clone a template + +The API endpoint allows you to clone existing template into a new template. + +```python +from docuseal import docuseal + +docuseal.key = "API_KEY" +docuseal.url = "https://api.docuseal.com" + +docuseal.clone_template(1000001, { + "name": "Cloned Template" +}) +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Clone a template", + "operationId": "cloneTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", + "example": "Cloned Template" + }, + "folder_name": { + "type": "string", + "description": "The folder's name to which the template should be cloned." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app." + } + } + } + } + } + } +} +``` + ### Merge templates The API endpoint allows you to merge multiple templates with documents and fields into a new combined template. @@ -2463,10 +3832,9 @@ docuseal.merge_templates({ } ``` -### Create a submission from PDF - -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 +### Update a template +The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. ```python from docuseal import docuseal @@ -2474,34 +3842,9 @@ from docuseal import docuseal docuseal.key = "API_KEY" docuseal.url = "https://api.docuseal.com" -docuseal.create_submission_from_pdf({ - "name": "Test Submission Document", - "documents": [ - { - "name": "string", - "file": "base64", - "fields": [ - { - "name": "string", - "areas": [ - { - "x": 0, - "y": 0, - "w": 0, - "h": 0, - "page": 1 - } - ] - } - ] - } - ], - "submitters": [ - { - "role": "First Party", - "email": "john.doe@example.com" - } - ] +docuseal.update_template(1000001, { + "name": "New Document Name", + "folder_name": "New Folder" }) ``` @@ -2513,507 +3856,53 @@ docuseal.create_submission_from_pdf({ } ], "tags": [ - "Submissions" + "Templates" + ], + "summary": "Update a template", + "operationId": "updateTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } ], - "summary": "Create a submission from PDF", - "operationId": "createSubmissionFromPdf", - "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" + "description": "The name of the template", + "example": "New Document Name" }, - "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 - }, - "order": { + "folder_name": { "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" + "description": "The folder's name to which the template should be moved.", + "example": "New Folder" + }, + "roles": { + "type": "array", + "description": "An array of submitter role names to update the template with.", + "items": { + "type": "string" + }, + "example": [ + "Agent", + "Customer" ] }, - "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - } - } - } - }, - "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}}." - } - } - }, - "flatten": { + "archived": { "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 + "description": "Set `false` to unarchive template." } } } @@ -3023,9 +3912,9 @@ docuseal.create_submission_from_pdf({ } ``` -### Create a submission from HTML +### Update template documents -This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML +The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. ```python from docuseal import docuseal @@ -3033,494 +3922,10 @@ from docuseal import docuseal docuseal.key = "API_KEY" docuseal.url = "https://api.docuseal.com" -docuseal.create_submission_from_html({ - "name": "Test Submission Document", +docuseal.update_template_documents(1000001, { "documents": [ { - "name": "Test Document", - "html": """

Lorem Ipsum is simply dummy text of the - - -and typesetting industry

-""" - } - ], - "submitters": [ - { - "role": "First Party", - "email": "john.doe@example.com" - } - ] -}) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create a submission from HTML", - "operationId": "createSubmissionFromHtml", - "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 - }, - "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", - "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", - "items": { - "type": "object", - "required": [ - "html" - ], - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" - }, - "html": { - "type": "string", - "description": "HTML document content with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML document content of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML document content of the footer to be displayed on every page." - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a template from PDF - -The API endpoint provides the functionality to create a fillable document template for a PDF 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 - - -```python -from docuseal import docuseal - -docuseal.key = "API_KEY" -docuseal.url = "https://api.docuseal.com" - -docuseal.create_template_from_pdf({ - "name": "Test PDF", - "documents": [ - { - "name": "string", - "file": "base64", - "fields": [ - { - "name": "string", - "areas": [ - { - "x": 0, - "y": 0, - "w": 0, - "h": 0, - "page": 1 - } - ] - } - ] + "file": "string" } ] }) @@ -3536,304 +3941,69 @@ docuseal.create_template_from_pdf({ "tags": [ "Templates" ], - "summary": "Create a template from PDF", - "operationId": "createTemplateFromPdf", - "parameters": [], + "summary": "Update template documents", + "operationId": "addDocumentToTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", - "required": [ - "documents" - ], "properties": { - "name": { - "type": "string", - "description": "Name of the template", - "example": "Test PDF" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be created." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" - }, - "shared_link": { - "type": "boolean", - "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", - "default": true - }, "documents": { "type": "array", + "description": "The list of documents to add or replace in the template.", "items": { "type": "object", - "required": [ - "name", - "file" - ], "properties": { "name": { "type": "string", - "description": "Name of the document." + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Template" }, "file": { - "example": "base64", "type": "string", "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "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": { - "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 - } - } - } - } - } + "html": { + "type": "string", + "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." + }, + "position": { + "type": "integer", + "description": "Position of the document. By default will be added as the last document in the template.", + "example": 0 + }, + "replace": { + "type": "boolean", + "default": false, + "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." + }, + "remove": { + "type": "boolean", + "default": false, + "description": "Set to `true` to remove existing document at given `position` or with given `name`." } } } }, - "flatten": { + "merge": { "type": "boolean", - "description": "Remove PDF form fields from the documents.", - "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 + "default": false, + "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." } } } @@ -3843,9 +4013,9 @@ docuseal.create_template_from_pdf({ } ``` -### Create a submission from DOCX +### Archive a template -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 +The API endpoint allows you to archive a document template. ```python from docuseal import docuseal @@ -3853,24 +4023,7 @@ 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" - } - ] -}) +docuseal.archive_template(1000001) ``` ```json @@ -3881,412 +4034,22 @@ docuseal.create_submission_from_docx({ } ], "tags": [ - "Submissions" + "Templates" ], - "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 - } - } - } - } + "summary": "Archive a template", + "operationId": "archiveTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 } - } + ] } ``` diff --git a/docs/api/ruby.md b/docs/api/ruby.md index 45be27ae..cb5a84aa 100644 --- a/docs/api/ruby.md +++ b/docs/api/ruby.md @@ -1,266 +1,3 @@ -### List all templates - -The API endpoint provides the ability to retrieve a list of available document templates. - -```ruby -require "docuseal" - -Docuseal.key = ENV["DOCUSEAL_API_KEY"] -Docuseal.url = "https://api.docuseal.com" - -Docuseal.list_templates(limit: 10) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "List all templates", - "operationId": "getTemplates", - "parameters": [ - { - "name": "q", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates based on the name partial match." - }, - { - "name": "slug", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by unique slug.", - "example": "opaKWh8WWTAcVG" - }, - { - "name": "external_id", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." - }, - { - "name": "folder", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by folder name." - }, - { - "name": "archived", - "in": "query", - "required": false, - "schema": { - "type": "boolean" - }, - "description": "Get only archived templates instead of active ones." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The number of templates to return. Default value is 10. Maximum value is 100." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." - }, - { - "name": "before", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." - } - ] -} -``` - -### Get a template - -The API endpoint provides the functionality to retrieve information about a document template. - -```ruby -require "docuseal" - -Docuseal.key = ENV["DOCUSEAL_API_KEY"] -Docuseal.url = "https://api.docuseal.com" - -Docuseal.get_template(1000001) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Get a template", - "operationId": "getTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Archive a template - -The API endpoint allows you to archive a document template. - -```ruby -require "docuseal" - -Docuseal.key = ENV["DOCUSEAL_API_KEY"] -Docuseal.url = "https://api.docuseal.com" - -Docuseal.archive_template(1000001) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Archive a template", - "operationId": "archiveTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Update a template - -The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. - -```ruby -require "docuseal" - -Docuseal.key = ENV["DOCUSEAL_API_KEY"] -Docuseal.url = "https://api.docuseal.com" - -Docuseal.update_template(1000001, { - name: "New Document Name", - folder_name: "New Folder" -}) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Update a template", - "operationId": "updateTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the template", - "example": "New Document Name" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be moved.", - "example": "New Folder" - }, - "roles": { - "type": "array", - "description": "An array of submitter role names to update the template with.", - "items": { - "type": "string" - }, - "example": [ - "Agent", - "Customer" - ] - }, - "archived": { - "type": "boolean", - "description": "Set `false` to unarchive template." - } - } - } - } - } - } -} -``` - ### List all submissions The API endpoint provides the ability to retrieve a list of available submissions. @@ -379,6 +116,86 @@ Docuseal.list_submissions(limit: 10) } ``` +### Get a submission + +The API endpoint provides the functionality to retrieve information about a submission. + +```ruby +require "docuseal" + +Docuseal.key = ENV["DOCUSEAL_API_KEY"] +Docuseal.url = "https://api.docuseal.com" + +Docuseal.get_submission(1001) +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get a submission", + "operationId": "getSubmission", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + +### Get submission documents + +This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. + +```ruby +require "docuseal" + +Docuseal.key = ENV["DOCUSEAL_API_KEY"] +Docuseal.url = "https://api.docuseal.com" + +Docuseal.get_submission_documents(1001) +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get submission documents", + "operationId": "getSubmissionDocuments", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + ### Create a submission This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).
Related Guides
Send documents for signature via API
Pre-fill PDF document form fields with API @@ -552,6 +369,11 @@ Docuseal.create_submission({ "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -703,6 +525,15 @@ Docuseal.create_submission({ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -756,6 +587,13 @@ Docuseal.create_submission({ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -780,9 +618,10 @@ Docuseal.create_submission({ } ``` -### Get a submission +### Create a submission from PDF + +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 -The API endpoint provides the functionality to retrieve information about a submission. ```ruby require "docuseal" @@ -790,7 +629,35 @@ require "docuseal" Docuseal.key = ENV["DOCUSEAL_API_KEY"] Docuseal.url = "https://api.docuseal.com" -Docuseal.get_submission(1001) +Docuseal.create_submission_from_pdf({ + name: "Test Submission Document", + documents: [ + { + name: "string", + file: "base64", + fields: [ + { + name: "string", + areas: [ + { + x: 0, + y: 0, + w: 0, + h: 0, + page: 1 + } + ] + } + ] + } + ], + submitters: [ + { + role: "First Party", + email: "john.doe@example.com" + } + ] +}) ``` ```json @@ -803,20 +670,1501 @@ Docuseal.get_submission(1001) "tags": [ "Submissions" ], - "summary": "Get a submission", - "operationId": "getSubmission", - "parameters": [ + "summary": "Create a submission from PDF", + "operationId": "createSubmissionFromPdf", + "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 + }, + "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 file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "Option B" + ] + } + } + } + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### 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}} field syntax to define fillable fields, as in a PDF.
Related Guides
Use dynamic content variables in DOCX to create personalized documents + +```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": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the submission.", - "example": 1001 + 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. Variable values can be strings, numbers, arrays, objects, or HTML content used to generate styled text, paragraphs, and tables in DOCX.", + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### Create a submission from HTML + +This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML + +```ruby +require "docuseal" + +Docuseal.key = ENV["DOCUSEAL_API_KEY"] +Docuseal.url = "https://api.docuseal.com" + +Docuseal.create_submission_from_html({ + name: "Test Submission Document", + documents: [ + { + name: "Test Document", + html: "

Lorem Ipsum is simply dummy text of the + + +and typesetting industry

+" + } + ], + submitters: [ + { + role: "First Party", + email: "john.doe@example.com" + } + ] +}) +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from HTML", + "operationId": "createSubmissionFromHtml", + "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 + }, + "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", + "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", + "items": { + "type": "object", + "required": [ + "html" + ], + "properties": { + "name": { + "type": "string", + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" + }, + "html": { + "type": "string", + "description": "HTML document content with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML document content of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML document content of the footer to be displayed on every page." + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } } ``` @@ -860,9 +2208,9 @@ Docuseal.archive_submission(1001) } ``` -### Get submission documents +### List all submitters -This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. +The API endpoint provides the ability to retrieve a list of submitters. ```ruby require "docuseal" @@ -870,7 +2218,7 @@ require "docuseal" Docuseal.key = ENV["DOCUSEAL_API_KEY"] Docuseal.url = "https://api.docuseal.com" -Docuseal.get_submission_documents(1001) +Docuseal.list_submitters(limit: 10) ``` ```json @@ -881,101 +2229,101 @@ Docuseal.get_submission_documents(1001) } ], "tags": [ - "Submissions" + "Submitters" ], - "summary": "Get submission documents", - "operationId": "getSubmissionDocuments", + "summary": "List all submitters", + "operationId": "getSubmitters", "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "submission_id", + "in": "query", + "required": false, "schema": { "type": "integer" }, - "description": "The unique identifier of the submission.", - "example": 1001 + "description": "The submission ID allows you to receive only the submitters related to that specific submission." + }, + { + "name": "q", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters on name, email or phone partial match." + }, + { + "name": "slug", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters by unique slug.", + "example": "zAyL9fH36Havvm" + }, + { + "name": "completed_after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-05 9:32:20", + "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." + }, + { + "name": "completed_before", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-06 19:32:20", + "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + }, + { + "name": "external_id", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + }, + { + "name": "before", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." } ] } ``` -### Create submissions from emails - -This API endpoint allows you to create submissions for a document template and send them to the specified email addresses. This is a simplified version of the POST /submissions API to be used with Zapier or other automation tools. - -```ruby -require "docuseal" - -Docuseal.key = ENV["DOCUSEAL_API_KEY"] -Docuseal.url = "https://api.docuseal.com" - -Docuseal.create_submission_from_emails({ - template_id: 1000001, - emails: "hi@docuseal.com, example@docuseal.com" -}) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create submissions from emails", - "operationId": "createSubmissionsFromEmails", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "template_id", - "emails" - ], - "properties": { - "template_id": { - "type": "integer", - "description": "The unique identifier of the template.", - "example": 1000001 - }, - "emails": { - "type": "string", - "description": "A comma-separated list of email addresses to send the submission to.", - "example": "{{emails}}" - }, - "send_email": { - "type": "boolean", - "description": "Set `false` to disable signature request emails sending.", - "default": true - }, - "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: {{template.name}}, {{submitter.link}}, {{account.name}}." - } - } - } - } - } - } - } - } -} -``` - ### Get a submitter The API endpoint provides functionality to retrieve information about a submitter, along with the submitter documents and field values. @@ -1265,6 +2613,15 @@ Docuseal.update_submitter(500001, { ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1318,6 +2675,13 @@ Docuseal.update_submitter(500001, { } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -1332,9 +2696,9 @@ Docuseal.update_submitter(500001, { } ``` -### List all submitters +### List all templates -The API endpoint provides the ability to retrieve a list of submitters. +The API endpoint provides the ability to retrieve a list of available document templates. ```ruby require "docuseal" @@ -1342,7 +2706,7 @@ require "docuseal" Docuseal.key = ENV["DOCUSEAL_API_KEY"] Docuseal.url = "https://api.docuseal.com" -Docuseal.list_submitters(limit: 10) +Docuseal.list_templates(limit: 10) ``` ```json @@ -1353,20 +2717,11 @@ Docuseal.list_submitters(limit: 10) } ], "tags": [ - "Submitters" + "Templates" ], - "summary": "List all submitters", - "operationId": "getSubmitters", + "summary": "List all templates", + "operationId": "getTemplates", "parameters": [ - { - "name": "submission_id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The submission ID allows you to receive only the submitters related to that specific submission." - }, { "name": "q", "in": "query", @@ -1374,7 +2729,7 @@ Docuseal.list_submitters(limit: 10) "schema": { "type": "string" }, - "description": "Filter submitters on name, email or phone partial match." + "description": "Filter templates based on the name partial match." }, { "name": "slug", @@ -1383,30 +2738,8 @@ Docuseal.list_submitters(limit: 10) "schema": { "type": "string" }, - "description": "Filter submitters by unique slug.", - "example": "zAyL9fH36Havvm" - }, - { - "name": "completed_after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-05 9:32:20", - "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." - }, - { - "name": "completed_before", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-06 19:32:20", - "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + "description": "Filter templates by unique slug.", + "example": "opaKWh8WWTAcVG" }, { "name": "external_id", @@ -1415,7 +2748,25 @@ Docuseal.list_submitters(limit: 10) "schema": { "type": "string" }, - "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." + }, + { + "name": "folder", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter templates by folder name." + }, + { + "name": "archived", + "in": "query", + "required": false, + "schema": { + "type": "boolean" + }, + "description": "Get only archived templates instead of active ones." }, { "name": "limit", @@ -1424,7 +2775,7 @@ Docuseal.list_submitters(limit: 10) "schema": { "type": "integer" }, - "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + "description": "The number of templates to return. Default value is 10. Maximum value is 100." }, { "name": "after", @@ -1433,7 +2784,7 @@ Docuseal.list_submitters(limit: 10) "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." }, { "name": "before", @@ -1442,15 +2793,15 @@ Docuseal.list_submitters(limit: 10) "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." + "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." } ] } ``` -### Update template documents +### Get a template -The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. +The API endpoint provides the functionality to retrieve information about a document template. ```ruby require "docuseal" @@ -1458,10 +2809,67 @@ require "docuseal" Docuseal.key = ENV["DOCUSEAL_API_KEY"] Docuseal.url = "https://api.docuseal.com" -Docuseal.update_template_documents(1000001, { +Docuseal.get_template(1000001) +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Get a template", + "operationId": "getTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ] +} +``` + +### Create a template from PDF + +The API endpoint provides the functionality to create a fillable document template for a PDF 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 + + +```ruby +require "docuseal" + +Docuseal.key = ENV["DOCUSEAL_API_KEY"] +Docuseal.url = "https://api.docuseal.com" + +Docuseal.create_template_from_pdf({ + name: "Test PDF", documents: [ { - file: "string" + name: "string", + file: "base64", + fields: [ + { + name: "string", + areas: [ + { + x: 0, + y: 0, + w: 0, + h: 0, + page: 1 + } + ] + } + ] } ] }) @@ -1477,181 +2885,8 @@ Docuseal.update_template_documents(1000001, { "tags": [ "Templates" ], - "summary": "Update template documents", - "operationId": "addDocumentToTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "documents": { - "type": "array", - "description": "The list of documents to add or replace in the template.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "file": { - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." - }, - "html": { - "type": "string", - "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." - }, - "position": { - "type": "integer", - "description": "Position of the document. By default will be added as the last document in the template.", - "example": 0 - }, - "replace": { - "type": "boolean", - "default": false, - "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." - }, - "remove": { - "type": "boolean", - "default": false, - "description": "Set to `true` to remove existing document at given `position` or with given `name`." - } - } - } - }, - "merge": { - "type": "boolean", - "default": false, - "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." - } - } - } - } - } - } -} -``` - -### Clone a template - -The API endpoint allows you to clone existing template into a new template. - -```ruby -require "docuseal" - -Docuseal.key = ENV["DOCUSEAL_API_KEY"] -Docuseal.url = "https://api.docuseal.com" - -Docuseal.clone_template(1000001, { - name: "Cloned Template" -}) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Clone a template", - "operationId": "cloneTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", - "example": "Cloned Template" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be cloned." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app." - } - } - } - } - } - } -} -``` - -### Create a template from HTML - -The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML - -```ruby -require "docuseal" - -Docuseal.key = ENV["DOCUSEAL_API_KEY"] -Docuseal.url = "https://api.docuseal.com" - -Docuseal.create_template_from_html({ - html: "

Lorem Ipsum is simply dummy text of the - - -and typesetting industry

-", - name: "Test Template" -}) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Create a template from HTML", - "operationId": "createTemplateFromHtml", + "summary": "Create a template from PDF", + "operationId": "createTemplateFromPdf", "parameters": [], "requestBody": { "required": true, @@ -1660,55 +2895,23 @@ and typesetting industry

"schema": { "type": "object", "required": [ - "html" + "documents" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML template of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML template of the footer to be displayed on every page." - }, "name": { "type": "string", - "description": "Template name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", - "example": "714d974e-83d8-11ee-b962-0242ac120002" + "description": "Name of the template", + "example": "Test PDF" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", + "example": "unique-key" + }, "shared_link": { "type": "boolean", "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", @@ -1716,25 +2919,287 @@ and typesetting industry

}, "documents": { "type": "array", - "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "html" + "name", + "file" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, "name": { "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "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": { + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } } } } + }, + "flatten": { + "type": "boolean", + "description": "Remove PDF form fields from the documents.", + "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 } } } @@ -1857,7 +3322,8 @@ Docuseal.create_template_from_docx({ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -1995,6 +3461,15 @@ Docuseal.create_template_from_docx({ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -2048,6 +3523,13 @@ Docuseal.create_template_from_docx({ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -2065,10 +3547,9 @@ Docuseal.create_template_from_docx({ } ``` -### Create a template from existing PDF - -The API endpoint provides the functionality to create a fillable document template for existing PDF 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 +### Create a template from HTML +The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML ```ruby require "docuseal" @@ -2076,28 +3557,17 @@ require "docuseal" Docuseal.key = ENV["DOCUSEAL_API_KEY"] Docuseal.url = "https://api.docuseal.com" -Docuseal.create_template_from_pdf({ - name: "Test PDF", - documents: [ - { - name: "string", - file: "base64", - fields: [ - { - name: "string", - areas: [ - { - x: 0, - y: 0, - w: 0, - h: 0, - page: 1 - } - ] - } - ] - } - ] +Docuseal.create_template_from_html({ + html: "

Lorem Ipsum is simply dummy text of the + + +and typesetting industry

+", + name: "Test Template" }) ``` @@ -2111,8 +3581,8 @@ Docuseal.create_template_from_pdf({ "tags": [ "Templates" ], - "summary": "Create a template from existing PDF", - "operationId": "createTemplateFromPdf", + "summary": "Create a template from HTML", + "operationId": "createTemplateFromHtml", "parameters": [], "requestBody": { "required": true, @@ -2121,246 +3591,78 @@ Docuseal.create_template_from_pdf({ "schema": { "type": "object", "required": [ - "documents" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML template of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML template of the footer to be displayed on every page." + }, "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "Template name. Random uuid will be assigned when not specified.", + "example": "Test Template" + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", + "example": "714d974e-83d8-11ee-b962-0242ac120002" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" + "shared_link": { + "type": "boolean", + "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", + "default": true }, "documents": { "type": "array", + "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "name", - "file" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, "name": { "type": "string", - "description": "Name of the document." - }, - "file": { - "example": "base64", - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - }, - "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 - } - } - } - } - } - }, - "flatten": { - "type": "boolean", - "description": "Remove PDF form fields from the document.", - "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 + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" } } } @@ -2373,6 +3675,73 @@ Docuseal.create_template_from_pdf({ } ``` +### Clone a template + +The API endpoint allows you to clone existing template into a new template. + +```ruby +require "docuseal" + +Docuseal.key = ENV["DOCUSEAL_API_KEY"] +Docuseal.url = "https://api.docuseal.com" + +Docuseal.clone_template(1000001, { + name: "Cloned Template" +}) +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Clone a template", + "operationId": "cloneTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", + "example": "Cloned Template" + }, + "folder_name": { + "type": "string", + "description": "The folder's name to which the template should be cloned." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app." + } + } + } + } + } + } +} +``` + ### Merge templates The API endpoint allows you to merge multiple templates with documents and fields into a new combined template. @@ -2463,10 +3832,9 @@ Docuseal.merge_templates({ } ``` -### Create a submission from PDF - -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 +### Update a template +The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. ```ruby require "docuseal" @@ -2474,34 +3842,9 @@ require "docuseal" Docuseal.key = ENV["DOCUSEAL_API_KEY"] Docuseal.url = "https://api.docuseal.com" -Docuseal.create_submission_from_pdf({ - name: "Test Submission Document", - documents: [ - { - name: "string", - file: "base64", - fields: [ - { - name: "string", - areas: [ - { - x: 0, - y: 0, - w: 0, - h: 0, - page: 1 - } - ] - } - ] - } - ], - submitters: [ - { - role: "First Party", - email: "john.doe@example.com" - } - ] +Docuseal.update_template(1000001, { + name: "New Document Name", + folder_name: "New Folder" }) ``` @@ -2513,507 +3856,53 @@ Docuseal.create_submission_from_pdf({ } ], "tags": [ - "Submissions" + "Templates" + ], + "summary": "Update a template", + "operationId": "updateTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } ], - "summary": "Create a submission from PDF", - "operationId": "createSubmissionFromPdf", - "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" + "description": "The name of the template", + "example": "New Document Name" }, - "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 - }, - "order": { + "folder_name": { "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" + "description": "The folder's name to which the template should be moved.", + "example": "New Folder" + }, + "roles": { + "type": "array", + "description": "An array of submitter role names to update the template with.", + "items": { + "type": "string" + }, + "example": [ + "Agent", + "Customer" ] }, - "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - } - } - } - }, - "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}}." - } - } - }, - "flatten": { + "archived": { "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 + "description": "Set `false` to unarchive template." } } } @@ -3023,9 +3912,9 @@ Docuseal.create_submission_from_pdf({ } ``` -### Create a submission from HTML +### Update template documents -This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML +The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. ```ruby require "docuseal" @@ -3033,494 +3922,10 @@ require "docuseal" Docuseal.key = ENV["DOCUSEAL_API_KEY"] Docuseal.url = "https://api.docuseal.com" -Docuseal.create_submission_from_html({ - name: "Test Submission Document", +Docuseal.update_template_documents(1000001, { documents: [ { - name: "Test Document", - html: "

Lorem Ipsum is simply dummy text of the - - -and typesetting industry

-" - } - ], - submitters: [ - { - role: "First Party", - email: "john.doe@example.com" - } - ] -}) -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create a submission from HTML", - "operationId": "createSubmissionFromHtml", - "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 - }, - "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", - "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", - "items": { - "type": "object", - "required": [ - "html" - ], - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" - }, - "html": { - "type": "string", - "description": "HTML document content with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML document content of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML document content of the footer to be displayed on every page." - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a template from PDF - -The API endpoint provides the functionality to create a fillable document template for a PDF 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 - - -```ruby -require "docuseal" - -Docuseal.key = ENV["DOCUSEAL_API_KEY"] -Docuseal.url = "https://api.docuseal.com" - -Docuseal.create_template_from_pdf({ - name: "Test PDF", - documents: [ - { - name: "string", - file: "base64", - fields: [ - { - name: "string", - areas: [ - { - x: 0, - y: 0, - w: 0, - h: 0, - page: 1 - } - ] - } - ] + file: "string" } ] }) @@ -3536,304 +3941,69 @@ Docuseal.create_template_from_pdf({ "tags": [ "Templates" ], - "summary": "Create a template from PDF", - "operationId": "createTemplateFromPdf", - "parameters": [], + "summary": "Update template documents", + "operationId": "addDocumentToTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", - "required": [ - "documents" - ], "properties": { - "name": { - "type": "string", - "description": "Name of the template", - "example": "Test PDF" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be created." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" - }, - "shared_link": { - "type": "boolean", - "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", - "default": true - }, "documents": { "type": "array", + "description": "The list of documents to add or replace in the template.", "items": { "type": "object", - "required": [ - "name", - "file" - ], "properties": { "name": { "type": "string", - "description": "Name of the document." + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Template" }, "file": { - "example": "base64", "type": "string", "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "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": { - "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 - } - } - } - } - } + "html": { + "type": "string", + "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." + }, + "position": { + "type": "integer", + "description": "Position of the document. By default will be added as the last document in the template.", + "example": 0 + }, + "replace": { + "type": "boolean", + "default": false, + "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." + }, + "remove": { + "type": "boolean", + "default": false, + "description": "Set to `true` to remove existing document at given `position` or with given `name`." } } } }, - "flatten": { + "merge": { "type": "boolean", - "description": "Remove PDF form fields from the documents.", - "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 + "default": false, + "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." } } } @@ -3843,9 +4013,9 @@ Docuseal.create_template_from_pdf({ } ``` -### Create a submission from DOCX +### Archive a template -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 +The API endpoint allows you to archive a document template. ```ruby require "docuseal" @@ -3853,24 +4023,7 @@ 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" - } - ] -}) +Docuseal.archive_template(1000001) ``` ```json @@ -3881,412 +4034,22 @@ Docuseal.create_submission_from_docx({ } ], "tags": [ - "Submissions" + "Templates" ], - "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 - } - } - } - } + "summary": "Archive a template", + "operationId": "archiveTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 } - } + ] } ``` diff --git a/docs/api/shell.md b/docs/api/shell.md index f5132490..1e0b6cf1 100644 --- a/docs/api/shell.md +++ b/docs/api/shell.md @@ -1,253 +1,3 @@ -### List all templates - -The API endpoint provides the ability to retrieve a list of available document templates. - -```shell -curl --request GET \ - --url https://api.docuseal.com/templates \ - --header 'X-Auth-Token: API_KEY' -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "List all templates", - "operationId": "getTemplates", - "parameters": [ - { - "name": "q", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates based on the name partial match." - }, - { - "name": "slug", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by unique slug.", - "example": "opaKWh8WWTAcVG" - }, - { - "name": "external_id", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." - }, - { - "name": "folder", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by folder name." - }, - { - "name": "archived", - "in": "query", - "required": false, - "schema": { - "type": "boolean" - }, - "description": "Get only archived templates instead of active ones." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The number of templates to return. Default value is 10. Maximum value is 100." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." - }, - { - "name": "before", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." - } - ] -} -``` - -### Get a template - -The API endpoint provides the functionality to retrieve information about a document template. - -```shell -curl --request GET \ - --url https://api.docuseal.com/templates/1000001 \ - --header 'X-Auth-Token: API_KEY' -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Get a template", - "operationId": "getTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Archive a template - -The API endpoint allows you to archive a document template. - -```shell -curl --request DELETE \ - --url https://api.docuseal.com/templates/1000001 \ - --header 'X-Auth-Token: API_KEY' -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Archive a template", - "operationId": "archiveTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Update a template - -The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. - -```shell -curl --request PUT \ - --url https://api.docuseal.com/templates/1000001 \ - --header 'X-Auth-Token: API_KEY' \ - --header 'content-type: application/json' \ - --data '{"name":"New Document Name","folder_name":"New Folder"}' -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Update a template", - "operationId": "updateTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the template", - "example": "New Document Name" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be moved.", - "example": "New Folder" - }, - "roles": { - "type": "array", - "description": "An array of submitter role names to update the template with.", - "items": { - "type": "string" - }, - "example": [ - "Agent", - "Customer" - ] - }, - "archived": { - "type": "boolean", - "description": "Set `false` to unarchive template." - } - } - } - } - } - } -} -``` - ### List all submissions The API endpoint provides the ability to retrieve a list of available submissions. @@ -363,6 +113,80 @@ curl --request GET \ } ``` +### Get a submission + +The API endpoint provides the functionality to retrieve information about a submission. + +```shell +curl --request GET \ + --url https://api.docuseal.com/submissions/1001 \ + --header 'X-Auth-Token: API_KEY' +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get a submission", + "operationId": "getSubmission", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + +### Get submission documents + +This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. + +```shell +curl --request GET \ + --url https://api.docuseal.com/submissions/1001/documents \ + --header 'X-Auth-Token: API_KEY' +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get submission documents", + "operationId": "getSubmissionDocuments", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + ### Create a submission This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).
Related Guides
Send documents for signature via API
Pre-fill PDF document form fields with API @@ -526,6 +350,11 @@ curl --request POST \ "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -677,6 +506,15 @@ curl --request POST \ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -730,6 +568,13 @@ curl --request POST \ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -754,14 +599,17 @@ curl --request POST \ } ``` -### Get a submission +### Create a submission from PDF + +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 -The API endpoint provides the functionality to retrieve information about a submission. ```shell -curl --request GET \ - --url https://api.docuseal.com/submissions/1001 \ - --header 'X-Auth-Token: API_KEY' +curl --request POST \ + --url https://api.docuseal.com/submissions/pdf \ + --header 'X-Auth-Token: API_KEY' \ + --header 'content-type: application/json' \ + --data '{"name":"Test Submission Document","documents":[{"name":"string","file":"base64","fields":[{"name":"string","areas":[{"x":0,"y":0,"w":0,"h":0,"page":1}]}]}],"submitters":[{"role":"First Party","email":"john.doe@example.com"}]}' ``` ```json @@ -774,20 +622,1460 @@ curl --request GET \ "tags": [ "Submissions" ], - "summary": "Get a submission", - "operationId": "getSubmission", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the submission.", - "example": 1001 + "summary": "Create a submission from PDF", + "operationId": "createSubmissionFromPdf", + "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 + }, + "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 file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "Option B" + ] + } + } + } + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } } - ] + } +} +``` + +### 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}} field syntax to define fillable fields, as in a PDF.
Related Guides
Use dynamic content variables in DOCX to create personalized documents + +```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. Variable values can be strings, numbers, arrays, objects, or HTML content used to generate styled text, paragraphs, and tables in DOCX.", + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### Create a submission from HTML + +This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML + +```shell +curl --request POST \ + --url https://api.docuseal.com/submissions/html \ + --header 'X-Auth-Token: API_KEY' \ + --header 'content-type: application/json' \ + --data '{"name":"Test Submission Document","documents":[{"name":"Test Document","html":"

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n"}],"submitters":[{"role":"First Party","email":"john.doe@example.com"}]}' +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from HTML", + "operationId": "createSubmissionFromHtml", + "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 + }, + "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", + "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", + "items": { + "type": "object", + "required": [ + "html" + ], + "properties": { + "name": { + "type": "string", + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" + }, + "html": { + "type": "string", + "description": "HTML document content with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML document content of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML document content of the footer to be displayed on every page." + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } } ``` @@ -828,13 +2116,13 @@ curl --request DELETE \ } ``` -### Get submission documents +### List all submitters -This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. +The API endpoint provides the ability to retrieve a list of submitters. ```shell curl --request GET \ - --url https://api.docuseal.com/submissions/1001/documents \ + --url https://api.docuseal.com/submitters \ --header 'X-Auth-Token: API_KEY' ``` @@ -846,97 +2134,101 @@ curl --request GET \ } ], "tags": [ - "Submissions" + "Submitters" ], - "summary": "Get submission documents", - "operationId": "getSubmissionDocuments", + "summary": "List all submitters", + "operationId": "getSubmitters", "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "submission_id", + "in": "query", + "required": false, "schema": { "type": "integer" }, - "description": "The unique identifier of the submission.", - "example": 1001 + "description": "The submission ID allows you to receive only the submitters related to that specific submission." + }, + { + "name": "q", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters on name, email or phone partial match." + }, + { + "name": "slug", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters by unique slug.", + "example": "zAyL9fH36Havvm" + }, + { + "name": "completed_after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-05 9:32:20", + "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." + }, + { + "name": "completed_before", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-06 19:32:20", + "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + }, + { + "name": "external_id", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + }, + { + "name": "before", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." } ] } ``` -### Create submissions from emails - -This API endpoint allows you to create submissions for a document template and send them to the specified email addresses. This is a simplified version of the POST /submissions API to be used with Zapier or other automation tools. - -```shell -curl --request POST \ - --url https://api.docuseal.com/submissions/emails \ - --header 'X-Auth-Token: API_KEY' \ - --header 'content-type: application/json' \ - --data '{"template_id":1000001,"emails":"hi@docuseal.com, example@docuseal.com"}' -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create submissions from emails", - "operationId": "createSubmissionsFromEmails", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "template_id", - "emails" - ], - "properties": { - "template_id": { - "type": "integer", - "description": "The unique identifier of the template.", - "example": 1000001 - }, - "emails": { - "type": "string", - "description": "A comma-separated list of email addresses to send the submission to.", - "example": "{{emails}}" - }, - "send_email": { - "type": "boolean", - "description": "Set `false` to disable signature request emails sending.", - "default": true - }, - "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: {{template.name}}, {{submitter.link}}, {{account.name}}." - } - } - } - } - } - } - } - } -} -``` - ### Get a submitter The API endpoint provides functionality to retrieve information about a submitter, along with the submitter documents and field values. @@ -1214,6 +2506,15 @@ curl --request PUT \ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1267,6 +2568,13 @@ curl --request PUT \ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -1281,13 +2589,13 @@ curl --request PUT \ } ``` -### List all submitters +### List all templates -The API endpoint provides the ability to retrieve a list of submitters. +The API endpoint provides the ability to retrieve a list of available document templates. ```shell curl --request GET \ - --url https://api.docuseal.com/submitters \ + --url https://api.docuseal.com/templates \ --header 'X-Auth-Token: API_KEY' ``` @@ -1299,20 +2607,11 @@ curl --request GET \ } ], "tags": [ - "Submitters" + "Templates" ], - "summary": "List all submitters", - "operationId": "getSubmitters", + "summary": "List all templates", + "operationId": "getTemplates", "parameters": [ - { - "name": "submission_id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The submission ID allows you to receive only the submitters related to that specific submission." - }, { "name": "q", "in": "query", @@ -1320,7 +2619,7 @@ curl --request GET \ "schema": { "type": "string" }, - "description": "Filter submitters on name, email or phone partial match." + "description": "Filter templates based on the name partial match." }, { "name": "slug", @@ -1329,30 +2628,8 @@ curl --request GET \ "schema": { "type": "string" }, - "description": "Filter submitters by unique slug.", - "example": "zAyL9fH36Havvm" - }, - { - "name": "completed_after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-05 9:32:20", - "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." - }, - { - "name": "completed_before", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-06 19:32:20", - "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + "description": "Filter templates by unique slug.", + "example": "opaKWh8WWTAcVG" }, { "name": "external_id", @@ -1361,7 +2638,25 @@ curl --request GET \ "schema": { "type": "string" }, - "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." + }, + { + "name": "folder", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter templates by folder name." + }, + { + "name": "archived", + "in": "query", + "required": false, + "schema": { + "type": "boolean" + }, + "description": "Get only archived templates instead of active ones." }, { "name": "limit", @@ -1370,7 +2665,7 @@ curl --request GET \ "schema": { "type": "integer" }, - "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + "description": "The number of templates to return. Default value is 10. Maximum value is 100." }, { "name": "after", @@ -1379,7 +2674,7 @@ curl --request GET \ "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." }, { "name": "before", @@ -1388,22 +2683,20 @@ curl --request GET \ "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." + "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." } ] } ``` -### Update template documents +### Get a template -The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. +The API endpoint provides the functionality to retrieve information about a document template. ```shell -curl --request PUT \ - --url https://api.docuseal.com/templates/1000001/documents \ - --header 'X-Auth-Token: API_KEY' \ - --header 'content-type: application/json' \ - --data '{"documents":[{"file":"string"}]}' +curl --request GET \ + --url https://api.docuseal.com/templates/1000001 \ + --header 'X-Auth-Token: API_KEY' ``` ```json @@ -1416,8 +2709,8 @@ curl --request PUT \ "tags": [ "Templates" ], - "summary": "Update template documents", - "operationId": "addDocumentToTemplate", + "summary": "Get a template", + "operationId": "getTemplate", "parameters": [ { "name": "id", @@ -1426,78 +2719,24 @@ curl --request PUT \ "schema": { "type": "integer" }, - "description": "The unique identifier of the documents template.", + "description": "The unique identifier of the document template.", "example": 1000001 } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "documents": { - "type": "array", - "description": "The list of documents to add or replace in the template.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "file": { - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." - }, - "html": { - "type": "string", - "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." - }, - "position": { - "type": "integer", - "description": "Position of the document. By default will be added as the last document in the template.", - "example": 0 - }, - "replace": { - "type": "boolean", - "default": false, - "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." - }, - "remove": { - "type": "boolean", - "default": false, - "description": "Set to `true` to remove existing document at given `position` or with given `name`." - } - } - } - }, - "merge": { - "type": "boolean", - "default": false, - "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." - } - } - } - } - } - } + ] } ``` -### Clone a template +### Create a template from PDF + +The API endpoint provides the functionality to create a fillable document template for a PDF 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 allows you to clone existing template into a new template. ```shell curl --request POST \ - --url https://api.docuseal.com/templates/1000001/clone \ + --url https://api.docuseal.com/templates/pdf \ --header 'X-Auth-Token: API_KEY' \ --header 'content-type: application/json' \ - --data '{"name":"Cloned Template"}' + --data '{"name":"Test PDF","documents":[{"name":"string","file":"base64","fields":[{"name":"string","areas":[{"x":0,"y":0,"w":0,"h":0,"page":1}]}]}]}' ``` ```json @@ -1510,72 +2749,8 @@ curl --request POST \ "tags": [ "Templates" ], - "summary": "Clone a template", - "operationId": "cloneTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", - "example": "Cloned Template" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be cloned." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app." - } - } - } - } - } - } -} -``` - -### Create a template from HTML - -The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML - -```shell -curl --request POST \ - --url https://api.docuseal.com/templates/html \ - --header 'X-Auth-Token: API_KEY' \ - --header 'content-type: application/json' \ - --data '{"html":"

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n","name":"Test Template"}' -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Create a template from HTML", - "operationId": "createTemplateFromHtml", + "summary": "Create a template from PDF", + "operationId": "createTemplateFromPdf", "parameters": [], "requestBody": { "required": true, @@ -1584,55 +2759,23 @@ curl --request POST \ "schema": { "type": "object", "required": [ - "html" + "documents" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML template of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML template of the footer to be displayed on every page." - }, "name": { "type": "string", - "description": "Template name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", - "example": "714d974e-83d8-11ee-b962-0242ac120002" + "description": "Name of the template", + "example": "Test PDF" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", + "example": "unique-key" + }, "shared_link": { "type": "boolean", "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", @@ -1640,25 +2783,287 @@ curl --request POST \ }, "documents": { "type": "array", - "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "html" + "name", + "file" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, "name": { "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "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": { + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } } } } + }, + "flatten": { + "type": "boolean", + "description": "Remove PDF form fields from the documents.", + "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 } } } @@ -1772,7 +3177,8 @@ curl --request POST \ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -1910,6 +3316,15 @@ curl --request POST \ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1963,6 +3378,13 @@ curl --request POST \ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -1980,17 +3402,16 @@ curl --request POST \ } ``` -### Create a template from existing PDF - -The API endpoint provides the functionality to create a fillable document template for existing PDF 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 +### Create a template from HTML +The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML ```shell curl --request POST \ - --url https://api.docuseal.com/templates/pdf \ + --url https://api.docuseal.com/templates/html \ --header 'X-Auth-Token: API_KEY' \ --header 'content-type: application/json' \ - --data '{"name":"Test PDF","documents":[{"name":"string","file":"base64","fields":[{"name":"string","areas":[{"x":0,"y":0,"w":0,"h":0,"page":1}]}]}]}' + --data '{"html":"

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n","name":"Test Template"}' ``` ```json @@ -2003,8 +3424,8 @@ curl --request POST \ "tags": [ "Templates" ], - "summary": "Create a template from existing PDF", - "operationId": "createTemplateFromPdf", + "summary": "Create a template from HTML", + "operationId": "createTemplateFromHtml", "parameters": [], "requestBody": { "required": true, @@ -2013,246 +3434,78 @@ curl --request POST \ "schema": { "type": "object", "required": [ - "documents" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML template of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML template of the footer to be displayed on every page." + }, "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "Template name. Random uuid will be assigned when not specified.", + "example": "Test Template" + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", + "example": "714d974e-83d8-11ee-b962-0242ac120002" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" + "shared_link": { + "type": "boolean", + "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", + "default": true }, "documents": { "type": "array", + "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "name", - "file" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, "name": { "type": "string", - "description": "Name of the document." - }, - "file": { - "example": "base64", - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - }, - "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 - } - } - } - } - } - }, - "flatten": { - "type": "boolean", - "description": "Remove PDF form fields from the document.", - "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 + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" } } } @@ -2265,6 +3518,70 @@ curl --request POST \ } ``` +### Clone a template + +The API endpoint allows you to clone existing template into a new template. + +```shell +curl --request POST \ + --url https://api.docuseal.com/templates/1000001/clone \ + --header 'X-Auth-Token: API_KEY' \ + --header 'content-type: application/json' \ + --data '{"name":"Cloned Template"}' +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Clone a template", + "operationId": "cloneTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", + "example": "Cloned Template" + }, + "folder_name": { + "type": "string", + "description": "The folder's name to which the template should be cloned." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app." + } + } + } + } + } + } +} +``` + ### Merge templates The API endpoint allows you to merge multiple templates with documents and fields into a new combined template. @@ -2348,992 +3665,16 @@ curl --request POST \ } ``` -### Create a submission from PDF - -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 +### Update a template +The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. ```shell -curl --request POST \ - --url https://api.docuseal.com/submissions/pdf \ +curl --request PUT \ + --url https://api.docuseal.com/templates/1000001 \ --header 'X-Auth-Token: API_KEY' \ --header 'content-type: application/json' \ - --data '{"name":"Test Submission Document","documents":[{"name":"string","file":"base64","fields":[{"name":"string","areas":[{"x":0,"y":0,"w":0,"h":0,"page":1}]}]}],"submitters":[{"role":"First Party","email":"john.doe@example.com"}]}' -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create a submission from PDF", - "operationId": "createSubmissionFromPdf", - "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 - }, - "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - } - } - } - }, - "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}}." - } - } - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a submission from HTML - -This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML - -```shell -curl --request POST \ - --url https://api.docuseal.com/submissions/html \ - --header 'X-Auth-Token: API_KEY' \ - --header 'content-type: application/json' \ - --data '{"name":"Test Submission Document","documents":[{"name":"Test Document","html":"

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n"}],"submitters":[{"role":"First Party","email":"john.doe@example.com"}]}' -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create a submission from HTML", - "operationId": "createSubmissionFromHtml", - "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 - }, - "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", - "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", - "items": { - "type": "object", - "required": [ - "html" - ], - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" - }, - "html": { - "type": "string", - "description": "HTML document content with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML document content of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML document content of the footer to be displayed on every page." - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a template from PDF - -The API endpoint provides the functionality to create a fillable document template for a PDF 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 - - -```shell -curl --request POST \ - --url https://api.docuseal.com/templates/pdf \ - --header 'X-Auth-Token: API_KEY' \ - --header 'content-type: application/json' \ - --data '{"name":"Test PDF","documents":[{"name":"string","file":"base64","fields":[{"name":"string","areas":[{"x":0,"y":0,"w":0,"h":0,"page":1}]}]}]}' + --data '{"name":"New Document Name","folder_name":"New Folder"}' ``` ```json @@ -3346,304 +3687,51 @@ curl --request POST \ "tags": [ "Templates" ], - "summary": "Create a template from PDF", - "operationId": "createTemplateFromPdf", - "parameters": [], + "summary": "Update a template", + "operationId": "updateTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", - "required": [ - "documents" - ], "properties": { "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "The name of the template", + "example": "New Document Name" }, "folder_name": { "type": "string", - "description": "The folder's name to which the template should be created." + "description": "The folder's name to which the template should be moved.", + "example": "New Folder" }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" - }, - "shared_link": { - "type": "boolean", - "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", - "default": true - }, - "documents": { + "roles": { "type": "array", + "description": "An array of submitter role names to update the template with.", "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "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": { - "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 - } - } - } - } - } - } - } - } + "type": "string" + }, + "example": [ + "Agent", + "Customer" + ] }, - "flatten": { + "archived": { "type": "boolean", - "description": "Remove PDF form fields from the documents.", - "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 + "description": "Set `false` to unarchive template." } } } @@ -3653,16 +3741,16 @@ curl --request POST \ } ``` -### Create a submission from DOCX +### Update template documents -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 +The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. ```shell -curl --request POST \ - --url https://api.docuseal.com/submissions/docx \ +curl --request PUT \ + --url https://api.docuseal.com/templates/1000001/documents \ --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"}]}' + --data '{"documents":[{"file":"string"}]}' ``` ```json @@ -3673,406 +3761,71 @@ curl --request POST \ } ], "tags": [ - "Submissions" + "Templates" + ], + "summary": "Update template documents", + "operationId": "addDocumentToTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } ], - "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", + "description": "The list of documents to add or replace in the template.", "items": { "type": "object", - "required": [ - "name", - "file" - ], "properties": { "name": { "type": "string", - "description": "Name of the document." + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Template" }, "file": { - "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 or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." + }, + "html": { + "type": "string", + "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or 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." + "description": "Position of the document. By default will be added as the last document in the template.", + "example": 0 + }, + "replace": { + "type": "boolean", + "default": false, + "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." + }, + "remove": { + "type": "boolean", + "default": false, + "description": "Set to `true` to remove existing document at given `position` or with given `name`." } } } }, - "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": { + "merge": { "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 + "default": false, + "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." } } } @@ -4082,3 +3835,40 @@ curl --request POST \ } ``` +### Archive a template + +The API endpoint allows you to archive a document template. + +```shell +curl --request DELETE \ + --url https://api.docuseal.com/templates/1000001 \ + --header 'X-Auth-Token: API_KEY' +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Archive a template", + "operationId": "archiveTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ] +} +``` + diff --git a/docs/api/typescript.md b/docs/api/typescript.md index 65d4b084..997ed02d 100644 --- a/docs/api/typescript.md +++ b/docs/api/typescript.md @@ -1,262 +1,3 @@ -### List all templates - -The API endpoint provides the ability to retrieve a list of available document templates. - -```typescript -import docuseal from "@docuseal/api"; - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const { data, pagination } = await docuseal.listTemplates({ limit: 10 }); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "List all templates", - "operationId": "getTemplates", - "parameters": [ - { - "name": "q", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates based on the name partial match." - }, - { - "name": "slug", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by unique slug.", - "example": "opaKWh8WWTAcVG" - }, - { - "name": "external_id", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." - }, - { - "name": "folder", - "in": "query", - "required": false, - "schema": { - "type": "string" - }, - "description": "Filter templates by folder name." - }, - { - "name": "archived", - "in": "query", - "required": false, - "schema": { - "type": "boolean" - }, - "description": "Get only archived templates instead of active ones." - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The number of templates to return. Default value is 10. Maximum value is 100." - }, - { - "name": "after", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." - }, - { - "name": "before", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." - } - ] -} -``` - -### Get a template - -The API endpoint provides the functionality to retrieve information about a document template. - -```typescript -import docuseal from "@docuseal/api"; - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const template = await docuseal.getTemplate(1000001); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Get a template", - "operationId": "getTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Archive a template - -The API endpoint allows you to archive a document template. - -```typescript -import docuseal from "@docuseal/api"; - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -await docuseal.archiveTemplate(1000001); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Archive a template", - "operationId": "archiveTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ] -} -``` - -### Update a template - -The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. - -```typescript -import docuseal from "@docuseal/api"; - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const template = await docuseal.updateTemplate(1000001, { - name: "New Document Name", - folder_name: "New Folder" -}); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Update a template", - "operationId": "updateTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the document template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "The name of the template", - "example": "New Document Name" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be moved.", - "example": "New Folder" - }, - "roles": { - "type": "array", - "description": "An array of submitter role names to update the template with.", - "items": { - "type": "string" - }, - "example": [ - "Agent", - "Customer" - ] - }, - "archived": { - "type": "boolean", - "description": "Set `false` to unarchive template." - } - } - } - } - } - } -} -``` - ### List all submissions The API endpoint provides the ability to retrieve a list of available submissions. @@ -374,6 +115,84 @@ const { data, pagination } = await docuseal.listSubmissions({ limit: 10 }); } ``` +### Get a submission + +The API endpoint provides the functionality to retrieve information about a submission. + +```typescript +import docuseal from "@docuseal/api"; + +docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); + +const submission = await docuseal.getSubmission(1001); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get a submission", + "operationId": "getSubmission", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + +### Get submission documents + +This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. + +```typescript +import docuseal from "@docuseal/api"; + +docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); + +const submission = await docuseal.getSubmissionDocuments(1001); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Get submission documents", + "operationId": "getSubmissionDocuments", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submission.", + "example": 1001 + } + ] +} +``` + ### Create a submission This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).
Related Guides
Send documents for signature via API
Pre-fill PDF document form fields with API @@ -546,6 +365,11 @@ const submission = await docuseal.createSubmission({ "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -697,6 +521,15 @@ const submission = await docuseal.createSubmission({ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -750,6 +583,13 @@ const submission = await docuseal.createSubmission({ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -774,16 +614,45 @@ const submission = await docuseal.createSubmission({ } ``` -### Get a submission +### Create a submission from PDF + +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 -The API endpoint provides the functionality to retrieve information about a submission. ```typescript import docuseal from "@docuseal/api"; docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const submission = await docuseal.getSubmission(1001); +const submission = await docuseal.createSubmissionFromPdf({ + name: "Test Submission Document", + documents: [ + { + name: "string", + file: "base64", + fields: [ + { + name: "string", + areas: [ + { + x: 0, + y: 0, + w: 0, + h: 0, + page: 1 + } + ] + } + ] + } + ], + submitters: [ + { + role: "First Party", + email: "john.doe@example.com" + } + ] +}); ``` ```json @@ -796,20 +665,1499 @@ const submission = await docuseal.getSubmission(1001); "tags": [ "Submissions" ], - "summary": "Get a submission", - "operationId": "getSubmission", - "parameters": [ + "summary": "Create a submission from PDF", + "operationId": "createSubmissionFromPdf", + "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 + }, + "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 file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "Option B" + ] + } + } + } + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### 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}} field syntax to define fillable fields, as in a PDF.
Related Guides
Use dynamic content variables in DOCX to create personalized documents + +```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": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the submission.", - "example": 1001 + 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. Variable values can be strings, numbers, arrays, objects, or HTML content used to generate styled text, paragraphs, and tables in DOCX.", + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } +} +``` + +### Create a submission from HTML + +This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML + +```typescript +import docuseal from "@docuseal/api"; + +docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); + +const submission = await docuseal.createSubmissionFromHtml({ + name: "Test Submission Document", + documents: [ + { + name: "Test Document", + html: `

Lorem Ipsum is simply dummy text of the + + +and typesetting industry

+` + } + ], + submitters: [ + { + role: "First Party", + email: "john.doe@example.com" + } + ] +}); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Submissions" + ], + "summary": "Create a submission from HTML", + "operationId": "createSubmissionFromHtml", + "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 + }, + "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", + "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", + "items": { + "type": "object", + "required": [ + "html" + ], + "properties": { + "name": { + "type": "string", + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" + }, + "html": { + "type": "string", + "description": "HTML document content with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML document content of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML document content of the footer to be displayed on every page." + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "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 + }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "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 + } + } + } + } + } + } } ``` @@ -852,16 +2200,16 @@ await docuseal.archiveSubmission(1001); } ``` -### Get submission documents +### List all submitters -This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned. +The API endpoint provides the ability to retrieve a list of submitters. ```typescript import docuseal from "@docuseal/api"; docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const submission = await docuseal.getSubmissionDocuments(1001); +const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); ``` ```json @@ -872,100 +2220,101 @@ const submission = await docuseal.getSubmissionDocuments(1001); } ], "tags": [ - "Submissions" + "Submitters" ], - "summary": "Get submission documents", - "operationId": "getSubmissionDocuments", + "summary": "List all submitters", + "operationId": "getSubmitters", "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "submission_id", + "in": "query", + "required": false, "schema": { "type": "integer" }, - "description": "The unique identifier of the submission.", - "example": 1001 + "description": "The submission ID allows you to receive only the submitters related to that specific submission." + }, + { + "name": "q", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters on name, email or phone partial match." + }, + { + "name": "slug", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter submitters by unique slug.", + "example": "zAyL9fH36Havvm" + }, + { + "name": "completed_after", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-05 9:32:20", + "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." + }, + { + "name": "completed_before", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "example": "2024-03-06 19:32:20", + "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + }, + { + "name": "external_id", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + }, + { + "name": "after", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + }, + { + "name": "before", + "in": "query", + "required": false, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." } ] } ``` -### Create submissions from emails - -This API endpoint allows you to create submissions for a document template and send them to the specified email addresses. This is a simplified version of the POST /submissions API to be used with Zapier or other automation tools. - -```typescript -import docuseal from "@docuseal/api"; - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const submission = await docuseal.createSubmissionFromEmails({ - template_id: 1000001, - emails: "hi@docuseal.com, example@docuseal.com" -}); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create submissions from emails", - "operationId": "createSubmissionsFromEmails", - "parameters": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "required": [ - "template_id", - "emails" - ], - "properties": { - "template_id": { - "type": "integer", - "description": "The unique identifier of the template.", - "example": 1000001 - }, - "emails": { - "type": "string", - "description": "A comma-separated list of email addresses to send the submission to.", - "example": "{{emails}}" - }, - "send_email": { - "type": "boolean", - "description": "Set `false` to disable signature request emails sending.", - "default": true - }, - "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: {{template.name}}, {{submitter.link}}, {{account.name}}." - } - } - } - } - } - } - } - } -} -``` - ### Get a submitter The API endpoint provides functionality to retrieve information about a submitter, along with the submitter documents and field values. @@ -1253,6 +2602,15 @@ const submitter = await docuseal.updateSubmitter(500001, { ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1306,6 +2664,13 @@ const submitter = await docuseal.updateSubmitter(500001, { } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -1320,16 +2685,16 @@ const submitter = await docuseal.updateSubmitter(500001, { } ``` -### List all submitters +### List all templates -The API endpoint provides the ability to retrieve a list of submitters. +The API endpoint provides the ability to retrieve a list of available document templates. ```typescript import docuseal from "@docuseal/api"; docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); +const { data, pagination } = await docuseal.listTemplates({ limit: 10 }); ``` ```json @@ -1340,20 +2705,11 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); } ], "tags": [ - "Submitters" + "Templates" ], - "summary": "List all submitters", - "operationId": "getSubmitters", + "summary": "List all templates", + "operationId": "getTemplates", "parameters": [ - { - "name": "submission_id", - "in": "query", - "required": false, - "schema": { - "type": "integer" - }, - "description": "The submission ID allows you to receive only the submitters related to that specific submission." - }, { "name": "q", "in": "query", @@ -1361,7 +2717,7 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); "schema": { "type": "string" }, - "description": "Filter submitters on name, email or phone partial match." + "description": "Filter templates based on the name partial match." }, { "name": "slug", @@ -1370,30 +2726,8 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); "schema": { "type": "string" }, - "description": "Filter submitters by unique slug.", - "example": "zAyL9fH36Havvm" - }, - { - "name": "completed_after", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-05 9:32:20", - "description": "The date and time string value to filter submitters that completed the submission after the specified date and time." - }, - { - "name": "completed_before", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "example": "2024-03-06 19:32:20", - "description": "The date and time string value to filter submitters that completed the submission before the specified date and time." + "description": "Filter templates by unique slug.", + "example": "opaKWh8WWTAcVG" }, { "name": "external_id", @@ -1402,7 +2736,25 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); "schema": { "type": "string" }, - "description": "The unique applications-specific identifier provided for a submitter when initializing a signature request. It allows you to receive only submitters with a specified external id." + "description": "The unique applications-specific identifier provided for the template via API or Embedded template form builder. It allows you to receive only templates with your specified external id." + }, + { + "name": "folder", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Filter templates by folder name." + }, + { + "name": "archived", + "in": "query", + "required": false, + "schema": { + "type": "boolean" + }, + "description": "Get only archived templates instead of active ones." }, { "name": "limit", @@ -1411,7 +2763,7 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); "schema": { "type": "integer" }, - "description": "The number of submitters to return. Default value is 10. Maximum value is 100." + "description": "The number of templates to return. Default value is 10. Maximum value is 100." }, { "name": "after", @@ -1420,7 +2772,7 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to start the list from. It allows you to receive only submitters with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of submitters." + "description": "The unique identifier of the template to start the list from. It allows you to receive only templates with id greater than the specified value. Pass ID value from the `pagination.next` response to load the next batch of templates." }, { "name": "before", @@ -1429,25 +2781,81 @@ const { data, pagination } = await docuseal.listSubmitters({ limit: 10 }); "schema": { "type": "integer" }, - "description": "The unique identifier of the submitter to end the list with. It allows you to receive only submitters with id less than the specified value." + "description": "The unique identifier of the template to end the list with. It allows you to receive only templates with id less than the specified value." } ] } ``` -### Update template documents +### Get a template -The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. +The API endpoint provides the functionality to retrieve information about a document template. ```typescript import docuseal from "@docuseal/api"; docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const template = await docuseal.updateTemplateDocuments(1000001, { +const template = await docuseal.getTemplate(1000001); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Get a template", + "operationId": "getTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } + ] +} +``` + +### Create a template from PDF + +The API endpoint provides the functionality to create a fillable document template for a PDF 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 + + +```typescript +import docuseal from "@docuseal/api"; + +docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); + +const template = await docuseal.createTemplateFromPdf({ + name: "Test PDF", documents: [ { - file: "string" + name: "string", + file: "base64", + fields: [ + { + name: "string", + areas: [ + { + x: 0, + y: 0, + w: 0, + h: 0, + page: 1 + } + ] + } + ] } ] }); @@ -1463,179 +2871,8 @@ const template = await docuseal.updateTemplateDocuments(1000001, { "tags": [ "Templates" ], - "summary": "Update template documents", - "operationId": "addDocumentToTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "documents": { - "type": "array", - "description": "The list of documents to add or replace in the template.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "file": { - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." - }, - "html": { - "type": "string", - "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." - }, - "position": { - "type": "integer", - "description": "Position of the document. By default will be added as the last document in the template.", - "example": 0 - }, - "replace": { - "type": "boolean", - "default": false, - "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." - }, - "remove": { - "type": "boolean", - "default": false, - "description": "Set to `true` to remove existing document at given `position` or with given `name`." - } - } - } - }, - "merge": { - "type": "boolean", - "default": false, - "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." - } - } - } - } - } - } -} -``` - -### Clone a template - -The API endpoint allows you to clone existing template into a new template. - -```typescript -import docuseal from "@docuseal/api"; - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const template = await docuseal.cloneTemplate(1000001, { - name: "Cloned Template" -}); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Clone a template", - "operationId": "cloneTemplate", - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "integer" - }, - "description": "The unique identifier of the documents template.", - "example": 1000001 - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", - "example": "Cloned Template" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be cloned." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app." - } - } - } - } - } - } -} -``` - -### Create a template from HTML - -The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML - -```typescript -import docuseal from "@docuseal/api"; - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const template = await docuseal.createTemplateFromHtml({ - html: `

Lorem Ipsum is simply dummy text of the - - -and typesetting industry

-`, - name: "Test Template" -}); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Templates" - ], - "summary": "Create a template from HTML", - "operationId": "createTemplateFromHtml", + "summary": "Create a template from PDF", + "operationId": "createTemplateFromPdf", "parameters": [], "requestBody": { "required": true, @@ -1644,55 +2881,23 @@ and typesetting industry

"schema": { "type": "object", "required": [ - "html" + "documents" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML template of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML template of the footer to be displayed on every page." - }, "name": { "type": "string", - "description": "Template name. Random uuid will be assigned when not specified.", - "example": "Test Template" - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", - "example": "714d974e-83d8-11ee-b962-0242ac120002" + "description": "Name of the template", + "example": "Test PDF" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", + "example": "unique-key" + }, "shared_link": { "type": "boolean", "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", @@ -1700,25 +2905,287 @@ and typesetting industry

}, "documents": { "type": "array", - "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "html" + "name", + "file" ], "properties": { - "html": { - "type": "string", - "description": "HTML template with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, "name": { "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" + "description": "Name of the document." + }, + "file": { + "example": "base64", + "type": "string", + "format": "base64", + "description": "Base64-encoded content of the PDF file or downloadable file URL." + }, + "fields": { + "type": "array", + "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the field." + }, + "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", + "strikethrough" + ] + }, + "role": { + "type": "string", + "description": "Role name of the signer." + }, + "required": { + "type": "boolean", + "description": "Indicates if the field is 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." + }, + "areas": { + "type": "array", + "items": { + "type": "object", + "required": [ + "x", + "y", + "w", + "h", + "page" + ], + "properties": { + "x": { + "type": "number", + "description": "X-coordinate of the field area." + }, + "y": { + "type": "number", + "description": "Y-coordinate of the field area." + }, + "w": { + "type": "number", + "description": "Width of the field area." + }, + "h": { + "type": "number", + "description": "Height of the field area." + }, + "page": { + "type": "integer", + "description": "Page number of the field area. Starts from 1.", + "example": 1 + }, + "option": { + "type": "string", + "description": "Option string value for 'radio' and 'multiple' select field types." + } + } + } + }, + "options": { + "type": "array", + "description": "An array of option values for 'select' field type.", + "items": { + "type": "string" + }, + "example": [ + "Option A", + "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": { + "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" + }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, + "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 + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } } } } + }, + "flatten": { + "type": "boolean", + "description": "Remove PDF form fields from the documents.", + "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 } } } @@ -1840,7 +3307,8 @@ const template = await docuseal.createTemplateFromDocx({ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -1978,6 +3446,15 @@ const template = await docuseal.createTemplateFromDocx({ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -2031,6 +3508,13 @@ const template = await docuseal.createTemplateFromDocx({ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -2048,38 +3532,26 @@ const template = await docuseal.createTemplateFromDocx({ } ``` -### Create a template from existing PDF - -The API endpoint provides the functionality to create a fillable document template for existing PDF 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 +### Create a template from HTML +The API endpoint provides the functionality to seamlessly generate a PDF document template by utilizing the provided HTML content while incorporating pre-defined fields.
Related Guides
Create PDF document fillable form with HTML ```typescript import docuseal from "@docuseal/api"; docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const template = await docuseal.createTemplateFromPdf({ - name: "Test PDF", - documents: [ - { - name: "string", - file: "base64", - fields: [ - { - name: "string", - areas: [ - { - x: 0, - y: 0, - w: 0, - h: 0, - page: 1 - } - ] - } - ] - } - ] +const template = await docuseal.createTemplateFromHtml({ + html: `

Lorem Ipsum is simply dummy text of the + + +and typesetting industry

+`, + name: "Test Template" }); ``` @@ -2093,8 +3565,8 @@ const template = await docuseal.createTemplateFromPdf({ "tags": [ "Templates" ], - "summary": "Create a template from existing PDF", - "operationId": "createTemplateFromPdf", + "summary": "Create a template from HTML", + "operationId": "createTemplateFromHtml", "parameters": [], "requestBody": { "required": true, @@ -2103,246 +3575,78 @@ const template = await docuseal.createTemplateFromPdf({ "schema": { "type": "object", "required": [ - "documents" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, + "html_header": { + "type": "string", + "description": "HTML template of the header to be displayed on every page." + }, + "html_footer": { + "type": "string", + "description": "HTML template of the footer to be displayed on every page." + }, "name": { "type": "string", - "description": "Name of the template", - "example": "Test PDF" + "description": "Template name. Random uuid will be assigned when not specified.", + "example": "Test Template" + }, + "size": { + "type": "string", + "default": "Letter", + "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", + "enum": [ + "Letter", + "Legal", + "Tabloid", + "Ledger", + "A0", + "A1", + "A2", + "A3", + "A4", + "A5", + "A6" + ], + "example": "A4" + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new HTML.", + "example": "714d974e-83d8-11ee-b962-0242ac120002" }, "folder_name": { "type": "string", "description": "The folder's name to which the template should be created." }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" + "shared_link": { + "type": "boolean", + "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", + "default": true }, "documents": { "type": "array", + "description": "The list of documents built from HTML. Can be used to create a template with multiple documents. Leave `documents` param empty when using a top-level `html` param for a template with a single document.", "items": { "type": "object", "required": [ - "name", - "file" + "html" ], "properties": { + "html": { + "type": "string", + "description": "HTML template with field tags.", + "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" + }, "name": { "type": "string", - "description": "Name of the document." - }, - "file": { - "example": "base64", - "type": "string", - "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - }, - "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 - } - } - } - } - } - }, - "flatten": { - "type": "boolean", - "description": "Remove PDF form fields from the document.", - "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 + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Document" } } } @@ -2355,6 +3659,72 @@ const template = await docuseal.createTemplateFromPdf({ } ``` +### Clone a template + +The API endpoint allows you to clone existing template into a new template. + +```typescript +import docuseal from "@docuseal/api"; + +docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); + +const template = await docuseal.cloneTemplate(1000001, { + name: "Cloned Template" +}); +``` + +```json +{ + "security": [ + { + "AuthToken": [] + } + ], + "tags": [ + "Templates" + ], + "summary": "Clone a template", + "operationId": "cloneTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Template name. Existing name with (Clone) suffix will be used if not specified.", + "example": "Cloned Template" + }, + "folder_name": { + "type": "string", + "description": "The folder's name to which the template should be cloned." + }, + "external_id": { + "type": "string", + "description": "Your application-specific unique string key to identify this template within your app." + } + } + } + } + } + } +} +``` + ### Merge templates The API endpoint allows you to merge multiple templates with documents and fields into a new combined template. @@ -2444,44 +3814,18 @@ 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. 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 +### Update a template +The API endpoint provides the functionality to move a document template to a different folder and update the name of the template. ```typescript import docuseal from "@docuseal/api"; docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const submission = await docuseal.createSubmissionFromPdf({ - name: "Test Submission Document", - documents: [ - { - name: "string", - file: "base64", - fields: [ - { - name: "string", - areas: [ - { - x: 0, - y: 0, - w: 0, - h: 0, - page: 1 - } - ] - } - ] - } - ], - submitters: [ - { - role: "First Party", - email: "john.doe@example.com" - } - ] +const template = await docuseal.updateTemplate(1000001, { + name: "New Document Name", + folder_name: "New Folder" }); ``` @@ -2493,507 +3837,53 @@ const submission = await docuseal.createSubmissionFromPdf({ } ], "tags": [ - "Submissions" + "Templates" + ], + "summary": "Update a template", + "operationId": "updateTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 + } ], - "summary": "Create a submission from PDF", - "operationId": "createSubmissionFromPdf", - "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" + "description": "The name of the template", + "example": "New Document Name" }, - "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 - }, - "order": { + "folder_name": { "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" + "description": "The folder's name to which the template should be moved.", + "example": "New Folder" + }, + "roles": { + "type": "array", + "description": "An array of submitter role names to update the template with.", + "items": { + "type": "string" + }, + "example": [ + "Agent", + "Customer" ] }, - "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 file or downloadable file URL." - }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "Option B" - ] - } - } - } - }, - "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}}." - } - } - }, - "flatten": { + "archived": { "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 + "description": "Set `false` to unarchive template." } } } @@ -3003,502 +3893,19 @@ const submission = await docuseal.createSubmissionFromPdf({ } ``` -### Create a submission from HTML +### Update template documents -This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
Related Guides
Create PDF document fillable form with HTML +The API endpoint allows you to add, remove or replace documents in the template with provided PDF/DOCX file or HTML content. ```typescript import docuseal from "@docuseal/api"; docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); -const submission = await docuseal.createSubmissionFromHtml({ - name: "Test Submission Document", +const template = await docuseal.updateTemplateDocuments(1000001, { documents: [ { - name: "Test Document", - html: `

Lorem Ipsum is simply dummy text of the - - -and typesetting industry

-` - } - ], - submitters: [ - { - role: "First Party", - email: "john.doe@example.com" - } - ] -}); -``` - -```json -{ - "security": [ - { - "AuthToken": [] - } - ], - "tags": [ - "Submissions" - ], - "summary": "Create a submission from HTML", - "operationId": "createSubmissionFromHtml", - "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 - }, - "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", - "description": "The list of documents built from HTML. Can be used to create a submission with multiple documents.", - "items": { - "type": "object", - "required": [ - "html" - ], - "properties": { - "name": { - "type": "string", - "description": "Document name. Random uuid will be assigned when not specified.", - "example": "Test Document" - }, - "html": { - "type": "string", - "description": "HTML document content with field tags.", - "example": "

Lorem Ipsum is simply dummy text of the\n\n\nand typesetting industry

\n" - }, - "html_header": { - "type": "string", - "description": "HTML document content of the header to be displayed on every page." - }, - "html_footer": { - "type": "string", - "description": "HTML document content of the footer to be displayed on every page." - }, - "size": { - "type": "string", - "default": "Letter", - "description": "Page size. Letter 8.5 x 11 will be assigned when not specified.", - "enum": [ - "Letter", - "Legal", - "Tabloid", - "Ledger", - "A0", - "A1", - "A2", - "A3", - "A4", - "A5", - "A6" - ], - "example": "A4" - }, - "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 - } - } - } - } - } - } -} -``` - -### Create a template from PDF - -The API endpoint provides the functionality to create a fillable document template for a PDF 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 - - -```typescript -import docuseal from "@docuseal/api"; - -docuseal.configure({ key: "API_KEY", url: "https://api.docuseal.com" }); - -const template = await docuseal.createTemplateFromPdf({ - name: "Test PDF", - documents: [ - { - name: "string", - file: "base64", - fields: [ - { - name: "string", - areas: [ - { - x: 0, - y: 0, - w: 0, - h: 0, - page: 1 - } - ] - } - ] + file: "string" } ] }); @@ -3514,304 +3921,69 @@ const template = await docuseal.createTemplateFromPdf({ "tags": [ "Templates" ], - "summary": "Create a template from PDF", - "operationId": "createTemplateFromPdf", - "parameters": [], + "summary": "Update template documents", + "operationId": "addDocumentToTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the documents template.", + "example": 1000001 + } + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", - "required": [ - "documents" - ], "properties": { - "name": { - "type": "string", - "description": "Name of the template", - "example": "Test PDF" - }, - "folder_name": { - "type": "string", - "description": "The folder's name to which the template should be created." - }, - "external_id": { - "type": "string", - "description": "Your application-specific unique string key to identify this template within your app. Existing template with specified `external_id` will be updated with a new PDF.", - "example": "unique-key" - }, - "shared_link": { - "type": "boolean", - "description": "set to `true` to make the template available via a shared link. This will allow anyone with the link to create a submission from this template.", - "default": true - }, "documents": { "type": "array", + "description": "The list of documents to add or replace in the template.", "items": { "type": "object", - "required": [ - "name", - "file" - ], "properties": { "name": { "type": "string", - "description": "Name of the document." + "description": "Document name. Random uuid will be assigned when not specified.", + "example": "Test Template" }, "file": { - "example": "base64", "type": "string", "format": "base64", - "description": "Base64-encoded content of the PDF file or downloadable file URL." + "description": "Base64-encoded content of the PDF or DOCX file or downloadable file URL. Leave it empty if you create a new document using HTML param." }, - "fields": { - "type": "array", - "description": "Fields are optional if you use {{...}} text tags to define fields in the document.", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Name of the field." - }, - "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" - ] - }, - "role": { - "type": "string", - "description": "Role name of the signer." - }, - "required": { - "type": "boolean", - "description": "Indicates if the field is 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." - }, - "areas": { - "type": "array", - "items": { - "type": "object", - "required": [ - "x", - "y", - "w", - "h", - "page" - ], - "properties": { - "x": { - "type": "number", - "description": "X-coordinate of the field area." - }, - "y": { - "type": "number", - "description": "Y-coordinate of the field area." - }, - "w": { - "type": "number", - "description": "Width of the field area." - }, - "h": { - "type": "number", - "description": "Height of the field area." - }, - "page": { - "type": "integer", - "description": "Page number of the field area. Starts from 1.", - "example": 1 - }, - "option": { - "type": "string", - "description": "Option string value for 'radio' and 'multiple' select field types." - } - } - } - }, - "options": { - "type": "array", - "description": "An array of option values for 'select' field type.", - "items": { - "type": "string" - }, - "example": [ - "Option A", - "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": { - "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 - } - } - } - } - } + "html": { + "type": "string", + "description": "HTML template with field tags. Leave it empty if you add a document via PDF or DOCX base64 encoded file param or URL." + }, + "position": { + "type": "integer", + "description": "Position of the document. By default will be added as the last document in the template.", + "example": 0 + }, + "replace": { + "type": "boolean", + "default": false, + "description": "Set to `true` to replace existing document with a new file at `position`. Existing document fields will be transferred to the new document if it doesn't contain any fields." + }, + "remove": { + "type": "boolean", + "default": false, + "description": "Set to `true` to remove existing document at given `position` or with given `name`." } } } }, - "flatten": { + "merge": { "type": "boolean", - "description": "Remove PDF form fields from the documents.", - "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 + "default": false, + "description": "Set to `true` to merge all existing and new documents into a single PDF document in the template." } } } @@ -3821,33 +3993,16 @@ const template = await docuseal.createTemplateFromPdf({ } ``` -### Create a submission from DOCX +### Archive a template -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 +The API endpoint allows you to archive a document template. ```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" - } - ] -}); +await docuseal.archiveTemplate(1000001); ``` ```json @@ -3858,412 +4013,22 @@ const submission = await docuseal.createSubmissionFromDocx({ } ], "tags": [ - "Submissions" + "Templates" ], - "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 - } - } - } - } + "summary": "Archive a template", + "operationId": "archiveTemplate", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer" + }, + "description": "The unique identifier of the document template.", + "example": 1000001 } - } + ] } ``` diff --git a/docs/embedding/form-builder-angular.md b/docs/embedding/form-builder-angular.md index b78fafd2..d4cf5a32 100644 --- a/docs/embedding/form-builder-angular.md +++ b/docs/embedding/form-builder-angular.md @@ -151,7 +151,8 @@ const token = jwt.sign({ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "drawFieldType": { @@ -194,7 +195,8 @@ const token = jwt.sign({ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -321,7 +323,8 @@ const token = jwt.sign({ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -444,6 +447,12 @@ const token = jwt.sign({ "default": true, "description": "Set `false` to now show the fields list on the right. Fields list is displayed by default." }, + "withFieldsDetection": { + "type": "boolean", + "required": false, + "default": false, + "description": "Display a button to automatically detect and add fields to the document with AI." + }, "withFieldPlaceholder": { "type": "boolean", "required": false, @@ -483,7 +492,7 @@ const token = jwt.sign({ "type": "string", "required": false, "default": "en", - "description": "UI language, 'en', 'es', 'de', 'fr', 'pt', 'he', 'ar' languages are available." + "description": "UI language, 'en', 'es', 'de', 'fr', 'pt', 'nl', 'he', 'ar' languages are available." }, "i18n": { "type": "object", diff --git a/docs/embedding/form-builder-javascript.md b/docs/embedding/form-builder-javascript.md index 4953b54f..9d863bd5 100644 --- a/docs/embedding/form-builder-javascript.md +++ b/docs/embedding/form-builder-javascript.md @@ -118,7 +118,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -249,7 +250,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -336,7 +338,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "data-draw-field-type": { @@ -408,6 +411,12 @@ "default": true, "description": "Set `false` to now show the fields list on the right. Fields list is displayed by default." }, + "data-with-fields-detection": { + "type": "boolean", + "required": false, + "default": false, + "description": "Display a button to automatically detect and add fields to the document with AI." + }, "data-with-field-placeholder": { "type": "boolean", "required": false, @@ -453,7 +462,7 @@ "type": "string", "required": false, "default": "en", - "description": "UI language, 'en', 'es', 'de', 'fr', 'pt', 'he', 'ar' languages are available." + "description": "UI language, 'en', 'es', 'de', 'fr', 'pt', 'nl', 'he', 'ar' languages are available." }, "data-background-color": { "type": "string", diff --git a/docs/embedding/form-builder-react.md b/docs/embedding/form-builder-react.md index 894f684a..e6dcac26 100644 --- a/docs/embedding/form-builder-react.md +++ b/docs/embedding/form-builder-react.md @@ -142,7 +142,8 @@ const token = jwt.sign({ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "drawFieldType": { @@ -185,7 +186,8 @@ const token = jwt.sign({ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -312,7 +314,8 @@ const token = jwt.sign({ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -435,6 +438,12 @@ const token = jwt.sign({ "default": true, "description": "Set `false` to now show the fields list on the right. Fields list is displayed by default." }, + "withFieldsDetection": { + "type": "boolean", + "required": false, + "default": false, + "description": "Display a button to automatically detect and add fields to the document with AI." + }, "withFieldPlaceholder": { "type": "boolean", "required": false, @@ -474,7 +483,7 @@ const token = jwt.sign({ "type": "string", "required": false, "default": "en", - "description": "UI language, 'en', 'es', 'de', 'fr', 'pt', 'he', 'ar' languages are available." + "description": "UI language, 'en', 'es', 'de', 'fr', 'pt', 'nl', 'he', 'ar' languages are available." }, "i18n": { "type": "object", diff --git a/docs/embedding/form-builder-vue.md b/docs/embedding/form-builder-vue.md index f745be19..ef5475fc 100644 --- a/docs/embedding/form-builder-vue.md +++ b/docs/embedding/form-builder-vue.md @@ -163,7 +163,8 @@ const token = jwt.sign({ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "draw-field-type": { @@ -206,7 +207,8 @@ const token = jwt.sign({ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -333,7 +335,8 @@ const token = jwt.sign({ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -450,6 +453,12 @@ const token = jwt.sign({ "default": true, "description": "Set `false` to now show the fields list on the right. Fields list is displayed by default." }, + "with-fields-detection": { + "type": "boolean", + "required": false, + "default": false, + "description": "Display a button to automatically detect and add fields to the document with AI." + }, "with-field-placeholder": { "type": "boolean", "required": false, @@ -483,7 +492,7 @@ const token = jwt.sign({ "type": "string", "required": false, "default": "en", - "description": "UI language, 'en', 'es', 'de', 'fr', 'pt', 'he', 'ar' languages are available." + "description": "UI language, 'en', 'es', 'de', 'fr', 'pt', 'nl', 'he', 'ar' languages are available." }, "i18n": { "type": "object", diff --git a/docs/embedding/signing-form-angular.md b/docs/embedding/signing-form-angular.md index 8bbad1a0..16e47593 100644 --- a/docs/embedding/signing-form-angular.md +++ b/docs/embedding/signing-form-angular.md @@ -30,7 +30,7 @@ export class AppComponent {} "src": { "type": "string", "required": true, - "description": "Public URL of the document signing form. There are two types of URLs:
  • /d/{slug} - template form signing URL can be copied from the template page in the admin dashboard. Also template \"slug\" key can be obtained via the /templates API.
  • /s/{slug} - individual signer URL. Signer \"slug\" key can be obtained via the /submissions API which is used to initiate signature requests for a template form with recipients.
  • " + "description": "Public URL of the document signing form. There are two types of URLs:
    • /d/{slug} - template form signing URL can be copied from the template page in the admin dashboard. Also template \"slug\" key can be obtained via the /templates API.
    • /s/{slug} - individual signer URL. Signer \"slug\" key can be obtained via the /submissions API which is used to initiate signature requests for a template form with recipients.
    " }, "email": { "type": "string", diff --git a/docs/embedding/signing-form-javascript.md b/docs/embedding/signing-form-javascript.md index 935153b5..b0ccf4b9 100644 --- a/docs/embedding/signing-form-javascript.md +++ b/docs/embedding/signing-form-javascript.md @@ -26,7 +26,7 @@ "data-src": { "type": "string", "required": true, - "description": "Public URL of the document signing form. There are two types of URLs:
  • /d/{slug} - template form signing URL can be copied from the template page in the admin dashboard. Also template \"slug\" key can be obtained via the /templates API.
  • /s/{slug} - individual signer URL. Signer \"slug\" key can be obtained via the /submissions API which is used to initiate signature requests for a template form with recipients.
  • " + "description": "Public URL of the document signing form. There are two types of URLs:
    • /d/{slug} - template form signing URL can be copied from the template page in the admin dashboard. Also template \"slug\" key can be obtained via the /templates API.
    • /s/{slug} - individual signer URL. Signer \"slug\" key can be obtained via the /submissions API which is used to initiate signature requests for a template form with recipients.
    " }, "data-email": { "type": "string", diff --git a/docs/embedding/signing-form-react.md b/docs/embedding/signing-form-react.md index 91039bbf..949adb43 100644 --- a/docs/embedding/signing-form-react.md +++ b/docs/embedding/signing-form-react.md @@ -27,7 +27,7 @@ export function App() { "src": { "type": "string", "required": true, - "description": "Public URL of the document signing form. There are two types of URLs:
  • /d/{slug} - template form signing URL can be copied from the template page in the admin dashboard. Also template \"slug\" key can be obtained via the /templates API.
  • /s/{slug} - individual signer URL. Signer \"slug\" key can be obtained via the /submissions API which is used to initiate signature requests for a template form with recipients.
  • " + "description": "Public URL of the document signing form. There are two types of URLs:
    • /d/{slug} - template form signing URL can be copied from the template page in the admin dashboard. Also template \"slug\" key can be obtained via the /templates API.
    • /s/{slug} - individual signer URL. Signer \"slug\" key can be obtained via the /submissions API which is used to initiate signature requests for a template form with recipients.
    " }, "email": { "type": "string", diff --git a/docs/embedding/signing-form-vue.md b/docs/embedding/signing-form-vue.md index 45e6a336..6014da83 100644 --- a/docs/embedding/signing-form-vue.md +++ b/docs/embedding/signing-form-vue.md @@ -36,7 +36,7 @@ export default { "src": { "type": "string", "required": true, - "description": "Public URL of the document signing form. There are two types of URLs:
  • /d/{slug} - template form signing URL can be copied from the template page in the admin dashboard. Also template \"slug\" key can be obtained via the /templates API.
  • /s/{slug} - individual signer URL. Signer \"slug\" key can be obtained via the /submissions API which is used to initiate signature requests for a template form with recipients.
  • " + "description": "Public URL of the document signing form. There are two types of URLs:
    • /d/{slug} - template form signing URL can be copied from the template page in the admin dashboard. Also template \"slug\" key can be obtained via the /templates API.
    • /s/{slug} - individual signer URL. Signer \"slug\" key can be obtained via the /submissions API which is used to initiate signature requests for a template form with recipients.
    " }, "email": { "type": "string", diff --git a/docs/openapi.json b/docs/openapi.json index 84f95deb..9afd740c 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -251,7 +251,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "required": { @@ -277,6 +278,10 @@ "type": "string", "description": "Font color of the field value." }, + "background": { + "type": "string", + "description": "Field box background color." + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value." @@ -300,6 +305,13 @@ "mask": { "type": "boolean", "description": "Indicates if the field is masked on the document." + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } }, @@ -714,7 +726,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "required": { @@ -740,6 +753,10 @@ "type": "string", "description": "Font color of the field value." }, + "background": { + "type": "string", + "description": "Field box background color." + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value." @@ -763,6 +780,13 @@ "mask": { "type": "boolean", "description": "Indicates if the field is masked on the document." + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } }, @@ -1782,6 +1806,11 @@ "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, "message": { "type": "object", "properties": { @@ -1933,6 +1962,15 @@ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -1986,6 +2024,13 @@ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -2622,6 +2667,10 @@ "event_timestamp": { "type": "string", "description": "Date and time when the event was triggered." + }, + "data": { + "type": "object", + "description": "Additional event details object." } } } @@ -2733,7 +2782,8 @@ "id": 1, "submitter_id": 2, "event_type": "view_form", - "event_timestamp": "2023-12-14T15:47:24.566Z" + "event_timestamp": "2023-12-14T15:47:24.566Z", + "data": {} } ], "documents": [ @@ -3318,7 +3368,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -3471,6 +3522,15 @@ "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -3609,6 +3669,15 @@ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -3662,6 +3731,13 @@ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -3744,7 +3820,6 @@ "type": "object", "required": [ "id", - "submission_id", "uuid", "email", "slug", @@ -3833,6 +3908,53 @@ "awaiting" ] }, + "values": { + "type": "array", + "description": "An array of pre-filled values for the submitter.", + "items": { + "type": "object", + "required": [ + "field", + "value" + ], + "properties": { + "field": { + "type": "string", + "description": "Document template field name." + }, + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Pre-filled value of the field." + } + } + } + }, "role": { "type": "string", "description": "The role of the submitter." @@ -3944,7 +4066,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "required": { @@ -3970,6 +4093,10 @@ "type": "string", "description": "Font color of the field value." }, + "background": { + "type": "string", + "description": "Field box background color." + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value." @@ -3993,6 +4120,13 @@ "mask": { "type": "boolean", "description": "Indicates if the field is masked on the document." + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } }, @@ -4040,27 +4174,6 @@ } } }, - "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.", @@ -4158,7 +4271,7 @@ "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", + "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}} field syntax to define fillable fields, as in a PDF.
    Related Guides
    Use dynamic content variables in DOCX to create personalized documents", "operationId": "createSubmissionFromDocx", "parameters": [], "requestBody": { @@ -4189,7 +4302,7 @@ }, "variables": { "type": "object", - "description": "Dynamic content variables object", + "description": "Dynamic content variables object. Variable values can be strings, numbers, arrays, objects, or HTML content used to generate styled text, paragraphs, and tables in DOCX.", "example": { "variable_name": "value" } @@ -4327,6 +4440,15 @@ "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -4465,6 +4587,15 @@ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -4518,6 +4649,13 @@ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -4595,7 +4733,6 @@ "type": "object", "required": [ "id", - "submission_id", "uuid", "email", "slug", @@ -4684,6 +4821,53 @@ "awaiting" ] }, + "values": { + "type": "array", + "description": "An array of pre-filled values for the submitter.", + "items": { + "type": "object", + "required": [ + "field", + "value" + ], + "properties": { + "field": { + "type": "string", + "description": "Document template field name." + }, + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Pre-filled value of the field." + } + } + } + }, "role": { "type": "string", "description": "The role of the submitter." @@ -4795,7 +4979,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "required": { @@ -4821,6 +5006,10 @@ "type": "string", "description": "Font color of the field value." }, + "background": { + "type": "string", + "description": "Field box background color." + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value." @@ -4844,6 +5033,13 @@ "mask": { "type": "boolean", "description": "Indicates if the field is masked on the document." + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } }, @@ -4891,27 +5087,6 @@ } } }, - "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.", @@ -5198,6 +5373,15 @@ "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 }, + "require_email_2fa": { + "type": "boolean", + "description": "Set to `true` to require email 2FA verification via a one-time code sent to the email address in order to access the documents.", + "default": false + }, + "invite_by": { + "type": "string", + "description": "Set the role name of the previous party that should invite this party via email." + }, "fields": { "type": "array", "description": "A list of configurations for document form fields.", @@ -5336,6 +5520,15 @@ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -5389,6 +5582,13 @@ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -5461,7 +5661,6 @@ "type": "object", "required": [ "id", - "submission_id", "uuid", "email", "slug", @@ -5550,6 +5749,53 @@ "awaiting" ] }, + "values": { + "type": "array", + "description": "An array of pre-filled values for the submitter.", + "items": { + "type": "object", + "required": [ + "field", + "value" + ], + "properties": { + "field": { + "type": "string", + "description": "Document template field name." + }, + "value": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + } + } + ], + "description": "Pre-filled value of the field." + } + } + } + }, "role": { "type": "string", "description": "The role of the submitter." @@ -5661,7 +5907,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "required": { @@ -5687,6 +5934,10 @@ "type": "string", "description": "Font color of the field value." }, + "background": { + "type": "string", + "description": "Field box background color." + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value." @@ -5710,6 +5961,13 @@ "mask": { "type": "boolean", "description": "Indicates if the field is masked on the document." + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } }, @@ -5757,27 +6015,6 @@ } } }, - "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.", @@ -6078,6 +6315,10 @@ "event_timestamp": { "type": "string", "description": "Date and time when the event was triggered." + }, + "data": { + "type": "object", + "description": "Additional event details object." } } } @@ -6185,7 +6426,8 @@ "id": 12, "submitter_id": 7, "event_type": "view_form", - "event_timestamp": "2023-12-14T15:47:17.351Z" + "event_timestamp": "2023-12-14T15:47:17.351Z", + "data": {} } ], "values": [ @@ -6435,6 +6677,15 @@ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -6488,6 +6739,13 @@ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -6990,6 +7248,10 @@ "event_timestamp": { "type": "string", "description": "Date and time when the event was triggered." + }, + "data": { + "type": "object", + "description": "Additional event details object." } } } @@ -7126,7 +7388,8 @@ "id": 12, "submitter_id": 7, "event_type": "view_form", - "event_timestamp": "2023-12-14T15:48:17.351Z" + "event_timestamp": "2023-12-14T15:48:17.351Z", + "data": {} } ], "values": [ @@ -7346,7 +7609,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "required": { @@ -7372,6 +7636,10 @@ "type": "string", "description": "Font color of the field value." }, + "background": { + "type": "string", + "description": "Field box background color." + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value." @@ -7395,6 +7663,13 @@ "mask": { "type": "boolean", "description": "Indicates if the field is masked on the document." + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } }, @@ -7793,7 +8068,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "required": { @@ -7819,6 +8095,10 @@ "type": "string", "description": "Font color of the field value." }, + "background": { + "type": "string", + "description": "Field box background color." + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value." @@ -7842,6 +8122,13 @@ "mask": { "type": "boolean", "description": "Indicates if the field is masked on the document." + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } }, @@ -8294,7 +8581,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "required": { @@ -8320,6 +8608,10 @@ "type": "string", "description": "Font color of the field value." }, + "background": { + "type": "string", + "description": "Field box background color." + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value." @@ -8343,6 +8635,13 @@ "mask": { "type": "boolean", "description": "Indicates if the field is masked on the document." + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } }, @@ -8674,7 +8973,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -8812,6 +9112,15 @@ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -8865,6 +9174,13 @@ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -8989,7 +9305,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "required": { @@ -9015,6 +9332,10 @@ "type": "string", "description": "Font color of the field value." }, + "background": { + "type": "string", + "description": "Field box background color." + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value." @@ -9038,6 +9359,13 @@ "mask": { "type": "boolean", "description": "Indicates if the field is masked on the document." + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } }, @@ -9369,7 +9697,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "role": { @@ -9515,6 +9844,15 @@ ], "default": "black" }, + "background": { + "type": "string", + "description": "Field box background color.", + "enum": [ + "black", + "white", + "blue" + ] + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value.", @@ -9568,6 +9906,13 @@ } ], "default": false + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } } @@ -9702,7 +10047,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "required": { @@ -9728,6 +10074,10 @@ "type": "string", "description": "Font color of the field value." }, + "background": { + "type": "string", + "description": "Field box background color." + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value." @@ -9751,6 +10101,13 @@ "mask": { "type": "boolean", "description": "Indicates if the field is masked on the document." + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } }, @@ -10169,7 +10526,8 @@ "stamp", "payment", "phone", - "verification" + "verification", + "strikethrough" ] }, "required": { @@ -10195,6 +10553,10 @@ "type": "string", "description": "Font color of the field value." }, + "background": { + "type": "string", + "description": "Field box background color." + }, "align": { "type": "string", "description": "Horizontal alignment of the field text value." @@ -10218,6 +10580,13 @@ "mask": { "type": "boolean", "description": "Indicates if the field is masked on the document." + }, + "reasons": { + "description": "An array of signature reasons to choose from.", + "type": "array", + "items": { + "type": "string" + } } } }, diff --git a/docs/webhooks/submission-webhook.md b/docs/webhooks/submission-webhook.md index 15e1bcbd..8bed4a05 100644 --- a/docs/webhooks/submission-webhook.md +++ b/docs/webhooks/submission-webhook.md @@ -281,6 +281,10 @@ Get submission creation, completion, expiration, and archiving notifications usi "event_timestamp": { "type": "string", "description": "Date and time when the event was triggered." + }, + "data": { + "type": "object", + "description": "Additional event details object." } } } From a8b5e008148e9d3466db9f103fc6cad24accdd5e Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Mon, 15 Dec 2025 11:21:07 +0200 Subject: [PATCH 16/16] show field boxes on the submissions page --- app/controllers/submissions_controller.rb | 8 +++++ app/views/icons/_calendar_event.html.erb | 7 +++++ app/views/icons/_checkbox.html.erb | 4 +++ app/views/icons/_checks.html.erb | 4 +++ app/views/icons/_columns_3.html.erb | 3 ++ app/views/icons/_credit_card.html.erb | 6 ++++ app/views/icons/_id.html.erb | 7 +++++ app/views/icons/_letter_case_upper.html.erb | 6 ++++ app/views/icons/_photo.html.erb | 6 ++++ app/views/icons/_rubber_stamp.html.erb | 4 +++ app/views/icons/_select.html.erb | 4 +++ app/views/icons/_square_number_1.html.erb | 4 +++ app/views/icons/_text_size.html.erb | 8 +++++ app/views/submissions/show.html.erb | 34 ++++++++++++++------- 14 files changed, 94 insertions(+), 11 deletions(-) create mode 100644 app/views/icons/_calendar_event.html.erb create mode 100644 app/views/icons/_checkbox.html.erb create mode 100644 app/views/icons/_checks.html.erb create mode 100644 app/views/icons/_columns_3.html.erb create mode 100644 app/views/icons/_credit_card.html.erb create mode 100644 app/views/icons/_id.html.erb create mode 100644 app/views/icons/_letter_case_upper.html.erb create mode 100644 app/views/icons/_photo.html.erb create mode 100644 app/views/icons/_rubber_stamp.html.erb create mode 100644 app/views/icons/_select.html.erb create mode 100644 app/views/icons/_square_number_1.html.erb create mode 100644 app/views/icons/_text_size.html.erb diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index 7dc689e0..acb95259 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -12,6 +12,14 @@ class SubmissionsController < ApplicationController authorize!(:create, Submission) end + FIELD_ICONS = { + 'text' => 'text_size', 'signature' => 'writing_sign', 'date' => 'calendar_event', + 'number' => 'square_number_1', 'image' => 'photo', 'initials' => 'letter_case_upper', + 'file' => 'paperclip', 'select' => 'select', 'checkbox' => 'checkbox', 'radio' => 'circle_dot', + 'stamp' => 'rubber_stamp', 'cells' => 'columns_3', 'multiple' => 'checks', 'phone' => 'phone_check', + 'payment' => 'credit_card', 'verification' => 'id' + }.freeze + def show @submission = Submissions.preload_with_pages(@submission) diff --git a/app/views/icons/_calendar_event.html.erb b/app/views/icons/_calendar_event.html.erb new file mode 100644 index 00000000..30985cd0 --- /dev/null +++ b/app/views/icons/_calendar_event.html.erb @@ -0,0 +1,7 @@ + + + + + + + diff --git a/app/views/icons/_checkbox.html.erb b/app/views/icons/_checkbox.html.erb new file mode 100644 index 00000000..4ba1aabd --- /dev/null +++ b/app/views/icons/_checkbox.html.erb @@ -0,0 +1,4 @@ + + + + diff --git a/app/views/icons/_checks.html.erb b/app/views/icons/_checks.html.erb new file mode 100644 index 00000000..6785cfb8 --- /dev/null +++ b/app/views/icons/_checks.html.erb @@ -0,0 +1,4 @@ + + + + diff --git a/app/views/icons/_columns_3.html.erb b/app/views/icons/_columns_3.html.erb new file mode 100644 index 00000000..145a8e98 --- /dev/null +++ b/app/views/icons/_columns_3.html.erb @@ -0,0 +1,3 @@ + + + diff --git a/app/views/icons/_credit_card.html.erb b/app/views/icons/_credit_card.html.erb new file mode 100644 index 00000000..7715a538 --- /dev/null +++ b/app/views/icons/_credit_card.html.erb @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/views/icons/_id.html.erb b/app/views/icons/_id.html.erb new file mode 100644 index 00000000..fdabfdec --- /dev/null +++ b/app/views/icons/_id.html.erb @@ -0,0 +1,7 @@ + + + + + + + diff --git a/app/views/icons/_letter_case_upper.html.erb b/app/views/icons/_letter_case_upper.html.erb new file mode 100644 index 00000000..ae1e879f --- /dev/null +++ b/app/views/icons/_letter_case_upper.html.erb @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/views/icons/_photo.html.erb b/app/views/icons/_photo.html.erb new file mode 100644 index 00000000..ba5e8805 --- /dev/null +++ b/app/views/icons/_photo.html.erb @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/views/icons/_rubber_stamp.html.erb b/app/views/icons/_rubber_stamp.html.erb new file mode 100644 index 00000000..e55d052e --- /dev/null +++ b/app/views/icons/_rubber_stamp.html.erb @@ -0,0 +1,4 @@ + + + + diff --git a/app/views/icons/_select.html.erb b/app/views/icons/_select.html.erb new file mode 100644 index 00000000..36fce4f4 --- /dev/null +++ b/app/views/icons/_select.html.erb @@ -0,0 +1,4 @@ + + + + diff --git a/app/views/icons/_square_number_1.html.erb b/app/views/icons/_square_number_1.html.erb new file mode 100644 index 00000000..b9dea773 --- /dev/null +++ b/app/views/icons/_square_number_1.html.erb @@ -0,0 +1,4 @@ + + + + diff --git a/app/views/icons/_text_size.html.erb b/app/views/icons/_text_size.html.erb new file mode 100644 index 00000000..22b69e42 --- /dev/null +++ b/app/views/icons/_text_size.html.erb @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/app/views/submissions/show.html.erb b/app/views/submissions/show.html.erb index 5ecd9ad9..80ff697f 100644 --- a/app/views/submissions/show.html.erb +++ b/app/views/submissions/show.html.erb @@ -93,8 +93,10 @@
    <% fields_index = Templates.build_field_areas_index(@submission.template_fields || @submission.template.fields) %> <% submitters_index = @submission.submitters.index_by(&:uuid) %> + <% submitters_order_index = nil %> <% attachments_index = ActiveStorage::Attachment.where(record: @submission.submitters, name: :attachments).preload(:blob).index_by(&:uuid) %> <% page_blob_struct = Struct.new(:url, :metadata, keyword_init: true) %> + <% bg_classes = %w[bg-red-100 bg-sky-100 bg-emerald-100 bg-yellow-100 bg-purple-100 bg-pink-100 bg-cyan-100 bg-orange-100 bg-lime-100 bg-indigo-100] %> <% schema.each do |item| %> <% document = @submission.schema_documents.find { |e| e.uuid == item['attachment_uuid'] } %> <% document_annots_index = document.metadata.dig('pdf', 'annotations')&.group_by { |e| e['page'] } || {} %> @@ -111,19 +113,29 @@ <% fields_index.dig(document.uuid, index)&.each do |(area, field)| %> <% value = values[field['uuid']].presence || (field['default_value'] != '{{date}}' && field['readonly'] == true && field['conditions'].blank? && field['default_value'].present? ? Submitters::SubmitValues.template_default_value_for_submitter(field['default_value'], @submission.submitters.find { |e| e.uuid == field['submitter_uuid'] }, with_time: false) : nil) %> <% value ||= field['default_value'] if field['type'] == 'heading' %> - <% next if value.blank? %> <% submitter = submitters_index[field['submitter_uuid']] %> - <% if (mask = field.dig('preferences', 'mask').presence) && signed_in? && can?(:read, @submission) %> - - - <% else %> - <%= render 'submissions/value', page_width: width, page_height: height, font_scale:, area:, field:, attachments_index:, value: mask.present? ? Array.wrap(value).map { |e| TextUtils.mask_value(e, mask) }.join(', ') : value, locale: @submission.account.locale, timezone: @submission.account.timezone, submitter:, with_signature_id:, with_submitter_timezone:, with_signature_id_reason: %> + <% else %> + <%= render 'submissions/value', page_width: width, page_height: height, font_scale:, area:, field:, attachments_index:, value: mask.present? ? Array.wrap(value).map { |e| TextUtils.mask_value(e, mask) }.join(', ') : value, locale: @submission.account.locale, timezone: @submission.account.timezone, submitter:, with_signature_id:, with_submitter_timezone:, with_signature_id_reason: %> + <% end %> + <% elsif field['readonly'] != true && submitter && !submitter.completed_at? %> + <% submitters_order_index ||= (@submission.template_submitters || @submission.template.submitters).each_with_index.to_h { |s, i| [s['uuid'], i] } %> + <% submitter_index = submitters_order_index[submitter.uuid] %> + <% bg_class = bg_classes[submitter_index % bg_classes.size] %> +
    +
    + <%= svg_icon(SubmissionsController::FIELD_ICONS[field['type']], class: 'max-h-10 w-full h-full stroke-2 opacity-50') %> +
    +
    <% end %> <% end %>