docspring 4.0.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +99 -0
  3. data/.travis.yml +1 -1
  4. data/AGENTS.md +3 -2
  5. data/CHANGELOG.md +64 -0
  6. data/Gemfile.lock +9 -9
  7. data/README.md +14 -1
  8. data/docs/AddTemplateFieldsRequest.md +18 -0
  9. data/docs/Client.md +917 -80
  10. data/docs/CombinedPdf.md +1 -1
  11. data/docs/CreateCombinedPdfRequest.md +1 -1
  12. data/docs/CreateSubmissionBatchRequest.md +2 -0
  13. data/docs/CreateSubmissionRequest.md +4 -2
  14. data/docs/CreateTemplatePreviewRequest.md +18 -0
  15. data/docs/CreateTemplateRequest.md +13 -3
  16. data/docs/ErrorDetail.md +1 -1
  17. data/docs/ErrorInfo.md +4 -4
  18. data/docs/Field.md +198 -0
  19. data/docs/FieldDependency.md +22 -0
  20. data/docs/FieldDependencyInput.md +22 -0
  21. data/docs/FieldGroup.md +32 -0
  22. data/docs/FieldGroupInput.md +30 -0
  23. data/docs/FieldGroupType.md +15 -0
  24. data/docs/FieldInput.md +196 -0
  25. data/docs/FieldType.md +15 -0
  26. data/docs/GenerateFilesFormat.md +15 -0
  27. data/docs/GenerateSubmissionFilesRequest.md +18 -0
  28. data/docs/OutputFormat.md +15 -0
  29. data/docs/PageImage.md +34 -0
  30. data/docs/PageImages.md +24 -0
  31. data/docs/PredefinedField.md +30 -0
  32. data/docs/PredefinedFieldInput.md +30 -0
  33. data/docs/RemoveTemplateFieldsRequest.md +18 -0
  34. data/docs/ReorderTemplateFieldsRequest.md +18 -0
  35. data/docs/Submission.md +16 -14
  36. data/docs/SubmissionFiles.md +3 -1
  37. data/docs/SubmissionInput.md +4 -2
  38. data/docs/SubmissionList.md +1 -1
  39. data/docs/SubmissionSummary.md +54 -0
  40. data/docs/SubmissionValidation.md +24 -0
  41. data/docs/Template.md +18 -10
  42. data/docs/TemplateActor.md +1 -1
  43. data/docs/TemplateDiff.md +30 -0
  44. data/docs/TemplateDiffSummary.md +28 -0
  45. data/docs/TemplateDocument.md +6 -6
  46. data/docs/TemplateDocumentSummary.md +24 -0
  47. data/docs/TemplateFieldChange.md +24 -0
  48. data/docs/TemplateFieldChanges.md +24 -0
  49. data/docs/TemplateFieldDependency.md +1 -1
  50. data/docs/TemplateFieldDependencyInput.md +1 -1
  51. data/docs/TemplateFieldMove.md +22 -0
  52. data/docs/TemplateFields.md +22 -0
  53. data/docs/TemplatePageImages.md +24 -0
  54. data/docs/TemplatePreview.md +32 -0
  55. data/docs/TemplatePreviewState.md +15 -0
  56. data/docs/TemplateSummary.md +2 -48
  57. data/docs/UpdateTemplateDocumentRequest.md +6 -2
  58. data/docs/UpdateTemplateFieldsRequest.md +18 -0
  59. data/docs/UpdateTemplateRequest.md +10 -2
  60. data/docs/ValidateSubmissionRequest.md +38 -0
  61. data/lib/docspring/api/client.rb +869 -51
  62. data/lib/docspring/api_client.rb +4 -2
  63. data/lib/docspring/date_time_values.rb +33 -0
  64. data/lib/docspring/models/add_template_fields_request.rb +187 -0
  65. data/lib/docspring/models/combined_pdf.rb +1 -1
  66. data/lib/docspring/models/create_combined_pdf_request.rb +1 -1
  67. data/lib/docspring/models/create_submission_batch_request.rb +23 -1
  68. data/lib/docspring/models/create_submission_request.rb +25 -3
  69. data/lib/docspring/models/create_template_preview_request.rb +187 -0
  70. data/lib/docspring/models/create_template_request.rb +59 -4
  71. data/lib/docspring/models/error_code.rb +3 -1
  72. data/lib/docspring/models/error_detail.rb +1 -1
  73. data/lib/docspring/models/error_info.rb +4 -4
  74. data/lib/docspring/models/field.rb +2217 -0
  75. data/lib/docspring/models/field_dependency.rb +246 -0
  76. data/lib/docspring/models/field_dependency_input.rb +246 -0
  77. data/lib/docspring/models/field_group.rb +368 -0
  78. data/lib/docspring/models/field_group_input.rb +247 -0
  79. data/lib/docspring/models/field_group_type.rb +41 -0
  80. data/lib/docspring/models/field_input.rb +1109 -0
  81. data/lib/docspring/models/field_type.rb +54 -0
  82. data/lib/docspring/models/generate_files_format.rb +40 -0
  83. data/lib/docspring/models/generate_submission_files_request.rb +187 -0
  84. data/lib/docspring/models/output_format.rb +41 -0
  85. data/lib/docspring/models/page_image.rb +359 -0
  86. data/lib/docspring/models/page_images.rb +248 -0
  87. data/lib/docspring/models/predefined_field.rb +287 -0
  88. data/lib/docspring/models/predefined_field_input.rb +287 -0
  89. data/lib/docspring/models/remove_template_fields_request.rb +187 -0
  90. data/lib/docspring/models/reorder_template_fields_request.rb +187 -0
  91. data/lib/docspring/models/submission.rb +146 -117
  92. data/lib/docspring/models/submission_files.rb +13 -4
  93. data/lib/docspring/models/submission_input.rb +25 -3
  94. data/lib/docspring/models/submission_list.rb +1 -1
  95. data/lib/docspring/models/submission_summary.rb +601 -0
  96. data/lib/docspring/models/submission_validation.rb +234 -0
  97. data/lib/docspring/models/template.rb +169 -83
  98. data/lib/docspring/models/template_actor.rb +1 -1
  99. data/lib/docspring/models/template_diff.rb +321 -0
  100. data/lib/docspring/models/template_diff_summary.rb +320 -0
  101. data/lib/docspring/models/template_document.rb +44 -44
  102. data/lib/docspring/models/template_document_state.rb +3 -1
  103. data/lib/docspring/models/template_document_summary.rb +260 -0
  104. data/lib/docspring/models/template_field_change.rb +266 -0
  105. data/lib/docspring/models/template_field_changes.rb +274 -0
  106. data/lib/docspring/models/template_field_dependency.rb +1 -1
  107. data/lib/docspring/models/template_field_dependency_input.rb +1 -1
  108. data/lib/docspring/models/template_field_move.rb +239 -0
  109. data/lib/docspring/models/template_fields.rb +227 -0
  110. data/lib/docspring/models/template_page_images.rb +254 -0
  111. data/lib/docspring/models/template_preview.rb +356 -0
  112. data/lib/docspring/models/template_preview_state.rb +42 -0
  113. data/lib/docspring/models/template_summary.rb +5 -572
  114. data/lib/docspring/models/update_template_document_request.rb +23 -20
  115. data/lib/docspring/models/update_template_fields_request.rb +187 -0
  116. data/lib/docspring/models/update_template_request.rb +53 -6
  117. data/lib/docspring/models/validate_submission_request.rb +288 -0
  118. data/lib/docspring/request_schemas.json +3465 -1588
  119. data/lib/docspring/version.rb +1 -1
  120. data/lib/docspring/webhook_signature.rb +45 -0
  121. data/lib/docspring.rb +34 -0
  122. data/spec/api/client_spec.rb +167 -13
  123. data/spec/models/add_template_fields_request_spec.rb +36 -0
  124. data/spec/models/create_submission_batch_request_spec.rb +6 -0
  125. data/spec/models/create_submission_request_spec.rb +6 -0
  126. data/spec/models/create_template_preview_request_spec.rb +36 -0
  127. data/spec/models/create_template_request_spec.rb +30 -0
  128. data/spec/models/field_dependency_input_spec.rb +48 -0
  129. data/spec/models/field_dependency_spec.rb +48 -0
  130. data/spec/models/field_group_input_spec.rb +72 -0
  131. data/spec/models/field_group_spec.rb +78 -0
  132. data/spec/models/field_group_type_spec.rb +30 -0
  133. data/spec/models/field_input_spec.rb +570 -0
  134. data/spec/models/field_spec.rb +576 -0
  135. data/spec/models/field_type_spec.rb +30 -0
  136. data/spec/models/generate_files_format_spec.rb +30 -0
  137. data/spec/models/generate_submission_files_request_spec.rb +36 -0
  138. data/spec/models/output_format_spec.rb +30 -0
  139. data/spec/models/page_image_spec.rb +84 -0
  140. data/spec/models/page_images_spec.rb +54 -0
  141. data/spec/models/predefined_field_input_spec.rb +72 -0
  142. data/spec/models/predefined_field_spec.rb +72 -0
  143. data/spec/models/remove_template_fields_request_spec.rb +36 -0
  144. data/spec/models/reorder_template_fields_request_spec.rb +36 -0
  145. data/spec/models/submission_files_spec.rb +6 -0
  146. data/spec/models/submission_input_spec.rb +6 -0
  147. data/spec/models/submission_spec.rb +17 -11
  148. data/spec/models/submission_summary_spec.rb +144 -0
  149. data/spec/models/submission_validation_spec.rb +54 -0
  150. data/spec/models/template_diff_spec.rb +72 -0
  151. data/spec/models/template_diff_summary_spec.rb +66 -0
  152. data/spec/models/template_document_spec.rb +5 -5
  153. data/spec/models/template_document_summary_spec.rb +54 -0
  154. data/spec/models/template_field_change_spec.rb +54 -0
  155. data/spec/models/template_field_changes_spec.rb +54 -0
  156. data/spec/models/template_field_move_spec.rb +48 -0
  157. data/spec/models/template_fields_spec.rb +48 -0
  158. data/spec/models/template_page_images_spec.rb +54 -0
  159. data/spec/models/template_preview_spec.rb +78 -0
  160. data/spec/models/template_preview_state_spec.rb +30 -0
  161. data/spec/models/template_spec.rb +34 -10
  162. data/spec/models/template_summary_spec.rb +0 -138
  163. data/spec/models/update_template_document_request_spec.rb +12 -0
  164. data/spec/models/update_template_fields_request_spec.rb +36 -0
  165. data/spec/models/update_template_request_spec.rb +24 -0
  166. data/spec/models/validate_submission_request_spec.rb +96 -0
  167. metadata +135 -1
@@ -49,7 +49,7 @@ module DocSpring
49
49
  # Generate PDFs whose text and check fields stay fillable ("Generate Editable PDFs"). A submission's `editable` overrides it.
50
50
  attr_accessor :editable_submissions
51
51
 
52
- # The sites where the template's signature requests, forms and embedded template editor can be loaded: a host such as `app.example.com`, with an optional leading wildcard (`*.example.com`), port (`localhost:3000`) or scheme (`https://app.example.com`; without one, `http` and `https` both work). When it's empty, live signature requests don't load on any site, and the embedded template editor loads on every site.
52
+ # The sites that can embed the template's live signature requests and its embedded template editor: a host such as `app.example.com`, with an optional leading wildcard (`*.example.com`), port (`localhost:3000`) or scheme (`https://app.example.com`; without one, `http` and `https` both work). Browsers open a live signature request in a frame only on these sites (and DocSpring's), so with an empty list it can't be embedded anywhere; a test signature request can be embedded on any site. The embedded template editor loads only for a page on one of these sites (by its Referer or Origin header), and on any site when the list is empty. Forms embedded on a page (Visual Forms JS and the simple form) aren't restricted.
53
53
  attr_accessor :embed_domains
54
54
 
55
55
  # Allow the embedded template editor to change sensitive template settings (webhooks, redirect URL, encryption, public access, expiration and so on).
@@ -100,6 +100,12 @@ module DocSpring
100
100
  # The template's conditional logic rules. Setting them replaces all of the rules.
101
101
  attr_accessor :field_dependencies
102
102
 
103
+ # The field names that people using the embedded template editor choose from, each with the data type and settings a field gets when it's given that name. Setting it replaces the whole list; an empty list turns them off.
104
+ attr_accessor :predefined_fields
105
+
106
+ # Sample submission data that sets `predefined_fields`: each value becomes a predefined field, with a type that fits it (`string`, `number`, `boolean`, `date`, `email` or `url`) and `required_in_template` true. Nested objects and arrays become names with `/`, such as `customer/email`. Without `predefined_fields` in the same request, it replaces them; with them, it adds to them and sets the types of the ones it has values for.
107
+ attr_accessor :predefined_fields_sample_data
108
+
103
109
  # The HTML of an HTML template, as a Liquid template. Null for PDF templates.
104
110
  attr_accessor :html
105
111
 
@@ -115,10 +121,19 @@ module DocSpring
115
121
  # Null resets the options to their defaults.
116
122
  attr_accessor :html_engine_options
117
123
 
118
- # A PDF template's document: the `fields.key` of a file you uploaded with the presigned upload (GET /uploads/presign). Required for a PDF template. To upload the PDF with the request, use POST /templates/upload.
124
+ # Whether an HTML template HTML-escapes the values it prints. When true, `{{ value }}` prints a value as text, so a `<` or `&` in it is printed as that character, and `{{ value | raw }}` prints a value as HTML. New HTML templates default to true. Templates created before October 2026, or with API v1, default to false, which prints every value as HTML. Null for PDF templates.
125
+ attr_accessor :html_escape_data
126
+
127
+ # A PDF template's document: the `fields.key` of a file you uploaded with the presigned upload (GET /uploads/presign). A PDF template needs one of `cache_id`, `document_url` and `document_base64`. To upload the PDF with the request, use POST /templates/upload.
119
128
  attr_accessor :cache_id
120
129
 
121
- # The PDF's file name, for a `cache_id` (presigned uploads don't send one).
130
+ # An https:// link to the template's PDF (up to 100 MB), instead of `cache_id`. DocSpring downloads it after responding, following redirects to other https:// links: the template's `document.state` is `downloading` until then (sync.api hosts wait for it). If it can't be downloaded, the state is `download_failed` and `document.error_message` says why.
131
+ attr_accessor :document_url
132
+
133
+ # The template's PDF, encoded as base64 (a `data:` URI works too), instead of `cache_id`. Up to 7 MB before it's encoded: send a larger file with `cache_id` or `document_url`.
134
+ attr_accessor :document_base64
135
+
136
+ # The PDF's file name, for a `cache_id` (presigned uploads don't send one) or `document_base64`. A `document_url`'s is the last part of its path unless you set it.
122
137
  attr_accessor :filename
123
138
 
124
139
  # Set up the PDF's fields as DocSpring's "Automatically detect fields" upload option does: import or detect the fields, name them with AI, and set up conditional logic. `field_source`, `field_naming` and `field_logic` choose how. Default false. `document.page_processing_statuses` and `document.field_logic_status` show how it's going, and `document.state` becomes `processed` once every page's fields are set up.
@@ -186,12 +201,17 @@ module DocSpring
186
201
  :'slack_webhook_url' => :'slack_webhook_url',
187
202
  :'defaults' => :'defaults',
188
203
  :'field_dependencies' => :'field_dependencies',
204
+ :'predefined_fields' => :'predefined_fields',
205
+ :'predefined_fields_sample_data' => :'predefined_fields_sample_data',
189
206
  :'html' => :'html',
190
207
  :'scss' => :'scss',
191
208
  :'header_html' => :'header_html',
192
209
  :'footer_html' => :'footer_html',
193
210
  :'html_engine_options' => :'html_engine_options',
211
+ :'html_escape_data' => :'html_escape_data',
194
212
  :'cache_id' => :'cache_id',
213
+ :'document_url' => :'document_url',
214
+ :'document_base64' => :'document_base64',
195
215
  :'filename' => :'filename',
196
216
  :'detect_fields' => :'detect_fields',
197
217
  :'field_source' => :'field_source',
@@ -241,12 +261,17 @@ module DocSpring
241
261
  :'slack_webhook_url' => :'String',
242
262
  :'defaults' => :'TemplateDefaultsInput',
243
263
  :'field_dependencies' => :'Array<TemplateFieldDependencyInput>',
264
+ :'predefined_fields' => :'Array<PredefinedFieldInput>',
265
+ :'predefined_fields_sample_data' => :'Hash<String, Object>',
244
266
  :'html' => :'String',
245
267
  :'scss' => :'String',
246
268
  :'header_html' => :'String',
247
269
  :'footer_html' => :'String',
248
270
  :'html_engine_options' => :'HtmlEngineOptionsInput',
271
+ :'html_escape_data' => :'Boolean',
249
272
  :'cache_id' => :'String',
273
+ :'document_url' => :'String',
274
+ :'document_base64' => :'String',
250
275
  :'filename' => :'String',
251
276
  :'detect_fields' => :'Boolean',
252
277
  :'field_source' => :'FieldSetupSource',
@@ -263,6 +288,7 @@ module DocSpring
263
288
  :'encrypt_pdfs_password',
264
289
  :'redirect_url',
265
290
  :'slack_webhook_url',
291
+ :'predefined_fields_sample_data',
266
292
  :'html',
267
293
  :'scss',
268
294
  :'header_html',
@@ -415,6 +441,18 @@ module DocSpring
415
441
  end
416
442
  end
417
443
 
444
+ if attributes.key?(:'predefined_fields')
445
+ if (value = attributes[:'predefined_fields']).is_a?(Array)
446
+ self.predefined_fields = value
447
+ end
448
+ end
449
+
450
+ if attributes.key?(:'predefined_fields_sample_data')
451
+ if (value = attributes[:'predefined_fields_sample_data']).is_a?(Hash) || value.nil?
452
+ self.predefined_fields_sample_data = value
453
+ end
454
+ end
455
+
418
456
  if attributes.key?(:'html')
419
457
  self.html = attributes[:'html']
420
458
  end
@@ -435,10 +473,22 @@ module DocSpring
435
473
  self.html_engine_options = attributes[:'html_engine_options']
436
474
  end
437
475
 
476
+ if attributes.key?(:'html_escape_data')
477
+ self.html_escape_data = attributes[:'html_escape_data']
478
+ end
479
+
438
480
  if attributes.key?(:'cache_id')
439
481
  self.cache_id = attributes[:'cache_id']
440
482
  end
441
483
 
484
+ if attributes.key?(:'document_url')
485
+ self.document_url = attributes[:'document_url']
486
+ end
487
+
488
+ if attributes.key?(:'document_base64')
489
+ self.document_base64 = attributes[:'document_base64']
490
+ end
491
+
442
492
  if attributes.key?(:'filename')
443
493
  self.filename = attributes[:'filename']
444
494
  end
@@ -523,12 +573,17 @@ module DocSpring
523
573
  slack_webhook_url == o.slack_webhook_url &&
524
574
  defaults == o.defaults &&
525
575
  field_dependencies == o.field_dependencies &&
576
+ predefined_fields == o.predefined_fields &&
577
+ predefined_fields_sample_data == o.predefined_fields_sample_data &&
526
578
  html == o.html &&
527
579
  scss == o.scss &&
528
580
  header_html == o.header_html &&
529
581
  footer_html == o.footer_html &&
530
582
  html_engine_options == o.html_engine_options &&
583
+ html_escape_data == o.html_escape_data &&
531
584
  cache_id == o.cache_id &&
585
+ document_url == o.document_url &&
586
+ document_base64 == o.document_base64 &&
532
587
  filename == o.filename &&
533
588
  detect_fields == o.detect_fields &&
534
589
  field_source == o.field_source &&
@@ -545,7 +600,7 @@ module DocSpring
545
600
  # Calculates hash code according to all attributes.
546
601
  # @return [Integer] Hash code
547
602
  def hash
548
- [name, description, template_type, parent_folder_id, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, slack_webhook_url, defaults, field_dependencies, html, scss, header_html, footer_html, html_engine_options, cache_id, filename, detect_fields, field_source, field_naming, field_logic].hash
603
+ [name, description, template_type, parent_folder_id, locked, add_signature_request_submission_id_footers, ai_field_naming_language, allow_additional_properties, allow_skipping_optional_fields, default_form_mode, editable_submissions, embed_domains, embed_edit_allow_settings, embed_edit_allow_versioning, embed_edit_allow_document_replacement, encrypt_pdfs, encrypt_pdfs_password, expire_submissions, expire_after, expiration_interval, merge_audit_trail_pdf, parse_dates_using_template_date_format, public_submissions, public_web_form, redirect_url, slack_webhook_url, defaults, field_dependencies, predefined_fields, predefined_fields_sample_data, html, scss, header_html, footer_html, html_engine_options, html_escape_data, cache_id, document_url, document_base64, filename, detect_fields, field_source, field_naming, field_logic].hash
549
604
  end
550
605
 
551
606
  # Builds the object from hash
@@ -36,9 +36,11 @@ module DocSpring
36
36
  SERVICE_UNAVAILABLE = "service_unavailable".freeze
37
37
  UPSTREAM_TIMEOUT = "upstream_timeout".freeze
38
38
  POLLING_TIMEOUT = "polling_timeout".freeze
39
+ IDEMPOTENCY_KEY_IN_USE = "idempotency_key_in_use".freeze
40
+ IDEMPOTENCY_KEY_REUSED = "idempotency_key_reused".freeze
39
41
 
40
42
  def self.all_vars
41
- @all_vars ||= [INVALID_REQUEST, UNAUTHORIZED, PAYMENT_REQUIRED, INSUFFICIENT_CREDITS, FORBIDDEN, UPGRADE_REQUIRED, ACCOUNT_SUSPENDED, NOT_FOUND, METHOD_NOT_ALLOWED, CONFLICT, GONE, REQUEST_TOO_LARGE, UNSUPPORTED_MEDIA_TYPE, VALIDATION_FAILED, INVALID_DATA, RATE_LIMITED, INTERNAL_ERROR, BAD_GATEWAY, SERVICE_UNAVAILABLE, UPSTREAM_TIMEOUT, POLLING_TIMEOUT].freeze
43
+ @all_vars ||= [INVALID_REQUEST, UNAUTHORIZED, PAYMENT_REQUIRED, INSUFFICIENT_CREDITS, FORBIDDEN, UPGRADE_REQUIRED, ACCOUNT_SUSPENDED, NOT_FOUND, METHOD_NOT_ALLOWED, CONFLICT, GONE, REQUEST_TOO_LARGE, UNSUPPORTED_MEDIA_TYPE, VALIDATION_FAILED, INVALID_DATA, RATE_LIMITED, INTERNAL_ERROR, BAD_GATEWAY, SERVICE_UNAVAILABLE, UPSTREAM_TIMEOUT, POLLING_TIMEOUT, IDEMPOTENCY_KEY_IN_USE, IDEMPOTENCY_KEY_REUSED].freeze
42
44
  end
43
45
 
44
46
  # Builds the enum from string
@@ -25,7 +25,7 @@ module DocSpring
25
25
  # A JSON pointer to the value in the request body (RFC 6901). An empty string means the whole body. In a submission's `data_errors`, it points into the request that created the submission.
26
26
  attr_accessor :pointer
27
27
 
28
- # The query parameter the detail is about.
28
+ # The query parameter or header the detail is about.
29
29
  attr_accessor :parameter
30
30
 
31
31
  # For a batch item that failed validation, the ID of the submission recorded for it.
@@ -16,7 +16,7 @@ require 'time'
16
16
  module DocSpring
17
17
  # What went wrong.
18
18
  class ErrorInfo < ApiModelBase
19
- # A machine-readable error code. Clients should handle codes they don't know: new codes can be added. `invalid_data`: a submission's data doesn't match its template's fields. The submission is still recorded. `insufficient_credits` (402): your credit balance can't cover a live PDF. The record was saved and waits for credits in the `insufficient_credits` state: its ID is in `submission_id`, `submission_batch_id` or `combined_pdf_id`. `upgrade_required` (403): your plan doesn't include this, such as more templates or the embedded template editor. `account_suspended` (403): the account is suspended, so it can't create submissions. `polling_timeout`: on a sync.api host, the PDF wasn't ready in time. The record was created and is still being processed: its ID is in `submission_id`, `submission_batch_id`, `combined_pdf_id` or `template_id`. Without one of these IDs, the request itself got no answer in time, and the record may or may not have been created.
19
+ # A machine-readable error code. Clients should handle codes they don't know: new codes can be added. `invalid_data`: a submission's data doesn't match its template's fields. The submission is still recorded. `insufficient_credits` (402): your credit balance can't cover a live PDF. The record was saved and waits for credits in the `insufficient_credits` state: its ID is in `submission_id`, `submission_batch_id` or `combined_pdf_id`. `upgrade_required` (403): your plan doesn't include this, such as more templates or the embedded template editor. `account_suspended` (403): the account is suspended, so it can't create submissions. `polling_timeout`: on a sync.api host, the PDF wasn't ready in time. The record was created and is still being processed: its ID is in `submission_id`, `submission_batch_id`, `combined_pdf_id` or `template_id`. Without one of these IDs, the request itself got no answer in time, and the record may or may not have been created. `idempotency_key_in_use` (409): a request with the same Idempotency-Key is still being processed. Send the request again in a few seconds; when the first request has already created its record, its ID is in `submission_id`, `submission_batch_id` or `combined_pdf_id`. `idempotency_key_reused` (422): the Idempotency-Key was already used for a different request.
20
20
  attr_accessor :code
21
21
 
22
22
  # A human-readable explanation, safe to show to developers.
@@ -28,13 +28,13 @@ module DocSpring
28
28
  # The ID of the request. Include it when you contact support.
29
29
  attr_accessor :request_id
30
30
 
31
- # When a submission's data fails validation, the submission is still recorded (state `invalid_data`) so you can see it in the dashboard. This is its ID. With `insufficient_credits`, the submission that waits for credits. With `polling_timeout`, the submission that's still being processed.
31
+ # When a submission's data fails validation, the submission is still recorded (state `invalid_data`) so you can see it in the dashboard. This is its ID. With `insufficient_credits`, the submission that waits for credits. With `polling_timeout` or `idempotency_key_in_use`, the submission that's still being processed.
32
32
  attr_accessor :submission_id
33
33
 
34
- # The ID of the recorded batch, when items in a batch fail validation. With `insufficient_credits`, the batch whose submissions wait for credits. With `polling_timeout`, the batch that's still being processed.
34
+ # The ID of the recorded batch, when items in a batch fail validation. With `insufficient_credits`, the batch whose submissions wait for credits. With `polling_timeout` or `idempotency_key_in_use`, the batch that's still being processed.
35
35
  attr_accessor :submission_batch_id
36
36
 
37
- # With `insufficient_credits`, the combined PDF that waits for credits. With `polling_timeout`, the combined PDF that's still being processed.
37
+ # With `insufficient_credits`, the combined PDF that waits for credits. With `polling_timeout` or `idempotency_key_in_use`, the combined PDF that's still being processed.
38
38
  attr_accessor :combined_pdf_id
39
39
 
40
40
  # With `polling_timeout`, the template whose PDF is still being processed.