assinafy 2.2.0 → 2.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.en.md +70 -6
- data/README.md +7 -3
- data/docs/API_REFERENCE.md +134 -40
- data/lib/assinafy/client.rb +3 -0
- data/lib/assinafy/configuration.rb +3 -3
- data/lib/assinafy/resources/assignment_resource.rb +62 -11
- data/lib/assinafy/resources/document_resource.rb +71 -0
- data/lib/assinafy/resources/envelope_resource.rb +50 -0
- data/lib/assinafy/resources/field_resource.rb +5 -6
- data/lib/assinafy/resources/scheduled_send_resource.rb +122 -0
- data/lib/assinafy/resources/signer_resource.rb +16 -5
- data/lib/assinafy/version.rb +1 -1
- data/lib/assinafy.rb +1 -0
- data/sig/assinafy.rbs +17 -0
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0f488fc7c84952ceacc1c347c568fa80236a16da81b3d0c52ce8c65059488316
|
|
4
|
+
data.tar.gz: 407ed8967da231155348739babf34033185c7eae926dccccbb18f8c1669cfc25
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c4bc9ae570a8e0807194a76d70064b90f775988c16298dfe910370e991ee07fc61f108feae018fee2c37b5f677bd8146287d3eddbb0f1f144b059db10a5e3f31
|
|
7
|
+
data.tar.gz: 355bc37d3b84d6c5104e6b5f6563dc29f4ebea978709b027c6729f4cc17624d1435a7027f03c25ebabe7bcedf228d45b99f706df481e21689820822b5a0f452b
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the `assinafy` Ruby gem are documented here.
|
|
4
4
|
|
|
5
|
+
## [2.3.0] - 2026-11-24
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Scheduled assignment and envelope creation, listing, cancellation and immediate delivery for environments that publish scheduled sends.
|
|
10
|
+
- Document watchers, signer capacities (`sign_as`), notification delivery/open history, and envelope reminder cost estimates on staging.
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Virtual assignments can be signed with an empty item array; collect items can carry empty String values.
|
|
15
|
+
- Signer updates preserve explicit null or empty contact and government-ID fields so they can be cleared.
|
|
16
|
+
- Single and batch field validation preserve explicit null values for optional fields.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Development uses Ruby 4.0.10, including the latest Ruby security fixes.
|
|
21
|
+
|
|
5
22
|
## [2.2.0] - 2026-11-11
|
|
6
23
|
|
|
7
24
|
### Added
|
data/README.en.md
CHANGED
|
@@ -11,7 +11,7 @@ Run this SDK on your server. Mobile and browser clients call your backend; keep
|
|
|
11
11
|
refresh tokens and signer access codes out of application bundles, logs and browser storage.
|
|
12
12
|
|
|
13
13
|
The SDK exposes every Assinafy API v1 operation — including OAuth 2.1, two-factor authentication, webhook
|
|
14
|
-
endpoints with native signatures, and the complete supported template lifecycle. The checked-in
|
|
14
|
+
endpoints with native signatures, envelopes, contracts, embedded signing, and the complete supported template lifecycle. The checked-in
|
|
15
15
|
[`spec/api_coverage_spec.rb`](spec/api_coverage_spec.rb) validates that each route maps uniquely to a public SDK
|
|
16
16
|
method.
|
|
17
17
|
|
|
@@ -27,7 +27,7 @@ This guide follows an integration end to end — [install and configure](#instal
|
|
|
27
27
|
|
|
28
28
|
## Installation and configuration
|
|
29
29
|
|
|
30
|
-
Requirements: Ruby 3.2+ (
|
|
30
|
+
Requirements: Ruby 3.2+ (use patched Ruby 4.0.10, 3.4.13 or 3.3.14; 3.2 is legacy/EOL compatibility), Bundler, and TLS 1.2 or
|
|
31
31
|
newer (the SDK refuses TLS 1.0 and 1.1).
|
|
32
32
|
|
|
33
33
|
```ruby
|
|
@@ -360,6 +360,9 @@ The document is named after the uploaded file; rename it with `client.documents.
|
|
|
360
360
|
in-memory data, pass `{ buffer: pdf_bytes, file_name: 'contract.pdf' }`. PDF only, at most 25 MB: the SDK checks
|
|
361
361
|
the extension, size, and `%PDF-` header before sending. `wait_until_ready` raises `Assinafy::ValidationError` for
|
|
362
362
|
invalid interval values and `Assinafy::Error` for a failed terminal status or a timeout.
|
|
363
|
+
The high-level `upload_and_request_signatures` helper waits up to 30 seconds by default. For asynchronous
|
|
364
|
+
processing, pass `wait_for_ready: false` and poll separately with the required timeout. Its errors retain
|
|
365
|
+
the uploaded document and any created signer IDs in `error.context` for recovery without uploading again.
|
|
363
366
|
|
|
364
367
|
**Or select a template.** A template upload initially contains an `Editor` role. Configure at least one `Signer`
|
|
365
368
|
role and its fields in the Assinafy application before generating a document. Template uploads have the same
|
|
@@ -517,14 +520,20 @@ signing.signers.verify_email( # the OTP from email or Whats
|
|
|
517
520
|
)
|
|
518
521
|
signing.signers.upload_signature(File.binread('signature.png'), signer_access_code: access_code, type: 'signature')
|
|
519
522
|
|
|
520
|
-
signing.
|
|
523
|
+
signing.assignments.sign(
|
|
524
|
+
signing_document.fetch('id'), signing_document.dig('assignment', 'id'), [], signer_access_code: access_code
|
|
525
|
+
)
|
|
526
|
+
# sign_multiple is also available for batches of virtual documents.
|
|
521
527
|
```
|
|
522
528
|
|
|
523
|
-
That signs a virtual assignment. For a collect assignment,
|
|
524
|
-
|
|
529
|
+
That signs a virtual assignment. For a collect assignment, upload both the signature and initial images, then
|
|
530
|
+
submit required item values through `assignments.sign`. This example places only signature fields; add values
|
|
531
|
+
matching each field's type for other editable fields. Omit read-only dates, which the server fills:
|
|
525
532
|
|
|
526
533
|
```ruby
|
|
527
|
-
|
|
534
|
+
signing.signers.upload_signature(File.binread('initial.png'), signer_access_code: access_code, type: 'initial')
|
|
535
|
+
items = signing_document.fetch('assignment').fetch('items')
|
|
536
|
+
collect_items = items.select { |item| item.dig('field', 'type') == 'signature' }.map do |item|
|
|
528
537
|
{ item_id: item.fetch('id'), field_id: item.dig('field', 'id'), page_id: item.dig('page', 'id'), value: 'Accepted' }
|
|
529
538
|
end
|
|
530
539
|
|
|
@@ -878,6 +887,53 @@ signer must appear on a document. A certificate signer signs alone on each virtu
|
|
|
878
887
|
document; a biometric signer verifies once for the envelope. Preserve the creation idempotency key after an
|
|
879
888
|
ambiguous response. `max_total_credits` prevents creating or charging an envelope above the approved cost.
|
|
880
889
|
|
|
890
|
+
### Scheduled sends and document recipients (staging)
|
|
891
|
+
|
|
892
|
+
These calls are published on `https://api.angry-pisco.stage.assinafy.com.br/v1`, ahead of production.
|
|
893
|
+
Use the matching staging credentials and base URL. Production may return 404 until these routes are deployed.
|
|
894
|
+
|
|
895
|
+
```ruby
|
|
896
|
+
scheduled = client.assignments.schedule(
|
|
897
|
+
'document-id', { signers: [{ id: 'signer-id', sign_as: 'Witness' }], max_total_credits: 1 },
|
|
898
|
+
send_at: (Time.now + 7200).iso8601
|
|
899
|
+
)
|
|
900
|
+
# => { 'id' => 'send-id', 'type' => 'assignment', 'document_ids' => ['document-id'],
|
|
901
|
+
# 'status' => 'pending', 'send_at' => '2026-12-01T12:00:00Z', 'assignment_id' => nil,
|
|
902
|
+
# 'envelope_id' => nil, 'failure_reason' => nil, 'created_at' => '2026-12-01T10:00:00Z',
|
|
903
|
+
# 'processed_at' => nil }
|
|
904
|
+
client.scheduled_sends.list(document_id: 'document-id', per_page: 20) # { data:, meta: }
|
|
905
|
+
client.scheduled_sends.cancel(scheduled.fetch('id')) # status: cancelled; no charge
|
|
906
|
+
# Or send a pending request immediately:
|
|
907
|
+
# client.scheduled_sends.send_now(scheduled.fetch('id')) # status: sent; assignment_id/envelope_id populated
|
|
908
|
+
|
|
909
|
+
client.envelopes.schedule(
|
|
910
|
+
{ name: 'Contract', signers: [{ id: 'signer-id' }],
|
|
911
|
+
documents: [{ id: 'another-document-id', signer_ids: ['signer-id'] }] },
|
|
912
|
+
send_at: (Time.now + 7200).to_i
|
|
913
|
+
) # ScheduledSend with type: envelope
|
|
914
|
+
|
|
915
|
+
client.documents.signer_capacities('document-id') # [{ 'signer_id' => 'signer-id', 'sign_as' => 'Witness' }]
|
|
916
|
+
client.documents.set_watchers('document-id', ['contact-id']) # Array<Signer>; [] clears all
|
|
917
|
+
client.documents.watchers('document-id') # Array<Signer>
|
|
918
|
+
client.documents.notification_history('document-id') # signer_id plus records with delivered_at/opened_at
|
|
919
|
+
client.envelopes.estimate_resend_cost('envelope-id', 'signer-id') # total, breakdown, credit_balance, has_sufficient_credits
|
|
920
|
+
```
|
|
921
|
+
|
|
922
|
+
Scheduling creates no assignment, invitation or charge until delivery. `send_at` accepts Unix seconds or
|
|
923
|
+
ISO 8601 (no offset means UTC), one hour to 90 days ahead. Each document's deadline must be at least two hours
|
|
924
|
+
later. All schedule operations, including listing, need OAuth `documents:write`. Delivery uses the original
|
|
925
|
+
member's permissions and then-current balance, plan and price; preserve `max_total_credits` to bound charges.
|
|
926
|
+
The worker checks about every five minutes. A failed send records a reason and notifies the original member
|
|
927
|
+
(or active owners if they left). Send-now failures leave the request pending; cancel it to prevent a later attempt.
|
|
928
|
+
Only pending sends can be cancelled or sent now. Scheduling does not accept idempotency keys.
|
|
929
|
+
|
|
930
|
+
`sign_as` defaults to `Sign`; other exact values are in `AssignmentResource::SIGNER_CAPACITIES`. It records
|
|
931
|
+
the sender's statement on the certificate and is read separately, not from ordinary assignments or webhooks.
|
|
932
|
+
Watchers are up to ten workspace contacts with email, editable until the document ends. They receive a terminal
|
|
933
|
+
status email without a document link/file, independently of workspace notification policy. Delivery/open times
|
|
934
|
+
are nullable; an open is a hint, not proof a human read the invitation. Reminder estimates do not check eligibility;
|
|
935
|
+
staging limits reminders to one per two minutes and ten per 24 hours, shared across an envelope's documents.
|
|
936
|
+
|
|
881
937
|
### Embedded signing
|
|
882
938
|
|
|
883
939
|
Requires the account's Embed feature and an API key or user session; third-party OAuth cannot create sessions.
|
|
@@ -946,6 +1002,11 @@ client.signers.delete('signer-id')
|
|
|
946
1002
|
client.signers.find_by_email('alice@example.com') # case-insensitive; nil when no match
|
|
947
1003
|
```
|
|
948
1004
|
|
|
1005
|
+
`signers.update` changes only supplied fields. Explicit `nil` or `''` clears email, WhatsApp number or
|
|
1006
|
+
government ID; full_name cannot be cleared. Verified channels on unfinished requests cannot change, and changing
|
|
1007
|
+
an unverified channel invalidates old invitation links. `confirm_data` only reads email, WhatsApp number and terms;
|
|
1008
|
+
name/government-ID changes belong in workspace signer updates.
|
|
1009
|
+
|
|
949
1010
|
### Signers (self-service, signer-access-code)
|
|
950
1011
|
|
|
951
1012
|
```ruby
|
|
@@ -1070,6 +1131,9 @@ client.fields.validate_multiple(
|
|
|
1070
1131
|
)
|
|
1071
1132
|
```
|
|
1072
1133
|
|
|
1134
|
+
Single and batch field validation preserve explicit `nil` as JSON null. The API decides whether an empty value
|
|
1135
|
+
is allowed by that field; a batch item must still contain its `value` key. Zero is a value.
|
|
1136
|
+
|
|
1073
1137
|
### Webhooks
|
|
1074
1138
|
|
|
1075
1139
|
```ruby
|
data/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/assinafy/ruby-sdk/actions/workflows/ci.yml)
|
|
6
6
|
[](https://rubygems.org/gems/assinafy)
|
|
7
7
|
|
|
8
|
-
SDK Ruby 3.2+ para todas as operações publicadas da [API Assinafy v1](https://api.assinafy.com.br/v1/docs).
|
|
8
|
+
SDK Ruby 3.2+ (prefira 4.0.10, 3.4.13 ou 3.3.14) para todas as operações publicadas da [API Assinafy v1](https://api.assinafy.com.br/v1/docs).
|
|
9
9
|
O SDK é para servidores: nunca coloque chave de API, segredo OAuth ou código de signatário em aplicativo móvel,
|
|
10
10
|
navegador, log ou repositório. A referência completa, com payloads de cada operação, está em
|
|
11
11
|
[docs/API_REFERENCE.md](docs/API_REFERENCE.md); a lista detalhada por recurso está em
|
|
@@ -113,6 +113,10 @@ Para vários documentos na mesma solicitação, use `client.envelopes.estimate_c
|
|
|
113
113
|
e artefatos; a criação aceita `idempotency_key:` e `max_total_credits` limita o gasto. A mesma proteção de custo
|
|
114
114
|
existe em assignments e templates. Consulte uso e recursos do plano em `accounts.usage` e `accounts.get`.
|
|
115
115
|
|
|
116
|
+
No staging, `assignments.schedule` e `envelopes.schedule` recebem `send_at:`; acompanhe, cancele ou antecipe com
|
|
117
|
+
`scheduled_sends`. Também há `documents.signer_capacities`, `watchers`/`set_watchers` e `notification_history`.
|
|
118
|
+
Veja [disponibilidade e fluxo](README.en.md#scheduled-sends-and-document-recipients-staging); produção ainda não publica essas rotas.
|
|
119
|
+
|
|
116
120
|
### Verificação e notificação
|
|
117
121
|
|
|
118
122
|
| `verification_method` | Notificação | Regras |
|
|
@@ -135,7 +139,7 @@ inventa os endpoints de handshake ainda não publicados.
|
|
|
135
139
|
|
|
136
140
|
Operações do signatário usam `signer_access_code:` sem chave/token da workspace. O fluxo inclui termos,
|
|
137
141
|
confirmação de dados, OTP, identidade, imagem de assinatura, `assignments.sign`/`decline` e operações em lote em
|
|
138
|
-
`signer_documents`.
|
|
142
|
+
`signer_documents`. Para `virtual`, envie `[]` a `assignments.sign`; para `collect`, grave PNGs de assinatura e rubrica.
|
|
139
143
|
|
|
140
144
|
Assinatura embutida usa `embedded: true` em signatários Email/Whatsapp, origens cadastradas em `accounts` e
|
|
141
145
|
`assignments.create_embed_session` no servidor. Exige recurso Embed e chave/sessão, sem OAuth de terceiros.
|
|
@@ -177,7 +181,7 @@ Falhas da API levantam `Assinafy::ApiError`; OAuth usa `OAuthError < ApiError`;
|
|
|
177
181
|
`{ data:, meta: }`, listas simples devolvem `Array`, binários devolvem `String` e respostas vazias devolvem `nil`.
|
|
178
182
|
|
|
179
183
|
Recursos: `accounts`, `auth`, `oauth`, `users`, `documents`, `contracts`, `signers`, `signer_documents`,
|
|
180
|
-
`assignments`, `envelopes`, `templates`, `tags`, `fields`, `webhooks` e `webhook_verifier`. As assinaturas RBS ficam em
|
|
184
|
+
`assignments`, `envelopes`, `scheduled_sends`, `templates`, `tags`, `fields`, `webhooks` e `webhook_verifier`. As assinaturas RBS ficam em
|
|
181
185
|
[`sig/assinafy.rbs`](sig/assinafy.rbs).
|
|
182
186
|
|
|
183
187
|
## Desenvolvimento
|
data/docs/API_REFERENCE.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# Assinafy Ruby SDK API Reference
|
|
2
2
|
|
|
3
|
-
> Contract source: Assinafy API v1 OpenAPI 3.1.0, retrieved 2026-11-
|
|
3
|
+
> Contract source: Assinafy API v1 OpenAPI 3.1.0, retrieved 2026-11-24 from
|
|
4
4
|
> `https://api.assinafy.com.br/v1/docs/openapi.json` (112 paths, 147 operations, 62 schemas).
|
|
5
|
-
> `
|
|
5
|
+
> Staging: `https://api.angry-pisco.stage.assinafy.com.br/v1/docs/openapi.json` (120 paths, 157 operations, 63 schemas).
|
|
6
|
+
> `scripts/check_api_contract.rb` validates production contract compatibility weekly.
|
|
6
7
|
|
|
7
8
|
This is the SDK-facing contract reference. Paths below are wire paths; Ruby methods return the unwrapped
|
|
8
9
|
`data` member for Assinafy response envelopes, pagination helpers return `{ data:, meta: }`, binary methods
|
|
@@ -56,13 +57,13 @@ Required parameters and object properties are marked with `*`.
|
|
|
56
57
|
| POST | `/v1/accounts` | `AccountResource#create` | Bearer token or `X-Api-Key` | None | required; `application/json` object { `name*`: string; `notification_sender_type`: string (`"User"`, `"Account"`) } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`Account`](#account) } |
|
|
57
58
|
| GET | `/v1/documents/{documentId}/activities` | `DocumentResource#activities` | Bearer token or `X-Api-Key` | path `documentId*`: string<br>query `sort`: string<br>query `page`: integer (min: 1)<br>query `per-page`: integer (min: 1) (max: 50) | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`DocumentActivity`](#documentactivity)> } |
|
|
58
59
|
| GET | `/v1/assignments` | `AssignmentResource#list` | Bearer token or `X-Api-Key` | query `accountId`: string<br>query `sort`: string<br>query `page`: integer (min: 1)<br>query `per-page`: integer (min: 1) (max: 50) | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`Assignment`](#assignment)> } |
|
|
59
|
-
| POST | `/v1/documents/{documentId}/assignments` | `AssignmentResource#create` | Bearer token or `X-Api-Key` | path `documentId*`: string | required; `application/json` object { `method*`: string (`"virtual"`, `"collect"`); `signers*`: Array<object { `id*`: string; `verification_method`: string (`"Email"`, `"Whatsapp"`, `"DigitalCertificate"`, `"IdDocumentFaceMatchBasic"`); `notification_methods`: Array<string (`"Email"`, `"Whatsapp"`)>; `embedded`: boolean; `step`: integer }>; `entries`: Array<object { `page_id`: string; `fields`: Array<object { `signer_id`: string; `field_id`: string; `display_settings`: [`DisplaySettings`](#displaysettings) }> }>; `message`: string; `expires_at`: string (format: date-time); `copy_receivers`: Array<string>; `max_total_credits`: number } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`Assignment`](#assignment) } |
|
|
60
|
-
| POST | `/v1/documents/{documentId}/assignments/estimate-cost` | `AssignmentResource#estimate_cost` | Bearer token or `X-Api-Key` | path `documentId*`: string | required; `application/json` object { `method`: string (`"virtual"`, `"collect"`); `signers`: Array<object { `verification_method`: string (`"Email"`, `"Whatsapp"`, `"DigitalCertificate"`, `"IdDocumentFaceMatchBasic"`); `notification_methods`: Array<string (`"Email"`, `"Whatsapp"`)> }>; `entries`: Array<object> } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`CostEstimate`](#costestimate) } |
|
|
60
|
+
| POST | `/v1/documents/{documentId}/assignments` | `AssignmentResource#create` | Bearer token or `X-Api-Key` | path `documentId*`: string | required; `application/json` object { `method*`: string (`"virtual"`, `"collect"`); `signers*`: Array<object { `id*`: string; `verification_method`: string (`"Email"`, `"Whatsapp"`, `"DigitalCertificate"`, `"IdDocumentFaceMatchBasic"`); `notification_methods`: Array<string (`"Email"`, `"Whatsapp"`)>; `embedded`: boolean; `step`: integer; `sign_as`: string or null (`"Sign"`, `"Approve"`, `"Acknowledge"`, `"Party"`, `"Witness"`, `"Intervening"`, `"Receipt"`, `"IssuerEndorserGuarantor"`, `"IssuerEndorserGuarantorSurety"`, `"Surety"`, `"PartySurety"`, `"JointDebtor"`, `"PartyJointDebtor"`, `"ContractingParty"`, `"ContractedParty"`, `"Landlord"`, `"Tenant"`, `"Buyer"`, `"Seller"`, `"AttorneyInFact"`, `"LegalRepresentative"`, `"Employer"`, `"Employee"`, `null`) }>; `entries`: Array<object { `page_id`: string; `fields`: Array<object { `signer_id`: string; `field_id`: string; `display_settings`: [`DisplaySettings`](#displaysettings) }> }>; `message`: string; `expires_at`: string (format: date-time); `copy_receivers`: Array<string>; `max_total_credits`: number } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`Assignment`](#assignment) } |
|
|
61
|
+
| POST | `/v1/documents/{documentId}/assignments/estimate-cost` | `AssignmentResource#estimate_cost` | Bearer token or `X-Api-Key` | path `documentId*`: string | required; `application/json` object { `method`: string (`"virtual"`, `"collect"`); `signers`: Array<object { `verification_method`: string (`"Email"`, `"Whatsapp"`, `"DigitalCertificate"`, `"IdDocumentFaceMatchBasic"`); `sign_as`: string or null (`"Sign"`, `"Approve"`, `"Acknowledge"`, `"Party"`, `"Witness"`, `"Intervening"`, `"Receipt"`, `"IssuerEndorserGuarantor"`, `"IssuerEndorserGuarantorSurety"`, `"Surety"`, `"PartySurety"`, `"JointDebtor"`, `"PartyJointDebtor"`, `"ContractingParty"`, `"ContractedParty"`, `"Landlord"`, `"Tenant"`, `"Buyer"`, `"Seller"`, `"AttorneyInFact"`, `"LegalRepresentative"`, `"Employer"`, `"Employee"`, `null`); `notification_methods`: Array<string (`"Email"`, `"Whatsapp"`)> }>; `entries`: Array<object> } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`CostEstimate`](#costestimate) } |
|
|
61
62
|
| PUT | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/resend` | `AssignmentResource#resend_notification` | Bearer token or `X-Api-Key` | path `documentId*`: string<br>path `assignmentId*`: string<br>path `signerId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: object { `is_sent`: boolean; `document_id`: string; `signer_id`: string } } |
|
|
62
63
|
| POST | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/estimate-resend-cost` | `AssignmentResource#estimate_resend_cost` | Bearer token or `X-Api-Key` | path `documentId*`: string<br>path `assignmentId*`: string<br>path `signerId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`ResendCostEstimate`](#resendcostestimate) } |
|
|
63
64
|
| PUT | `/v1/documents/{documentId}/assignments/{assignmentId}/reset-expiration` | `AssignmentResource#reset_expiration` | Bearer token or `X-Api-Key` | path `documentId*`: string<br>path `assignmentId*`: string | required; `application/json` object { `expires_at*`: string or null (format: date-time) } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`Assignment`](#assignment) } |
|
|
64
65
|
| GET | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification` | `AssignmentResource#identity_review` | Bearer token or `X-Api-Key` | path `documentId*`: string<br>path `assignmentId*`: string<br>path `signerId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`SignerIdentityReview`](#signeridentityreview) } |
|
|
65
|
-
| GET | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/images/{name}` | `AssignmentResource#identity_review_image` | Bearer token or `X-Api-Key` | path `documentId*`: string<br>path `assignmentId*`: string<br>path `signerId*`: string<br>path `name*`: string (`"document_front"`, `"document_back"`, `"document_pdf"`, `"face"`) | None | `200` `image/jpeg` string (format: binary)
|
|
66
|
+
| GET | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/images/{name}` | `AssignmentResource#identity_review_image` | Bearer token or `X-Api-Key` | path `documentId*`: string<br>path `assignmentId*`: string<br>path `signerId*`: string<br>path `name*`: string (`"document_front"`, `"document_back"`, `"document_pdf"`, `"face"`) | None | `200` `image/jpeg` string (format: binary); `image/png` string (format: binary); `application/pdf` string (format: binary) |
|
|
66
67
|
| POST | `/v1/documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/review` | `AssignmentResource#decide_identity_review` | Bearer token or `X-Api-Key` | path `documentId*`: string<br>path `assignmentId*`: string<br>path `signerId*`: string | required; `application/json` object { `decision*`: string (`"Approved"`, `"Rejected"`); `note`: string or null (max length: 2000) } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`SignerIdentityReview`](#signeridentityreview) } |
|
|
67
68
|
| POST | `/v1/login` | `AuthResource#login` | Public | None | required; `application/json` object { `email*`: string (format: email); `password*`: string (format: password) } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`AuthSession`](#authsession) } |
|
|
68
69
|
| PUT | `/v1/authentication/request-password-reset` | `AuthResource#request_password_reset` | Public | None | required; `application/json` object { `email*`: string (format: email) } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: object { `email`: string (format: email) } } |
|
|
@@ -79,10 +80,10 @@ Required parameters and object properties are marked with `*`.
|
|
|
79
80
|
| POST | `/v1/accounts/{accountId}/documents` | `DocumentResource#upload` | Bearer token or `X-Api-Key` | path `accountId*`: string | required; `multipart/form-data` object { `file*`: string (format: binary) } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`Document`](#document) } |
|
|
80
81
|
| GET | `/v1/accounts/{accountId}/documents/search` | `DocumentResource#search` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>query `search`: string<br>query `status`: string<br>query `envelope_id`: string<br>query `sort`: string<br>query `page`: integer (min: 1)<br>query `per-page`: integer (min: 1) (max: 50) | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`Document`](#document)> } |
|
|
81
82
|
| GET | `/v1/documents/statuses` | `DocumentResource#statuses` | Bearer token or `X-Api-Key` | None | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`DocumentStatus`](#documentstatus)> } |
|
|
82
|
-
| GET | `/v1/documents/{documentId}` | `DocumentResource#details` | Bearer token or `X-Api-Key` or
|
|
83
|
+
| GET | `/v1/documents/{documentId}` | `DocumentResource#details` | Bearer token or `X-Api-Key` or signer access code | path `documentId*`: string<br>query `expand`: Array<string (`"envelope_id"`, `"envelope"`)> | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`Document`](#document) } |
|
|
83
84
|
| DELETE | `/v1/documents/{documentId}` | `DocumentResource#delete` | Bearer token or `X-Api-Key` | path `documentId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<any> } |
|
|
84
85
|
| PATCH | `/v1/documents/{documentId}` | `DocumentResource#rename` | Bearer token or `X-Api-Key` | path `documentId*`: string | required; `application/json` object { `name*`: string (max length: 255) } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`Document`](#document) } |
|
|
85
|
-
| GET | `/v1/documents/{documentId}/download/{artifactName}` | `DocumentResource#download` | Bearer token or `X-Api-Key` or
|
|
86
|
+
| GET | `/v1/documents/{documentId}/download/{artifactName}` | `DocumentResource#download` | Bearer token or `X-Api-Key` or signer access code | path `documentId*`: string<br>path `artifactName*`: string (`"original"`, `"certificated"`, `"certificate-page"`, `"pades"`, `"bundle"`) | None | `200` `application/pdf` string (format: binary) |
|
|
86
87
|
| GET | `/v1/documents/{documentSignatureHash}/verify` | `DocumentResource#verify` | Public | path `documentSignatureHash*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`DocumentVerification`](#documentverification) } |
|
|
87
88
|
| GET | `/v1/accounts/{accountId}/documents/{documentId}/tags` | `DocumentResource#list_tags` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `documentId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`Tag`](#tag)> } |
|
|
88
89
|
| PUT | `/v1/accounts/{accountId}/documents/{documentId}/tags` | `DocumentResource#replace_tags` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `documentId*`: string | required; `application/json` object { `tags`: Array<string> } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`Tag`](#tag)> } |
|
|
@@ -99,7 +100,7 @@ Required parameters and object properties are marked with `*`.
|
|
|
99
100
|
| POST | `/v1/accounts/{accountId}/envelopes/estimate-cost` | `EnvelopeResource#estimate_cost` | Bearer token or `X-Api-Key` | path `accountId*`: string | required; `application/json` [`EnvelopeCreateRequest`](#envelopecreaterequest) | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`CostEstimate`](#costestimate) } |
|
|
100
101
|
| GET | `/v1/accounts/{accountId}/envelopes/{envelopeId}` | `EnvelopeResource#get` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `envelopeId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`DocumentEnvelope`](#documentenvelope) } |
|
|
101
102
|
| DELETE | `/v1/accounts/{accountId}/envelopes/{envelopeId}` | `EnvelopeResource#delete` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `envelopeId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<any> } |
|
|
102
|
-
| PATCH | `/v1/accounts/{accountId}/envelopes/{envelopeId}` | `EnvelopeResource#update` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `envelopeId*`: string | required; `application/json` object { `name`: string (min length: 1) (max length: 255); `message`: string or null; `document_ids`: Array<string>
|
|
103
|
+
| PATCH | `/v1/accounts/{accountId}/envelopes/{envelopeId}` | `EnvelopeResource#update` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `envelopeId*`: string | required; `application/json` object { `name`: string (min length: 1) (max length: 255); `message`: string or null; `document_ids`: Array<string> } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`DocumentEnvelope`](#documentenvelope) } |
|
|
103
104
|
| GET | `/v1/accounts/{accountId}/envelopes/{envelopeId}/activities` | `EnvelopeResource#activities` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `envelopeId*`: string<br>query `sort`: string<br>query `page`: integer (min: 1)<br>query `per-page`: integer (min: 1) (max: 50) | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`EnvelopeActivity`](#envelopeactivity)> } |
|
|
104
105
|
| GET | `/v1/accounts/{accountId}/envelopes/{envelopeId}/download/{artifactName}` | `EnvelopeResource#download` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `envelopeId*`: string<br>path `artifactName*`: string (`"original"`, `"certificated"`, `"certificate-page"`, `"pades"`, `"bundle"`) | None | `200` `application/zip` string (format: binary) |
|
|
105
106
|
| PUT | `/v1/accounts/{accountId}/envelopes/{envelopeId}/cancel` | `EnvelopeResource#cancel` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `envelopeId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<object { `id*`: string; `status*`: string; `cancelled*`: boolean }> } |
|
|
@@ -111,8 +112,8 @@ Required parameters and object properties are marked with `*`.
|
|
|
111
112
|
| GET | `/v1/accounts/{accountId}/fields/{fieldId}` | `FieldResource#get` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `fieldId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`Field`](#field) } |
|
|
112
113
|
| PUT | `/v1/accounts/{accountId}/fields/{fieldId}` | `FieldResource#update` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `fieldId*`: string | required; `application/json` object { `name`: string; `regex`: string or null; `is_active`: boolean } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`Field`](#field) } |
|
|
113
114
|
| DELETE | `/v1/accounts/{accountId}/fields/{fieldId}` | `FieldResource#delete` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `fieldId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<any> } |
|
|
114
|
-
| POST | `/v1/accounts/{accountId}/fields/{fieldId}/validate` | `FieldResource#validate` | Bearer token or `X-Api-Key` or
|
|
115
|
-
| POST | `/v1/accounts/{accountId}/fields/validate-multiple` | `FieldResource#validate_multiple` | Bearer token or `X-Api-Key` or
|
|
115
|
+
| POST | `/v1/accounts/{accountId}/fields/{fieldId}/validate` | `FieldResource#validate` | Bearer token or `X-Api-Key` or signer access code | path `accountId*`: string<br>path `fieldId*`: string | required; `application/json` object { `value*`: any } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`FieldValidation`](#fieldvalidation) } |
|
|
116
|
+
| POST | `/v1/accounts/{accountId}/fields/validate-multiple` | `FieldResource#validate_multiple` | Bearer token or `X-Api-Key` or signer access code | path `accountId*`: string | required; `application/json` Array<object { `field_id*`: string; `value*`: any }> | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`FieldValidationResult`](#fieldvalidationresult)> } |
|
|
116
117
|
| GET | `/v1/field-types` | `FieldResource#types` | Bearer token or `X-Api-Key` | None | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`FieldType`](#fieldtype)> } |
|
|
117
118
|
| GET | `/v1/users/self/mfa` | `AuthResource#mfa_methods` | Bearer token or `X-Api-Key` | None | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: object { `methods`: Array<object { `id`: string; `type`: string; `label`: string; `confirmed_at`: string (format: date-time); `last_used_at`: string (format: date-time) }>; `recovery_codes_remaining`: integer } } |
|
|
118
119
|
| POST | `/v1/users/self/mfa/totp` | `AuthResource#start_totp_enrollment` | Bearer token or `X-Api-Key` | None | optional; `application/json` object { `label`: string } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: object { `id`: string; `secret`: string; `provisioning_uri`: string } } |
|
|
@@ -123,11 +124,11 @@ Required parameters and object properties are marked with `*`.
|
|
|
123
124
|
| PUT | `/v1/accounts/{accountId}/notification-policy` | `AccountResource#update_notification_policy` | Bearer token or `X-Api-Key` | path `accountId*`: string | required; `application/json` object { `events`: [`NotificationPolicyEvents`](#notificationpolicyevents); `owners_receive_all`: boolean } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`NotificationPolicy`](#notificationpolicy) } |
|
|
124
125
|
| GET | `/v1/users/self/notification-preferences` | `UserResource#notification_preferences` | Bearer token or `X-Api-Key` | None | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`NotificationPreferences`](#notificationpreferences) } |
|
|
125
126
|
| PUT | `/v1/users/self/notification-preferences` | `UserResource#update_notification_preferences` | Bearer token or `X-Api-Key` | None | required; `application/json` [`NotificationPreferences`](#notificationpreferences) | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`NotificationPreferences`](#notificationpreferences) } |
|
|
126
|
-
| POST | `/v1/oauth/token` | `OAuthResource#token` | Public | None | required; `application/x-www-form-urlencoded` [`OAuthTokenRequest`](#oauthtokenrequest)
|
|
127
|
-
| POST | `/v1/oauth/revoke` | `OAuthResource#revoke` | Public | None | required; `application/x-www-form-urlencoded` [`OAuthRevokeRequest`](#oauthrevokerequest)
|
|
127
|
+
| POST | `/v1/oauth/token` | `OAuthResource#token` | Public | None | required; `application/x-www-form-urlencoded` [`OAuthTokenRequest`](#oauthtokenrequest); `application/json` [`OAuthTokenRequest`](#oauthtokenrequest) | `200` `application/json` object { `access_token`: string; `issued_token_type`: string; `token_type`: string; `expires_in`: integer; `refresh_token`: string or null; `scope`: string; `id_token`: string or null } |
|
|
128
|
+
| POST | `/v1/oauth/revoke` | `OAuthResource#revoke` | Public | None | required; `application/x-www-form-urlencoded` [`OAuthRevokeRequest`](#oauthrevokerequest); `application/json` [`OAuthRevokeRequest`](#oauthrevokerequest) | `200` No body |
|
|
128
129
|
| GET | `/v1/oauth/userinfo` | `OAuthResource#userinfo` | Bearer token or `X-Api-Key` | None | None | `200` `application/json` object { `sub`: string; `name`: string or null; `email`: string or null (format: email); `email_verified`: boolean or null } |
|
|
129
|
-
| GET | `/v1/documents/{documentId}/thumbnail` | `DocumentResource#thumbnail` | Bearer token or `X-Api-Key` or
|
|
130
|
-
| GET | `/v1/documents/{documentId}/pages/{pageId}/download` | `DocumentResource#download_page` | Bearer token or `X-Api-Key` or
|
|
130
|
+
| GET | `/v1/documents/{documentId}/thumbnail` | `DocumentResource#thumbnail` | Bearer token or `X-Api-Key` or signer access code | path `documentId*`: string<br>query `artifact`: string | None | `200` `image/*` string (format: binary) |
|
|
131
|
+
| GET | `/v1/documents/{documentId}/pages/{pageId}/download` | `DocumentResource#download_page` | Bearer token or `X-Api-Key` or signer access code | path `documentId*`: string<br>path `pageId*`: string<br>query `artifact`: string | None | `200` `image/*` string (format: binary) |
|
|
131
132
|
| GET | `/v1/public/documents/{documentId}` | `DocumentResource#public_info` | Public | path `documentId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`Document`](#document) } |
|
|
132
133
|
| PUT | `/v1/public/documents/{documentId}/send-token` | `DocumentResource#send_token` | Public | path `documentId*`: string | required; `application/json` object { `channel*`: string (`"email"`); `recipient*`: string } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: object { `document`: object { `resource`: string; `id`: string; `name`: string; `page_count`: integer; `created_by`: string }; `channel`: string; `recipient`: string } } |
|
|
133
134
|
| GET | `/v1/users/self/push-preferences` | `UserResource#push_preferences` | Bearer token or `X-Api-Key` | None | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`PushPreferences`](#pushpreferences) } |
|
|
@@ -137,26 +138,26 @@ Required parameters and object properties are marked with `*`.
|
|
|
137
138
|
| GET | `/v1/accounts/{accountId}/signers/{signerId}` | `SignerResource#get` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `signerId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`Signer`](#signer) } |
|
|
138
139
|
| PUT | `/v1/accounts/{accountId}/signers/{signerId}` | `SignerResource#update` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `signerId*`: string | required; `application/json` object { `full_name`: string; `email`: string (format: email); `whatsapp_phone_number`: string; `government_id`: string } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`Signer`](#signer) } |
|
|
139
140
|
| DELETE | `/v1/accounts/{accountId}/signers/{signerId}` | `SignerResource#delete` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `signerId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<any> } |
|
|
140
|
-
| GET | `/v1/signers/self` | `SignerResource#self_data` |
|
|
141
|
-
| GET | `/v1/sign/theme` | `SignerResource#theme` |
|
|
142
|
-
| GET | `/v1/sign/logo` | `SignerResource#download_logo` |
|
|
143
|
-
| GET | `/v1/signers/identity-verification` | `SignerResource#identity_verification` |
|
|
144
|
-
| POST | `/v1/signers/identity-verification` | `SignerResource#start_identity_verification` |
|
|
145
|
-
| GET | `/v1/signers/{signerId}/document` | `SignerDocumentResource#current` |
|
|
146
|
-
| GET | `/v1/sign` | `AssignmentResource#signer_document` |
|
|
147
|
-
| POST | `/v1/documents/{documentId}/assignments/{assignmentId}` | `AssignmentResource#sign` |
|
|
148
|
-
| PUT | `/v1/documents/{documentId}/assignments/{assignmentId}/reject` | `AssignmentResource#decline` |
|
|
149
|
-
| PUT | `/v1/signers/documents/sign-multiple` | `SignerDocumentResource#sign_multiple` |
|
|
150
|
-
| PUT | `/v1/signers/documents/decline-multiple` | `SignerDocumentResource#decline_multiple` |
|
|
151
|
-
| POST | `/v1/verify` | `SignerResource#verify_email` |
|
|
152
|
-
| PUT | `/v1/documents/{documentId}/signers/confirm-data` | `SignerResource#confirm_data` |
|
|
153
|
-
| PUT | `/v1/signers/accept-terms` | `SignerResource#accept_terms` |
|
|
154
|
-
| POST | `/v1/signature` | `SignerResource#upload_signature` |
|
|
155
|
-
| GET | `/v1/signature/{signatureType}` | `SignerResource#download_signature` |
|
|
156
|
-
| GET | `/v1/signers/{signerId}/documents` | `SignerDocumentResource#list` |
|
|
157
|
-
| GET | `/v1/signers/{signerId}/documents/search` | `SignerDocumentResource#search` |
|
|
158
|
-
| GET | `/v1/signers/{signerId}/documents/{documentId}/download/{artifactName}` | `SignerDocumentResource#download` |
|
|
159
|
-
| POST | `/v1/sign/certified-copy` | `SignerDocumentResource#send_certified_copy` |
|
|
141
|
+
| GET | `/v1/signers/self` | `SignerResource#self_data` | signer access code | None | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`SignerSelf`](#signerself) } |
|
|
142
|
+
| GET | `/v1/sign/theme` | `SignerResource#theme` | signer access code | None | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`AccountTheme`](#accounttheme) } |
|
|
143
|
+
| GET | `/v1/sign/logo` | `SignerResource#download_logo` | signer access code | None | None | `200` `image/*` string (format: binary) |
|
|
144
|
+
| GET | `/v1/signers/identity-verification` | `SignerResource#identity_verification` | signer access code | None | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: object { `can_start`: boolean; `status`: string or null; `url`: string or null; `expires_at`: string or null (format: date-time); `completed_at`: string or null (format: date-time) } } |
|
|
145
|
+
| POST | `/v1/signers/identity-verification` | `SignerResource#start_identity_verification` | signer access code | None | required; `application/json` object { `consent*`: boolean } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: object { `id`: string; `url`: string; `expires_at`: string or null (format: date-time) } } |
|
|
146
|
+
| GET | `/v1/signers/{signerId}/document` | `SignerDocumentResource#current` | signer access code | path `signerId*`: string<br>query `expand`: Array<string (`"envelope"`)> | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`SigningDocument`](#signingdocument) } |
|
|
147
|
+
| GET | `/v1/sign` | `AssignmentResource#signer_document` | signer access code | query `has_accepted_terms`: boolean<br>query `expand`: Array<string (`"envelope"`)><br>query `document_id`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`SigningDocument`](#signingdocument) } |
|
|
148
|
+
| POST | `/v1/documents/{documentId}/assignments/{assignmentId}` | `AssignmentResource#sign` | signer access code | path `documentId*`: string<br>path `assignmentId*`: string | required; `application/json` Array<object { `itemId*`: string; `fieldId*`: string; `pageId*`: string; `value*`: string }> | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: object } |
|
|
149
|
+
| PUT | `/v1/documents/{documentId}/assignments/{assignmentId}/reject` | `AssignmentResource#decline` | signer access code | path `documentId*`: string<br>path `assignmentId*`: string | required; `application/json` object { `decline_reason*`: string (max length: 2000) } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<any> } |
|
|
150
|
+
| PUT | `/v1/signers/documents/sign-multiple` | `SignerDocumentResource#sign_multiple` | signer access code | None | required; `application/json` object { `document_ids*`: Array<string> } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<any> } |
|
|
151
|
+
| PUT | `/v1/signers/documents/decline-multiple` | `SignerDocumentResource#decline_multiple` | signer access code | None | required; `application/json` object { `document_ids*`: Array<string>; `decline_reason*`: string (max length: 2000) } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<any> } |
|
|
152
|
+
| POST | `/v1/verify` | `SignerResource#verify_email` | signer access code | None | required; `application/json` object { `verification-code*`: string } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<any> } |
|
|
153
|
+
| PUT | `/v1/documents/{documentId}/signers/confirm-data` | `SignerResource#confirm_data` | signer access code | path `documentId*`: string | required; `application/json` object { `email`: string (format: email); `whatsapp_phone_number`: string; `has_accepted_terms`: boolean } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<any> } |
|
|
154
|
+
| PUT | `/v1/signers/accept-terms` | `SignerResource#accept_terms` | signer access code | None | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: object { `full_name*`: string; `email*`: string or null (format: email); `has_accepted_terms*`: boolean } } |
|
|
155
|
+
| POST | `/v1/signature` | `SignerResource#upload_signature` | signer access code | query `type`: string (`"signature"`, `"initial"`)<br>query `reuse`: boolean | required; `image/png` string (format: binary); `image/jpeg` string (format: binary) | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<any> } |
|
|
156
|
+
| GET | `/v1/signature/{signatureType}` | `SignerResource#download_signature` | signer access code | path `signatureType*`: string | None | `200` `image/*` string (format: binary) |
|
|
157
|
+
| GET | `/v1/signers/{signerId}/documents` | `SignerDocumentResource#list` | signer access code or Bearer token or `X-Api-Key` | path `signerId*`: string<br>query `envelope_id`: string<br>query `page`: integer (min: 1)<br>query `per-page`: integer (min: 1) (max: 50) | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`Document`](#document)> } |
|
|
158
|
+
| GET | `/v1/signers/{signerId}/documents/search` | `SignerDocumentResource#search` | signer access code or Bearer token or `X-Api-Key` | path `signerId*`: string<br>query `envelope_id`: string<br>query `search`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`Document`](#document)> } |
|
|
159
|
+
| GET | `/v1/signers/{signerId}/documents/{documentId}/download/{artifactName}` | `SignerDocumentResource#download` | signer access code | path `signerId*`: string<br>path `documentId*`: string<br>path `artifactName*`: string (`"original"`) | None | `200` `application/pdf` string (format: binary) |
|
|
160
|
+
| POST | `/v1/sign/certified-copy` | `SignerDocumentResource#send_certified_copy` | signer access code | None | optional; `application/json` object { `document_id`: string } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: object { `available`: boolean; `notification_method`: string (`"Email"`, `"Whatsapp"`); `resends_left`: integer or null; `sent_to`: string } } |
|
|
160
161
|
| GET | `/v1/signers/downloads/{token}` | `SignerDocumentResource#download_certified_copy` | Public | path `token*`: string | None | `200` `application/pdf` string (format: binary) |
|
|
161
162
|
| POST | `/v1/signers/downloads/{token}/resend` | `SignerDocumentResource#resend_certified_copy` | Public | path `token*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: object { `available`: boolean; `notification_method`: string (`"Email"`, `"Whatsapp"`); `resends_left`: integer or null; `sent_to`: string } } |
|
|
162
163
|
| POST | `/v1/authentication/social-login` | `AuthResource#social_login` | Public | None | required; `application/json` object { `provider*`: string (`"google"`); `token*`: string; `has_accepted_terms*`: boolean } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`AuthSession`](#authsession) } |
|
|
@@ -192,6 +193,24 @@ Required parameters and object properties are marked with `*`.
|
|
|
192
193
|
| GET | `/.well-known/oauth-protected-resource` | `OAuthResource#protected_resource_metadata` | Public | None | None | `200` `application/json` object { `resource`: string (format: uri); `authorization_servers`: Array<string (format: uri)>; `scopes_supported`: Array<string>; `bearer_methods_supported`: Array<string> } |
|
|
193
194
|
| GET | `/v1/documents/{documentId}/assignments/{assignmentId}/whatsapp-notifications` | `AssignmentResource#whatsapp_notifications` | Bearer token or `X-Api-Key` | path `documentId*`: string<br>path `assignmentId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`WhatsappNotification`](#whatsappnotification)> } |
|
|
194
195
|
|
|
196
|
+
### Staging operations
|
|
197
|
+
|
|
198
|
+
These operations are published by `https://api.angry-pisco.stage.assinafy.com.br/v1/docs` and are not yet
|
|
199
|
+
published in production. Configure that staging base URL for these calls; production can return 404.
|
|
200
|
+
|
|
201
|
+
| Method | Path | Ruby SDK method | Authentication | Parameters | Request body | Success wire response |
|
|
202
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
203
|
+
| GET | `/v1/documents/{documentId}/signer-capacities` | `DocumentResource#signer_capacities` | Bearer token or `X-Api-Key` | path `documentId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<object { `signer_id*`: string; `sign_as*`: string (`"Sign"`, `"Approve"`, `"Acknowledge"`, `"Party"`, `"Witness"`, `"Intervening"`, `"Receipt"`, `"IssuerEndorserGuarantor"`, `"IssuerEndorserGuarantorSurety"`, `"Surety"`, `"PartySurety"`, `"JointDebtor"`, `"PartyJointDebtor"`, `"ContractingParty"`, `"ContractedParty"`, `"Landlord"`, `"Tenant"`, `"Buyer"`, `"Seller"`, `"AttorneyInFact"`, `"LegalRepresentative"`, `"Employer"`, `"Employee"`) }> } |
|
|
204
|
+
| GET | `/v1/documents/{documentId}/watchers` | `DocumentResource#watchers` | Bearer token or `X-Api-Key` | path `documentId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`Signer`](#signer)> } |
|
|
205
|
+
| PUT | `/v1/documents/{documentId}/watchers` | `DocumentResource#set_watchers` | Bearer token or `X-Api-Key` | path `documentId*`: string | required; `application/json` object { `watcher_ids*`: Array<string (min length: 1)> (max items: 10) } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`Signer`](#signer)> } |
|
|
206
|
+
| POST | `/v1/accounts/{accountId}/envelopes/{envelopeId}/signers/{signerId}/estimate-resend-cost` | `EnvelopeResource#estimate_resend_cost` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `envelopeId*`: string<br>path `signerId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`ResendCostEstimate`](#resendcostestimate) } |
|
|
207
|
+
| GET | `/v1/documents/{documentId}/notification-history` | `DocumentResource#notification_history` | Bearer token or `X-Api-Key` | path `documentId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<object { `signer_id*`: string; `notification_history*`: Array<[`NotificationHistoryEntry`](#notificationhistoryentry) plus object { `delivered_at`: string or null (format: date-time); `opened_at`: string or null (format: date-time) }> }> } |
|
|
208
|
+
| POST | `/v1/documents/{documentId}/scheduled-sends` | `AssignmentResource#schedule` | Bearer token or `X-Api-Key` | path `documentId*`: string | required; `application/json` object { `send_at*`: string (format: date-time) or integer; `method`: string (`"virtual"`, `"collect"`); `signers*`: Array<object>; `expires_at`: string (format: date-time) or integer or null } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`ScheduledSend`](#scheduledsend) } |
|
|
209
|
+
| GET | `/v1/accounts/{accountId}/scheduled-sends` | `ScheduledSendResource#list` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>query `page`: integer (min: 1)<br>query `per-page`: integer (min: 1) (max: 50)<br>query `document_id`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: Array<[`ScheduledSend`](#scheduledsend)> } |
|
|
210
|
+
| POST | `/v1/accounts/{accountId}/scheduled-sends` | `EnvelopeResource#schedule` | Bearer token or `X-Api-Key` | path `accountId*`: string | required; `application/json` [`EnvelopeCreateRequest`](#envelopecreaterequest) plus object { `send_at*`: string (format: date-time) or integer } | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`ScheduledSend`](#scheduledsend) } |
|
|
211
|
+
| PUT | `/v1/accounts/{accountId}/scheduled-sends/{scheduledSendId}/cancel` | `ScheduledSendResource#cancel` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `scheduledSendId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`ScheduledSend`](#scheduledsend) } |
|
|
212
|
+
| PUT | `/v1/accounts/{accountId}/scheduled-sends/{scheduledSendId}/send` | `ScheduledSendResource#send_now` | Bearer token or `X-Api-Key` | path `accountId*`: string<br>path `scheduledSendId*`: string | None | `200` `application/json` [`Envelope`](#envelope) plus object { `data`: [`ScheduledSend`](#scheduledsend) } |
|
|
213
|
+
|
|
195
214
|
## Error responses
|
|
196
215
|
|
|
197
216
|
OAuth endpoints are the exception to everything in this section: `/v1/oauth/token` and
|
|
@@ -481,6 +500,59 @@ email preferences. `accounts.notification_policy` reads workspace event rules; o
|
|
|
481
500
|
Document activities accept sort/page/per_page; `activities` preserves the Array return, and `activities_page`
|
|
482
501
|
returns pagination metadata. Envelope activities are always paginated.
|
|
483
502
|
|
|
503
|
+
### Scheduled sends, capacities and watchers
|
|
504
|
+
|
|
505
|
+
Staging exposes `assignments.schedule(document_id, payload, send_at:)` and
|
|
506
|
+
`envelopes.schedule(payload, send_at:)`. Both reuse the corresponding creation payload validators and return
|
|
507
|
+
`ScheduledSend` without sending or charging now. `send_at` is ISO 8601 (no offset means UTC) or Unix seconds,
|
|
508
|
+
from one hour to 90 days ahead; every explicit document deadline must be at least two hours after it.
|
|
509
|
+
A document can have only one pending/processing send. The worker runs about every five minutes and applies
|
|
510
|
+
the original member's permissions, balance, plan and credit ceiling at delivery time. Failure leaves a `failed`
|
|
511
|
+
record and emails that member, or active owners if the member left. Scheduling does not reserve balances or
|
|
512
|
+
prevent immediate assignment creation, and does not support an idempotency key.
|
|
513
|
+
|
|
514
|
+
`scheduled_sends.list(document_id:, page:, per_page:)` returns all states, newest first; all scheduled-send
|
|
515
|
+
operations require `documents:write`, including listing. `cancel(id)` cancels only pending sends;
|
|
516
|
+
`send_now(id)` creates the assignment/envelope immediately. A refused send-now remains pending, so cancel it
|
|
517
|
+
if a later attempt is unwanted. Repeating send/cancel after a terminal state raises `ApiError` with 409.
|
|
518
|
+
|
|
519
|
+
Assignments accept `sign_as` on each signer, defaulting to `Sign` when omitted or nil. The exact supported
|
|
520
|
+
values are `AssignmentResource::SIGNER_CAPACITIES`; they identify the sender's stated signing capacity,
|
|
521
|
+
printed on the certificate only. They are immutable after creation and read through
|
|
522
|
+
`documents.signer_capacities(id)`, not ordinary assignment reads or webhooks. Envelope/template signer
|
|
523
|
+
schemas do not publish this field.
|
|
524
|
+
|
|
525
|
+
`documents.set_watchers(id, watcher_ids)` replaces up to ten workspace contacts with email addresses;
|
|
526
|
+
`[]` clears them. `documents.watchers(id)` reads them in order. Watchers receive a completion, decline or
|
|
527
|
+
expiry email with the document name and sender, without a link/file, independent of workspace notification
|
|
528
|
+
policy. Change them only while the document is open. A signer who is also a watcher receives both emails.
|
|
529
|
+
|
|
530
|
+
`documents.notification_history(id)` adds nullable delivery/open timestamps to each signer's records.
|
|
531
|
+
Opens can come from link scanners or mail clients and are not proof of human reading. Envelope reminders
|
|
532
|
+
have `envelopes.estimate_resend_cost(id, signer_id)`; one reminder covers the whole envelope and returns
|
|
533
|
+
`ResendCostEstimate` (`total`, not `total_credits`). An estimate does not check timing eligibility. Staging
|
|
534
|
+
reminders refuse expired requests, repeats within two minutes, or more than ten reminders in 24 hours;
|
|
535
|
+
reminders through the envelope and its documents share that limit.
|
|
536
|
+
|
|
537
|
+
### Signing and explicit empty values
|
|
538
|
+
|
|
539
|
+
Use `assignments.sign(document_id, assignment_id, [], signer_access_code:)` for virtual assignments after
|
|
540
|
+
terms, contact confirmation and OTP verification. For collect assignments, store both `signature` and
|
|
541
|
+
`initial` PNG images first, even if no initial field is placed. Supply the required item values; omitted
|
|
542
|
+
read-only dates are filled by the server, optional fields may remain empty, and an omitted required field
|
|
543
|
+
fails. Image fields use stored images and `signatureDate` uses the server's signing timestamp. The SDK passes
|
|
544
|
+
empty String values through; the API still rejects them for required fields, including signature fields.
|
|
545
|
+
Staging returns the signer's assignment, without signing URLs, with only their items and other parties' contact
|
|
546
|
+
details and government IDs null. A completed request may be repeated safely according to staging's contract,
|
|
547
|
+
but the SDK never retries it automatically.
|
|
548
|
+
|
|
549
|
+
`signers.update` preserves explicit nil or empty String for email, WhatsApp number and government ID, so
|
|
550
|
+
callers can clear them. Omitted fields remain unchanged; full_name cannot be cleared. Verified contact
|
|
551
|
+
channels on unfinished requests cannot be changed, and changes to unverified channels invalidate old links.
|
|
552
|
+
`signers.confirm_data` only changes email, WhatsApp number and accepted terms; use workspace signer updates
|
|
553
|
+
for name and government ID. Field validation sends an explicit nil as JSON null and leaves required/optional
|
|
554
|
+
validation to the API; zero remains a value. A missing batch `value` key is rejected locally.
|
|
555
|
+
|
|
484
556
|
## SDK-only helpers and aliases
|
|
485
557
|
|
|
486
558
|
These public functions do not map one-to-one to an API operation. Their source comments provide parameter,
|
|
@@ -493,7 +565,7 @@ return-value, and usage details.
|
|
|
493
565
|
| `Assinafy::Client.from_config`, `.from_hash` | Construct a client from string- or symbol-keyed configuration. | [`client.rb`](../lib/assinafy/client.rb) |
|
|
494
566
|
| `Client#faraday_connection` | Return the configured Faraday connection for advanced integration. | [`client.rb`](../lib/assinafy/client.rb) |
|
|
495
567
|
| `Client#upload_and_request_signatures` | Upload, optionally wait, create signers, and create a virtual assignment. | [`client.rb`](../lib/assinafy/client.rb) |
|
|
496
|
-
| `Client#auth`, `#oauth`, `#accounts`, `#users`, `#documents`, `#contracts`, `#signers`, `#signer_documents`, `#assignments`, `#envelopes`, `#webhooks`, `#templates`, `#fields`, `#tags`, `#webhook_verifier` | Return the client's resource and helper instances. | [`client.rb`](../lib/assinafy/client.rb) |
|
|
568
|
+
| `Client#auth`, `#oauth`, `#accounts`, `#users`, `#documents`, `#contracts`, `#signers`, `#signer_documents`, `#assignments`, `#envelopes`, `#scheduled_sends`, `#webhooks`, `#templates`, `#fields`, `#tags`, `#webhook_verifier` | Return the client's resource and helper instances. | [`client.rb`](../lib/assinafy/client.rb) |
|
|
497
569
|
| `Assinafy::Configuration.new`, `.from_hash` | Build configuration directly or from string/symbol keys. | [`configuration.rb`](../lib/assinafy/configuration.rb) |
|
|
498
570
|
| `Configuration#auth_headers` | Return the selected API-key, bearer, or empty authentication header set. | [`configuration.rb`](../lib/assinafy/configuration.rb) |
|
|
499
571
|
| Configuration readers/writers: `api_key`, `token`, `account_id`, `base_url`, `webhook_secret`, `timeout`, `logger` | Read or update configuration values; `base_url=` and `timeout=` validate like the constructor. Construct a new client to apply changes. | [`configuration.rb`](../lib/assinafy/configuration.rb) |
|
|
@@ -519,11 +591,15 @@ return-value, and usage details.
|
|
|
519
591
|
| `Assinafy::OAuth.generate_code_verifier`, `.code_challenge`, `.generate_state`, `.normalize_scope`, `.validate_code_verifier!`, `.authorization_url` | Build the PKCE pair, CSRF state, and authorization URL for the browser half of the OAuth flow. No network request. | [`oauth.rb`](../lib/assinafy/oauth.rb) |
|
|
520
592
|
| `Assinafy::OAuth::AUTHORIZATION_SERVER`, `::AUTHORIZATION_SERVER_METADATA_URL`, `::AUTHORIZATION_ENDPOINT`, `::CODE_CHALLENGE_METHOD`, `::SCOPES` | Published authorization-server endpoints and scopes. | [`oauth.rb`](../lib/assinafy/oauth.rb) |
|
|
521
593
|
| `AssignmentResource::VERIFICATION_METHODS`, `::NOTIFICATION_METHODS` | The signer verification (`Email`, `Whatsapp`, `DigitalCertificate`, `IdDocumentFaceMatchBasic`) and notification (`Email`, `Whatsapp`) enums, validated locally by `build_payload`. | [`assignment_resource.rb`](../lib/assinafy/resources/assignment_resource.rb) |
|
|
522
|
-
| `Assinafy::Utils.handle_assinafy_response`, `.clean_params`, `.query_params`, `.body_params`, `.require_email`, `.require_expiration`, `.require_credit_ceiling
|
|
594
|
+
| `Assinafy::Utils.handle_assinafy_response`, `.clean_params`, `.query_params`, `.body_params`, `.require_email`, `.require_expiration`, `.require_credit_ceiling` | Internal public helpers used by resources for envelope and parameter normalization; applications should prefer resource methods. | [`utils.rb`](../lib/assinafy/utils.rb) |
|
|
523
595
|
| `Assinafy::NullLogger#debug`, `#info`, `#warn`, `#error`, `#fatal`, `#unknown` | Internal no-op logger methods used when no logger is configured. | [`null_logger.rb`](../lib/assinafy/null_logger.rb) |
|
|
524
596
|
| `Assinafy::VERSION` | Published SDK version constant. | [`version.rb`](../lib/assinafy/version.rb) |
|
|
525
597
|
| `Assinafy::USER_AGENT` | Version-derived `Assinafy-Ruby-SDK/v[VERSION]` request identifier. | [`version.rb`](../lib/assinafy/version.rb) |
|
|
526
598
|
|
|
599
|
+
`ScheduledSendResource.require_send_at` validates the delivery window and returns a Time;
|
|
600
|
+
`.scheduled_expiration` validates a deadline against it and returns zoned ISO 8601. Resources use these helpers
|
|
601
|
+
before scheduling; callers normally use `assignments.schedule` or `envelopes.schedule`.
|
|
602
|
+
|
|
527
603
|
## Request and response examples
|
|
528
604
|
|
|
529
605
|
The resource methods linked above include request and response examples in their YARD documentation.
|
|
@@ -531,7 +607,7 @@ The schema catalog below describes the published response objects and their nest
|
|
|
531
607
|
|
|
532
608
|
## Schema catalog
|
|
533
609
|
|
|
534
|
-
All
|
|
610
|
+
All 63 published schemas (including staging ScheduledSend) are listed below. `*` marks required properties. Nested fields are listed with dot notation; links identify reusable schemas. Examples use placeholder contacts.
|
|
535
611
|
|
|
536
612
|
### Account
|
|
537
613
|
|
|
@@ -764,7 +840,7 @@ A document and its current lifecycle state.
|
|
|
764
840
|
| `verification_url` | string or null (format: uri) | The public verification page for this document. `null` until the document is `certificated`. Example: `"https://www.assinafy.com.br/verificador/a3f1c9e07b2d4e8f9a6c5b1d0e7f3a2c9b8d4e6f"`. |
|
|
765
841
|
| `decline_reason` | string or null | Example: `null`. |
|
|
766
842
|
| `declined_by` | [`Signer`](#signer) or null | |
|
|
767
|
-
| `tags` | Array<object { `id`: string; `name`: string; `color`: string or null }> |
|
|
843
|
+
| `tags` | Array<object { `id`: string; `name`: string; `color`: string or null }> | The workspace's labels on the document. Always empty when the signer reads it with their code.
|
|
768
844
|
| `tags[].id` | string | |
|
|
769
845
|
| `tags[].name` | string | |
|
|
770
846
|
| `tags[].color` | string or null | 6-char hex without leading #. Example: `"ff8800"`. |
|
|
@@ -1073,7 +1149,7 @@ A reusable field definition.
|
|
|
1073
1149
|
| `type` | string | Example: `"signature"`. |
|
|
1074
1150
|
| `regex` | string or null | |
|
|
1075
1151
|
| `is_pre_defined` | boolean | |
|
|
1076
|
-
| `is_active` | boolean |
|
|
1152
|
+
| `is_active` | boolean | Whether the field is offered for new placements: the field list leaves an inactive one out unless `include_inactive` is set. Documents and templates already using an inactive field keep working: its values are still validated and signed.
|
|
1077
1153
|
| `is_required` | boolean | |
|
|
1078
1154
|
| `is_standard` | boolean | |
|
|
1079
1155
|
| `is_read_only` | boolean | |
|
|
@@ -1243,7 +1319,7 @@ A signing party belonging to a workspace account.
|
|
|
1243
1319
|
| `id` | string | Example: `"62d6ee35c7741ca4006b9e11"`. |
|
|
1244
1320
|
| `full_name` | string | Example: `"John Signer"`. |
|
|
1245
1321
|
| `email` | string or null (format: email) | Example: `"signer@example.com"`. |
|
|
1246
|
-
| `whatsapp_phone_number` | string or null | E.164 format; normalized on save.
|
|
1322
|
+
| `whatsapp_phone_number` | string or null | E.164 format; normalized on save. A number written with `+` is read with the country code it names first, and as Brazilian if it isn't valid there; one without `+` is read as a Brazilian area code and number first.
|
|
1247
1323
|
| `government_id` | string or null | Signer's normalized CPF (11 digits) or CNPJ (14 characters; may be alphanumeric). Example: `"39053344705"`. |
|
|
1248
1324
|
| `has_accepted_terms` | boolean | Example: `false`. |
|
|
1249
1325
|
|
|
@@ -1535,3 +1611,21 @@ A rendered WhatsApp notification sent for an assignment, split into header/body/
|
|
|
1535
1611
|
| `buttons[].text` | string | The button label shown to the signer. Example: `"Abrir documento"`. |
|
|
1536
1612
|
| `phone_number` | string | Recipient phone (E.164). Example: `"+5511999990001"`. |
|
|
1537
1613
|
| `signer_id` | string | Example: `"a51edaee68a7"`. |
|
|
1614
|
+
|
|
1615
|
+
### ScheduledSend
|
|
1616
|
+
|
|
1617
|
+
A **Create assignment** or **Create envelope** request kept until `send_at`, then made as that route makes it, by the member who scheduled it. Available on staging.
|
|
1618
|
+
|
|
1619
|
+
| Property | Type | Description |
|
|
1620
|
+
| --- | --- | --- |
|
|
1621
|
+
| `resource` | string | |
|
|
1622
|
+
| `id` * | string | |
|
|
1623
|
+
| `type` * | string (`"assignment"`, `"envelope"`) | What it creates. |
|
|
1624
|
+
| `document_ids` * | Array<string> | The documents it sends: one for an assignment, the envelope's for an envelope. A deleted document is left out. |
|
|
1625
|
+
| `status` * | string (`"pending"`, `"processing"`, `"sent"`, `"cancelled"`, `"failed"`) | `pending` until `send_at` (or **Send a scheduled send now**); `processing` while its request is being made; then `sent` (the request was made; its invitations go out right after), `failed` or, if cancelled while pending, `cancelled`. A send whose run was interrupted while `processing` made nothing, and fails within about an hour. |
|
|
1626
|
+
| `send_at` * | string (format: date-time) | |
|
|
1627
|
+
| `assignment_id` * | string or null | The assignment it created, once an `assignment` is `sent`. |
|
|
1628
|
+
| `envelope_id` * | string or null | The envelope it created, once an `envelope` is `sent`; `null` again once the envelope is deleted. |
|
|
1629
|
+
| `failure_reason` * | string or null | Why it was not sent, once `failed`: the refusal the create route answered then (no documents or credits left, a signer removed, the document already sent, the plan without Envelopes), that the workspace is being deleted, or that the member who scheduled it left the workspace. Written in Portuguese. |
|
|
1630
|
+
| `created_at` * | string (format: date-time) | |
|
|
1631
|
+
| `processed_at` * | string or null (format: date-time) | When it was sent, failed or cancelled. |
|
data/lib/assinafy/client.rb
CHANGED
|
@@ -43,6 +43,8 @@ module Assinafy
|
|
|
43
43
|
attr_reader :assignments
|
|
44
44
|
# @return [Resources::EnvelopeResource]
|
|
45
45
|
attr_reader :envelopes
|
|
46
|
+
# @return [Resources::ScheduledSendResource]
|
|
47
|
+
attr_reader :scheduled_sends
|
|
46
48
|
# @return [Resources::WebhookResource]
|
|
47
49
|
attr_reader :webhooks
|
|
48
50
|
# @return [Resources::TemplateResource]
|
|
@@ -93,6 +95,7 @@ module Assinafy
|
|
|
93
95
|
@signer_documents = Resources::SignerDocumentResource.new(@connection, nil, @logger)
|
|
94
96
|
@assignments = Resources::AssignmentResource.new(@connection, account_id, @logger)
|
|
95
97
|
@envelopes = Resources::EnvelopeResource.new(@connection, account_id, @logger)
|
|
98
|
+
@scheduled_sends = Resources::ScheduledSendResource.new(@connection, account_id, @logger)
|
|
96
99
|
@webhooks = Resources::WebhookResource.new(@connection, account_id, @logger)
|
|
97
100
|
@templates = Resources::TemplateResource.new(@connection, account_id, @logger)
|
|
98
101
|
@fields = Resources::FieldResource.new(@connection, account_id, @logger)
|
|
@@ -33,7 +33,7 @@ module Assinafy
|
|
|
33
33
|
# @!attribute [rw] api_key
|
|
34
34
|
# @return [String, nil] sent as `X-Api-Key`
|
|
35
35
|
# @!attribute [rw] token
|
|
36
|
-
# @return [String, nil]
|
|
36
|
+
# @return [String, nil] session or OAuth bearer token (used when `api_key` is blank)
|
|
37
37
|
# @!attribute [rw] account_id
|
|
38
38
|
# @return [String, nil] default workspace ID
|
|
39
39
|
# @!attribute [rw] base_url
|
|
@@ -48,11 +48,11 @@ module Assinafy
|
|
|
48
48
|
attr_reader :base_url, :timeout
|
|
49
49
|
|
|
50
50
|
# Build a configuration directly from keyword arguments. Prefer passing
|
|
51
|
-
# `api_key` (the documented `X-Api-Key` mechanism); `token` is the
|
|
51
|
+
# `api_key` (the documented `X-Api-Key` mechanism); `token` is the session/OAuth
|
|
52
52
|
# bearer fallback. `base_url` has its trailing slash stripped on assignment.
|
|
53
53
|
#
|
|
54
54
|
# @param api_key [String, nil] sent as the `X-Api-Key` header
|
|
55
|
-
# @param token [String, nil]
|
|
55
|
+
# @param token [String, nil] session or OAuth bearer token (used only when `api_key` is blank)
|
|
56
56
|
# @param account_id [String, nil] default workspace account ID
|
|
57
57
|
# @param base_url [String] API base URL (trailing slash is stripped)
|
|
58
58
|
# @param webhook_secret [String, nil] secret for {Support::WebhookVerifier}
|
|
@@ -40,6 +40,11 @@ module Assinafy
|
|
|
40
40
|
# subscriptions. When omitted it is inferred from `verification_method`
|
|
41
41
|
# (`Whatsapp` → `["Whatsapp"]`); when both are omitted it is `["Email"]`.
|
|
42
42
|
NOTIFICATION_METHODS = %w[Email Whatsapp].freeze
|
|
43
|
+
SIGNER_CAPACITIES = %w[
|
|
44
|
+
Sign Approve Acknowledge Party Witness Intervening Receipt IssuerEndorserGuarantor
|
|
45
|
+
IssuerEndorserGuarantorSurety Surety PartySurety JointDebtor PartyJointDebtor ContractingParty
|
|
46
|
+
ContractedParty Landlord Tenant Buyer Seller AttorneyInFact LegalRepresentative Employer Employee
|
|
47
|
+
].freeze
|
|
43
48
|
|
|
44
49
|
SIGN_ITEM_KEY_MAP = {
|
|
45
50
|
'item_id' => 'itemId',
|
|
@@ -53,7 +58,7 @@ module Assinafy
|
|
|
53
58
|
# shape the API expects. Accepts:
|
|
54
59
|
#
|
|
55
60
|
# - `signers: ['id1', 'id2']` — bare IDs
|
|
56
|
-
# - `signers: [{ id:, verification_method:, notification_methods:, step: }]`
|
|
61
|
+
# - `signers: [{ id:, verification_method:, notification_methods:, step:, embedded:, sign_as: }]`
|
|
57
62
|
# - Legacy `signer_ids:`/`signerIds:` arrays of IDs
|
|
58
63
|
#
|
|
59
64
|
# @note Creation requires top-level `signers` for both methods, and `collect` additionally
|
|
@@ -252,18 +257,24 @@ module Assinafy
|
|
|
252
257
|
r = ref.transform_keys(&:to_sym)
|
|
253
258
|
id = r[:id] || r[:signer_id]
|
|
254
259
|
|
|
260
|
+
normalised = { id: id }.compact.merge(signer_options(r))
|
|
261
|
+
|
|
262
|
+
return normalised if id.is_a?(String) && !id.strip.empty?
|
|
263
|
+
return normalised if id.nil? && options[:allow_signers_without_id]
|
|
264
|
+
|
|
265
|
+
raise ValidationError.new('Invalid signer reference', { ref: ref })
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
def signer_options(r)
|
|
255
269
|
normalised = {}
|
|
256
|
-
normalised[:id] = id if id
|
|
257
270
|
normalised[:verification_method] = verification_method!(r) unless r[:verification_method].nil?
|
|
258
271
|
normalised[:notification_methods] = notification_methods!(r) unless r[:notification_methods].nil?
|
|
259
272
|
normalised[:step] = signer_step!(r[:step]) unless r[:step].nil?
|
|
260
273
|
normalised[:embedded] = embedded_signer!(r) if r.key?(:embedded)
|
|
274
|
+
normalised[:sign_as] = signer_capacity!(r[:sign_as]) unless r[:sign_as].nil?
|
|
261
275
|
validate_method_pair!(normalised)
|
|
262
276
|
|
|
263
|
-
|
|
264
|
-
return normalised if id.nil? && options[:allow_signers_without_id]
|
|
265
|
-
|
|
266
|
-
raise ValidationError.new('Invalid signer reference', { ref: ref })
|
|
277
|
+
normalised
|
|
267
278
|
end
|
|
268
279
|
|
|
269
280
|
# The API's enums are closed and it reports an unknown value as a 422
|
|
@@ -308,6 +319,12 @@ module Assinafy
|
|
|
308
319
|
raise ValidationError.new('step must be a positive Integer', { step: step })
|
|
309
320
|
end
|
|
310
321
|
|
|
322
|
+
def signer_capacity!(value)
|
|
323
|
+
return value if SIGNER_CAPACITIES.include?(value)
|
|
324
|
+
|
|
325
|
+
raise ValidationError.new("sign_as must be one of: #{SIGNER_CAPACITIES.join(', ')}")
|
|
326
|
+
end
|
|
327
|
+
|
|
311
328
|
def validate_method_pair!(signer)
|
|
312
329
|
verification = signer[:verification_method]
|
|
313
330
|
notification = signer[:notification_methods]&.first
|
|
@@ -442,6 +459,33 @@ module Assinafy
|
|
|
442
459
|
end
|
|
443
460
|
end
|
|
444
461
|
|
|
462
|
+
# Schedule an assignment without creating or charging it now. Requires documents:write.
|
|
463
|
+
# Available on staging; the environment must publish scheduled sends.
|
|
464
|
+
# @param document_id [String]
|
|
465
|
+
# @param payload [Hash] the same assignment payload as create, including sign_as when needed
|
|
466
|
+
# @param send_at [String, Integer] from one hour to 90 days ahead; absent offset means UTC
|
|
467
|
+
# @return [Hash] ScheduledSend; its deadline must be at least two hours after send_at
|
|
468
|
+
# @raise [ValidationError] on invalid IDs, payload or timing
|
|
469
|
+
# @raise [ApiError, NetworkError] on API or transport failure
|
|
470
|
+
# @see POST /documents/{documentId}/scheduled-sends
|
|
471
|
+
# @example
|
|
472
|
+
# client.assignments.schedule('document-id', { signers: ['signer-id'] },
|
|
473
|
+
# send_at: (Time.now + 7200).iso8601)
|
|
474
|
+
# # POST body: { "method": "virtual", "signers": [{ "id": "signer-id" }],
|
|
475
|
+
# # "send_at": "2026-12-01T12:00:00Z" }
|
|
476
|
+
# # => { 'resource' => 'scheduled_send', 'id' => 'send-id', 'type' => 'assignment',
|
|
477
|
+
# # 'document_ids' => ['document-id'], 'status' => 'pending', 'send_at' => '2026-12-01T12:00:00Z',
|
|
478
|
+
# # 'assignment_id' => nil, 'envelope_id' => nil, 'failure_reason' => nil,
|
|
479
|
+
# # 'created_at' => '2026-12-01T10:00:00Z', 'processed_at' => nil }
|
|
480
|
+
def schedule(document_id, payload, send_at:)
|
|
481
|
+
id = require_id(document_id, 'Document ID')
|
|
482
|
+
time = ScheduledSendResource.require_send_at(send_at)
|
|
483
|
+
raw = require_payload(payload).transform_keys(&:to_s)
|
|
484
|
+
raw['expires_at'] = ScheduledSendResource.scheduled_expiration(raw['expires_at'], time)
|
|
485
|
+
body = self.class.build_payload(raw).merge('send_at' => send_at)
|
|
486
|
+
call('Failed to schedule assignment') { http_post("documents/#{id}/scheduled-sends", body) }
|
|
487
|
+
end
|
|
488
|
+
|
|
445
489
|
# Estimate the credit cost of a potential assignment, without creating it.
|
|
446
490
|
# Accepts the same payload as {#create}, but signer descriptors may omit
|
|
447
491
|
# `id`. An empty descriptor (`{}`) defaults both methods to `Email`.
|
|
@@ -543,6 +587,7 @@ module Assinafy
|
|
|
543
587
|
end
|
|
544
588
|
|
|
545
589
|
# Estimate the credit cost of resending the notification to a signer.
|
|
590
|
+
# Does not check deadline or reminder frequency eligibility.
|
|
546
591
|
#
|
|
547
592
|
# @param document_id [String]
|
|
548
593
|
# @param assignment_id [String]
|
|
@@ -756,6 +801,8 @@ module Assinafy
|
|
|
756
801
|
end
|
|
757
802
|
|
|
758
803
|
# Submit signatures for an assignment as a signer.
|
|
804
|
+
# Virtual assignments send []; collect requires stored signature and initial images.
|
|
805
|
+
# Omitted read-only/optional collect fields are filled or left empty by the API.
|
|
759
806
|
#
|
|
760
807
|
# The API uses camelCase for this body. Callers may pass snake_case
|
|
761
808
|
# (`item_id`, `field_id`, `page_id`, `value`) — this method maps them
|
|
@@ -763,9 +810,10 @@ module Assinafy
|
|
|
763
810
|
#
|
|
764
811
|
# @param document_id [String]
|
|
765
812
|
# @param assignment_id [String]
|
|
766
|
-
# @param items [Array<Hash>]
|
|
813
|
+
# @param items [Array<Hash>] [] for virtual; the API validates required collect values
|
|
767
814
|
# @param signer_access_code [String]
|
|
768
|
-
# @return [Hash]
|
|
815
|
+
# @return [Hash] signing result; staging returns the signer's assignment with only their items,
|
|
816
|
+
# without signing URLs or other parties' contact details and government IDs
|
|
769
817
|
# @raise [Assinafy::ApiError] on an unsuccessful API response
|
|
770
818
|
# @raise [Assinafy::NetworkError] on transport or TLS failure
|
|
771
819
|
# @raise [Assinafy::ValidationError] on invalid required input
|
|
@@ -778,11 +826,14 @@ module Assinafy
|
|
|
778
826
|
# # Request body the SDK sends (snake_case keys mapped to camelCase):
|
|
779
827
|
# # [{ "itemId" => "assignment-item-id", "fieldId" => "field-id",
|
|
780
828
|
# # "pageId" => "page-id", "value" => "Signed by Example Signer" }]
|
|
781
|
-
# # => {
|
|
829
|
+
# # => { 'resource' => 'assignment', 'id' => 'assignment-id', 'document_id' => 'document-id',
|
|
830
|
+
# # 'method' => 'collect', 'items' => [{ 'id' => 'assignment-item-id', 'completed' => true, ... }], ... }
|
|
782
831
|
def sign(document_id, assignment_id, items, signer_access_code:)
|
|
783
832
|
doc_id = require_id(document_id, 'Document ID')
|
|
784
833
|
asg_id = require_id(assignment_id, 'Assignment ID')
|
|
785
|
-
|
|
834
|
+
raise ValidationError.new('Assignment items must be an Array') unless items.is_a?(Array)
|
|
835
|
+
|
|
836
|
+
body = items.map { |item| normalise_sign_item(item) }
|
|
786
837
|
access_code = require_signer_access_code(signer_access_code)
|
|
787
838
|
|
|
788
839
|
call('Failed to sign assignment') do
|
|
@@ -870,7 +921,7 @@ module Assinafy
|
|
|
870
921
|
%w[itemId fieldId pageId].each do |key|
|
|
871
922
|
require_id(normalised[key], "Assignment item #{key}")
|
|
872
923
|
end
|
|
873
|
-
value =
|
|
924
|
+
value = normalised['value']
|
|
874
925
|
raise ValidationError.new('Assignment item value must be a String') unless value.is_a?(String)
|
|
875
926
|
|
|
876
927
|
normalised
|
|
@@ -917,6 +917,77 @@ module Assinafy
|
|
|
917
917
|
{ signed: signed, total: total, pending: pending, percentage: percentage }
|
|
918
918
|
end
|
|
919
919
|
|
|
920
|
+
# Read the sender's stated signing capacities. Available on staging; requires documents:read.
|
|
921
|
+
# @param document_id [String]
|
|
922
|
+
# @return [Array<Hash>] signer_id and sign_as, or [] before assignment creation
|
|
923
|
+
# @raise [ValidationError] on an invalid ID
|
|
924
|
+
# @raise [ApiError, NetworkError] on API or transport failure
|
|
925
|
+
# @see GET /documents/{documentId}/signer-capacities
|
|
926
|
+
# @example
|
|
927
|
+
# client.documents.signer_capacities('document-id') # GET; no body
|
|
928
|
+
# # => [{ 'signer_id' => 'signer-id', 'sign_as' => 'Witness' }]
|
|
929
|
+
def signer_capacities(document_id)
|
|
930
|
+
id = require_id(document_id, 'Document ID')
|
|
931
|
+
call_array('Failed to read signer capacities') { http_get("documents/#{id}/signer-capacities") }
|
|
932
|
+
end
|
|
933
|
+
|
|
934
|
+
# Read invitation delivery/open timestamps. Opens are hints, not proof a person read the message.
|
|
935
|
+
# Available on staging; requires documents:read.
|
|
936
|
+
# @param document_id [String]
|
|
937
|
+
# @return [Array<Hash>] signer_id and notification_history, or [] before assignment creation
|
|
938
|
+
# @raise [ValidationError] on an invalid ID
|
|
939
|
+
# @raise [ApiError, NetworkError] on API or transport failure
|
|
940
|
+
# @see GET /documents/{documentId}/notification-history
|
|
941
|
+
# @example
|
|
942
|
+
# client.documents.notification_history('document-id') # GET; no body
|
|
943
|
+
# # => [{ 'signer_id' => 'signer-id', 'notification_history' => [{ 'event' => 'signature_request',
|
|
944
|
+
# # 'status' => 'sent', 'error_code' => nil, 'error_message' => nil, 'failed_at' => nil,
|
|
945
|
+
# # 'sent_at' => '2026-12-01T12:00:00Z', 'delivered_at' => nil, 'opened_at' => nil }] }]
|
|
946
|
+
def notification_history(document_id)
|
|
947
|
+
id = require_id(document_id, 'Document ID')
|
|
948
|
+
call_array('Failed to read notification history') { http_get("documents/#{id}/notification-history") }
|
|
949
|
+
end
|
|
950
|
+
|
|
951
|
+
# Read contacts following this document without signing. Available on staging; requires documents:read.
|
|
952
|
+
# @param document_id [String]
|
|
953
|
+
# @return [Array<Hash>] Signer objects, in configured order, excluding deleted contacts
|
|
954
|
+
# @raise [ValidationError] on an invalid ID
|
|
955
|
+
# @raise [ApiError, NetworkError] on API or transport failure
|
|
956
|
+
# @see GET /documents/{documentId}/watchers
|
|
957
|
+
# @example
|
|
958
|
+
# client.documents.watchers('document-id') # GET; no body
|
|
959
|
+
# # => [{ 'id' => 'contact-id', 'full_name' => 'Example Watcher', 'email' => 'watcher@example.com',
|
|
960
|
+
# # 'whatsapp_phone_number' => nil, 'government_id' => nil, 'has_accepted_terms' => false }]
|
|
961
|
+
def watchers(document_id)
|
|
962
|
+
id = require_id(document_id, 'Document ID')
|
|
963
|
+
call_array('Failed to read document watchers') { http_get("documents/#{id}/watchers") }
|
|
964
|
+
end
|
|
965
|
+
|
|
966
|
+
# Replace watchers before a document ends. They receive a completion/decline/expiry email without a file/link.
|
|
967
|
+
# Available on staging; requires documents:write. Workspace notification policy does not suppress these emails.
|
|
968
|
+
# @param document_id [String]
|
|
969
|
+
# @param watcher_ids [Array<String>] at most ten workspace contact IDs with email; [] clears all
|
|
970
|
+
# @return [Array<Hash>] Signer objects, as returned by watchers
|
|
971
|
+
# @raise [ValidationError] on invalid IDs or list shape
|
|
972
|
+
# @raise [ApiError, NetworkError] on API or transport failure
|
|
973
|
+
# @see PUT /documents/{documentId}/watchers
|
|
974
|
+
# @example
|
|
975
|
+
# client.documents.set_watchers('document-id', ['contact-id'])
|
|
976
|
+
# # PUT body: { "watcher_ids": ["contact-id"] }
|
|
977
|
+
# # => [{ 'id' => 'contact-id', 'full_name' => 'Example Watcher', 'email' => 'watcher@example.com',
|
|
978
|
+
# # 'whatsapp_phone_number' => nil, 'government_id' => nil, 'has_accepted_terms' => false }]
|
|
979
|
+
def set_watchers(document_id, watcher_ids)
|
|
980
|
+
id = require_id(document_id, 'Document ID')
|
|
981
|
+
unless watcher_ids.is_a?(Array) && watcher_ids.length <= 10
|
|
982
|
+
raise ValidationError.new('watcher_ids must be an Array with at most ten contacts')
|
|
983
|
+
end
|
|
984
|
+
|
|
985
|
+
watcher_ids.each { |watcher| require_id(watcher, 'Watcher ID') }
|
|
986
|
+
call_array('Failed to set document watchers') do
|
|
987
|
+
http_put("documents/#{id}/watchers", { 'watcher_ids' => watcher_ids })
|
|
988
|
+
end
|
|
989
|
+
end
|
|
990
|
+
|
|
920
991
|
private
|
|
921
992
|
|
|
922
993
|
def document_expansions(expand)
|
|
@@ -68,6 +68,39 @@ module Assinafy
|
|
|
68
68
|
call('Failed to estimate envelope cost') { http_post(path, body) }
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
+
# Schedule an envelope; no invitations or charges occur until it is sent. Requires documents:write.
|
|
72
|
+
# Available on staging; the environment must publish scheduled sends. No idempotency header is supported.
|
|
73
|
+
# @param payload [Hash] the same EnvelopeCreateRequest as create
|
|
74
|
+
# @param account_id_override [String, nil]
|
|
75
|
+
# @param send_at [String, Integer] from one hour to 90 days ahead; absent offset means UTC
|
|
76
|
+
# @return [Hash] ScheduledSend; each deadline must be at least two hours after send_at
|
|
77
|
+
# @raise [ValidationError] on invalid payload, IDs or timing
|
|
78
|
+
# @raise [ApiError, NetworkError] on API or transport failure
|
|
79
|
+
# @see POST /accounts/{accountId}/scheduled-sends
|
|
80
|
+
# @example
|
|
81
|
+
# client.envelopes.schedule({ name: 'Contract', signers: [{ id: 'signer-id' }],
|
|
82
|
+
# documents: [{ id: 'document-id', signer_ids: ['signer-id'] }] }, send_at: (Time.now + 7200).to_i)
|
|
83
|
+
# # POST body: { "name": "Contract", "signers": [{ "id": "signer-id" }],
|
|
84
|
+
# # "documents": [{ "id": "document-id", "signer_ids": ["signer-id"] }], "send_at": 1796126400 }
|
|
85
|
+
# # => { 'resource' => 'scheduled_send', 'id' => 'send-id', 'type' => 'envelope',
|
|
86
|
+
# # 'document_ids' => ['document-id'], 'status' => 'pending', 'send_at' => '2026-12-01T12:00:00Z',
|
|
87
|
+
# # 'assignment_id' => nil, 'envelope_id' => nil, 'failure_reason' => nil,
|
|
88
|
+
# # 'created_at' => '2026-12-01T10:00:00Z', 'processed_at' => nil }
|
|
89
|
+
def schedule(payload, account_id_override = nil, send_at:)
|
|
90
|
+
time = ScheduledSendResource.require_send_at(send_at)
|
|
91
|
+
raw = body_params(require_payload(payload))
|
|
92
|
+
raw['documents'] = require_array(raw['documents'], 'documents').map do |document|
|
|
93
|
+
entry = require_payload(document, 'Envelope document').dup
|
|
94
|
+
if entry.key?('expires_at')
|
|
95
|
+
entry['expires_at'] = ScheduledSendResource.scheduled_expiration(entry['expires_at'], time)
|
|
96
|
+
end
|
|
97
|
+
entry
|
|
98
|
+
end
|
|
99
|
+
body = create_payload(raw).merge('send_at' => send_at)
|
|
100
|
+
path = "accounts/#{account_id(account_id_override)}/scheduled-sends"
|
|
101
|
+
call('Failed to schedule envelope') { http_post(path, body) }
|
|
102
|
+
end
|
|
103
|
+
|
|
71
104
|
# @param envelope_id [String]
|
|
72
105
|
# @param account_id_override [String, nil]
|
|
73
106
|
# @return [Hash] DocumentEnvelope (see create for its complete shape)
|
|
@@ -187,6 +220,23 @@ module Assinafy
|
|
|
187
220
|
call('Failed to resend envelope invitation') { http_put(path) }
|
|
188
221
|
end
|
|
189
222
|
|
|
223
|
+
# Estimate one reminder for the whole envelope without sending or charging. Available on staging.
|
|
224
|
+
# @param envelope_id [String]
|
|
225
|
+
# @param signer_id [String]
|
|
226
|
+
# @param account_id_override [String, nil]
|
|
227
|
+
# @return [Hash] ResendCostEstimate; does not check reminder timing eligibility
|
|
228
|
+
# @raise [ValidationError] on invalid IDs
|
|
229
|
+
# @raise [ApiError, NetworkError] on API or transport failure
|
|
230
|
+
# @see POST /accounts/{accountId}/envelopes/{envelopeId}/signers/{signerId}/estimate-resend-cost
|
|
231
|
+
# @example
|
|
232
|
+
# client.envelopes.estimate_resend_cost('envelope-id', 'signer-id') # POST; no body
|
|
233
|
+
# # => { 'total' => 0, 'breakdown' => [], 'credit_balance' => 100, 'has_sufficient_credits' => true }
|
|
234
|
+
def estimate_resend_cost(envelope_id, signer_id, account_id_override = nil)
|
|
235
|
+
sid = require_id(signer_id, 'Signer ID')
|
|
236
|
+
path = "#{envelope_path(envelope_id, account_id_override)}/signers/#{sid}/estimate-resend-cost"
|
|
237
|
+
call('Failed to estimate envelope reminder cost') { http_post(path) }
|
|
238
|
+
end
|
|
239
|
+
|
|
190
240
|
# @param envelope_id [String]
|
|
191
241
|
# @param payload [Hash] EnvelopeDocumentRequest plus optional max_total_credits
|
|
192
242
|
# @param account_id_override [String, nil]
|
|
@@ -201,7 +201,7 @@ module Assinafy
|
|
|
201
201
|
end
|
|
202
202
|
end
|
|
203
203
|
|
|
204
|
-
# Validate a single value against a field definition.
|
|
204
|
+
# Validate a single value against a field definition, preserving nil as JSON null.
|
|
205
205
|
#
|
|
206
206
|
# Workspace authorization is used when `signer_access_code:` is omitted.
|
|
207
207
|
# When the keyword is given it must be a non-blank code, and
|
|
@@ -230,17 +230,16 @@ module Assinafy
|
|
|
230
230
|
def validate(field_id, value, account_id_override = nil, signer_access_code: WORKSPACE)
|
|
231
231
|
acc_id = account_id(account_id_override)
|
|
232
232
|
fid = require_id(field_id, 'Field ID')
|
|
233
|
-
raise ValidationError.new('Field value is required') if value.nil?
|
|
234
233
|
|
|
235
234
|
access_code = field_access_code(signer_access_code)
|
|
236
235
|
|
|
237
236
|
call('Failed to validate field value') do
|
|
238
|
-
http_post("accounts/#{acc_id}/fields/#{fid}/validate",
|
|
237
|
+
http_post("accounts/#{acc_id}/fields/#{fid}/validate", { 'value' => value },
|
|
239
238
|
{ signer_access_code: access_code }, workspace_auth: access_code.nil?)
|
|
240
239
|
end
|
|
241
240
|
end
|
|
242
241
|
|
|
243
|
-
# Validate many `{ field_id:, value: }` pairs in a single call.
|
|
242
|
+
# Validate many `{ field_id:, value: }` pairs in a single call. Explicit nil values remain JSON null.
|
|
244
243
|
#
|
|
245
244
|
# As with {#validate}, omitting `signer_access_code:` uses the workspace
|
|
246
245
|
# credentials; giving it requires a non-blank code and sends only the code.
|
|
@@ -330,11 +329,11 @@ module Assinafy
|
|
|
330
329
|
value_key = payload.key?(:value) ? :value : 'value'
|
|
331
330
|
|
|
332
331
|
require_id(field_id, 'Field ID')
|
|
333
|
-
unless payload.key?(value_key)
|
|
332
|
+
unless payload.key?(value_key)
|
|
334
333
|
raise ValidationError.new('Field value is required')
|
|
335
334
|
end
|
|
336
335
|
|
|
337
|
-
body_params(payload)
|
|
336
|
+
body_params(payload).merge('value' => payload[value_key])
|
|
338
337
|
end
|
|
339
338
|
end
|
|
340
339
|
end
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Assinafy
|
|
4
|
+
module Resources
|
|
5
|
+
# Pending assignment/envelope requests. Available on staging; all operations require documents:write.
|
|
6
|
+
class ScheduledSendResource < BaseResource
|
|
7
|
+
class << self
|
|
8
|
+
# Validate the delivery window for a scheduled request.
|
|
9
|
+
# @param value [String, Integer] ISO 8601 timestamp (no offset means UTC), or Unix seconds
|
|
10
|
+
# @return [Time] the scheduled instant, from one hour to 90 days ahead
|
|
11
|
+
# @raise [ValidationError] on an invalid timestamp or delivery window
|
|
12
|
+
# @example
|
|
13
|
+
# Assinafy::Resources::ScheduledSendResource.require_send_at((Time.now + 7200).to_i) # => Time two hours ahead
|
|
14
|
+
def require_send_at(value)
|
|
15
|
+
time = schedule_time(value, 'send_at')
|
|
16
|
+
now = Time.now
|
|
17
|
+
unless time.between?(now + 3600, now + (90 * 86_400))
|
|
18
|
+
raise ValidationError.new('send_at must be from one hour to 90 days ahead')
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
time
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Normalize a scheduled deadline for the ordinary assignment validators.
|
|
25
|
+
# @param value [String, Integer, nil] ISO 8601 timestamp or Unix seconds; nil means no deadline
|
|
26
|
+
# @param send_time [Time] validated send_at instant
|
|
27
|
+
# @return [String, nil] zoned ISO 8601 deadline, at least two hours after send_at
|
|
28
|
+
# @raise [ValidationError] on an invalid deadline
|
|
29
|
+
# @example
|
|
30
|
+
# Assinafy::Resources::ScheduledSendResource.scheduled_expiration(nil, Time.now + 7200) # => nil
|
|
31
|
+
def scheduled_expiration(value, send_time)
|
|
32
|
+
return nil if value.nil?
|
|
33
|
+
|
|
34
|
+
time = schedule_time(value, 'expires_at')
|
|
35
|
+
raise ValidationError.new('expires_at must be at least two hours after send_at') if time < send_time + 7200
|
|
36
|
+
|
|
37
|
+
return time.utc.iso8601 if value.is_a?(Integer)
|
|
38
|
+
|
|
39
|
+
value.match?(/(?:Z|[+-]\d{2}:\d{2})\z/) ? value : "#{value}Z"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
def schedule_time(value, name)
|
|
45
|
+
return Time.at(value).utc if value.is_a?(Integer)
|
|
46
|
+
if value.is_a?(String) && value.match?(/\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?
|
|
47
|
+
(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)?\z/x)
|
|
48
|
+
return DateTime.iso8601(value).to_time
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
raise ArgumentError
|
|
52
|
+
rescue ArgumentError, RangeError
|
|
53
|
+
raise ValidationError.new("#{name} must be an ISO 8601 timestamp or Unix seconds")
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# @param params [Hash] document_id, page and per_page
|
|
58
|
+
# @param account_id_override [String, nil]
|
|
59
|
+
# @return [Hash] paginated ScheduledSend objects, newest first, including terminal states
|
|
60
|
+
# @raise [ValidationError] on invalid IDs or filters
|
|
61
|
+
# @raise [ApiError, NetworkError] on API or transport failure
|
|
62
|
+
# @see GET /accounts/{accountId}/scheduled-sends
|
|
63
|
+
# @example
|
|
64
|
+
# client.scheduled_sends.list(document_id: 'document-id', per_page: 20)
|
|
65
|
+
# # GET .../scheduled-sends?document_id=document-id&per-page=20; no body
|
|
66
|
+
# # => { data: [{ 'resource' => 'scheduled_send', 'id' => 'send-id', 'type' => 'assignment',
|
|
67
|
+
# # 'document_ids' => ['document-id'], 'status' => 'pending', 'send_at' => '2026-12-01T12:00:00Z',
|
|
68
|
+
# # 'assignment_id' => nil, 'envelope_id' => nil, 'failure_reason' => nil,
|
|
69
|
+
# # 'created_at' => '2026-12-01T10:00:00Z', 'processed_at' => nil }],
|
|
70
|
+
# # meta: { current_page: 1, per_page: 20, total: 1, last_page: 1 } }
|
|
71
|
+
def list(params = {}, account_id_override = nil)
|
|
72
|
+
query = query_params(params)
|
|
73
|
+
require_id(query['document_id'], 'Document ID') if query.key?('document_id')
|
|
74
|
+
path = "accounts/#{account_id(account_id_override)}/scheduled-sends"
|
|
75
|
+
call_list('Failed to list scheduled sends') { http_get(path, query) }
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Cancel a pending send without sending or charging. Other states answer 409.
|
|
79
|
+
# @param scheduled_send_id [String]
|
|
80
|
+
# @param account_id_override [String, nil]
|
|
81
|
+
# @return [Hash] ScheduledSend, now cancelled
|
|
82
|
+
# @raise [ValidationError] on invalid IDs
|
|
83
|
+
# @raise [ApiError, NetworkError] on API or transport failure
|
|
84
|
+
# @see PUT /accounts/{accountId}/scheduled-sends/{scheduledSendId}/cancel
|
|
85
|
+
# @example
|
|
86
|
+
# client.scheduled_sends.cancel('send-id') # PUT; no body
|
|
87
|
+
# # => { 'resource' => 'scheduled_send', 'id' => 'send-id', 'type' => 'assignment',
|
|
88
|
+
# # 'document_ids' => ['document-id'], 'status' => 'cancelled', 'send_at' => '2026-12-01T12:00:00Z',
|
|
89
|
+
# # 'assignment_id' => nil, 'envelope_id' => nil, 'failure_reason' => nil,
|
|
90
|
+
# # 'created_at' => '2026-12-01T10:00:00Z', 'processed_at' => '2026-12-01T10:30:00Z' }
|
|
91
|
+
def cancel(scheduled_send_id, account_id_override = nil)
|
|
92
|
+
path = "#{scheduled_send_path(scheduled_send_id, account_id_override)}/cancel"
|
|
93
|
+
call('Failed to cancel scheduled send') { http_put(path) }
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Send a pending request now, with the original member's permissions, balance and credit ceiling.
|
|
97
|
+
# A refused request stays pending; cancel it to prevent a later scheduled attempt. Never retries.
|
|
98
|
+
# @param scheduled_send_id [String]
|
|
99
|
+
# @param account_id_override [String, nil]
|
|
100
|
+
# @return [Hash] ScheduledSend, now sent, with assignment_id or envelope_id
|
|
101
|
+
# @raise [ValidationError] on invalid IDs
|
|
102
|
+
# @raise [ApiError, NetworkError] on API or transport failure, including 409 for a non-pending send
|
|
103
|
+
# @see PUT /accounts/{accountId}/scheduled-sends/{scheduledSendId}/send
|
|
104
|
+
# @example
|
|
105
|
+
# client.scheduled_sends.send_now('send-id') # PUT; no body
|
|
106
|
+
# # => { 'resource' => 'scheduled_send', 'id' => 'send-id', 'type' => 'assignment',
|
|
107
|
+
# # 'document_ids' => ['document-id'], 'status' => 'sent', 'send_at' => '2026-12-01T12:00:00Z',
|
|
108
|
+
# # 'assignment_id' => 'assignment-id', 'envelope_id' => nil, 'failure_reason' => nil,
|
|
109
|
+
# # 'created_at' => '2026-12-01T10:00:00Z', 'processed_at' => '2026-12-01T10:30:00Z' }
|
|
110
|
+
def send_now(scheduled_send_id, account_id_override = nil)
|
|
111
|
+
path = "#{scheduled_send_path(scheduled_send_id, account_id_override)}/send"
|
|
112
|
+
call('Failed to send scheduled request') { http_put(path) }
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
private
|
|
116
|
+
|
|
117
|
+
def scheduled_send_path(send_id, override)
|
|
118
|
+
"accounts/#{account_id(override)}/scheduled-sends/#{require_id(send_id, 'Scheduled send ID')}"
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
@@ -142,14 +142,15 @@ module Assinafy
|
|
|
142
142
|
# `email` or `whatsapp_phone_number` is rejected while that channel is
|
|
143
143
|
# verified on an in-flight document; changing an unverified channel rotates
|
|
144
144
|
# its access and verification codes.
|
|
145
|
+
# Explicit nil or empty String clears email, WhatsApp number or government ID.
|
|
145
146
|
#
|
|
146
147
|
# @param signer_id [String]
|
|
147
148
|
# @param payload [Hash]
|
|
148
149
|
# @option payload [String] :full_name
|
|
149
|
-
# @option payload [String] :email
|
|
150
|
-
# @option payload [String] :whatsapp_phone_number E.164; normalized on save
|
|
151
|
-
# @option payload [String] :phone alias for `:whatsapp_phone_number`
|
|
152
|
-
# @option payload [String] :government_id CPF (digits) or CNPJ (may be alphanumeric); normalized on save
|
|
150
|
+
# @option payload [String, nil] :email
|
|
151
|
+
# @option payload [String, nil] :whatsapp_phone_number E.164; normalized on save
|
|
152
|
+
# @option payload [String, nil] :phone alias for `:whatsapp_phone_number`
|
|
153
|
+
# @option payload [String, nil] :government_id CPF (digits) or CNPJ (may be alphanumeric); normalized on save
|
|
153
154
|
# @param account_id_override [String, nil]
|
|
154
155
|
# @return [Hash] updated signer object (envelope `data` unwrapped)
|
|
155
156
|
# @raise [Assinafy::ApiError] on an unsuccessful API response
|
|
@@ -391,6 +392,7 @@ module Assinafy
|
|
|
391
392
|
|
|
392
393
|
# Confirm the contact used by the assignment and optionally accept terms. Certificate signers
|
|
393
394
|
# must do both before opening GET /sign. Existing additional payload fields are passed through.
|
|
395
|
+
# Only email, whatsapp_phone_number and has_accepted_terms are read by the API.
|
|
394
396
|
#
|
|
395
397
|
# @param document_id [String]
|
|
396
398
|
# @param payload [Hash] email, whatsapp_phone_number and has_accepted_terms
|
|
@@ -555,7 +557,7 @@ module Assinafy
|
|
|
555
557
|
full_name = signer_full_name(p, require_full_name)
|
|
556
558
|
|
|
557
559
|
email = p['email']
|
|
558
|
-
assert_email!(email) unless email.nil?
|
|
560
|
+
assert_email!(email) unless email.nil? || (!require_full_name && email == '')
|
|
559
561
|
|
|
560
562
|
phone = signer_phone(p)
|
|
561
563
|
|
|
@@ -566,6 +568,15 @@ module Assinafy
|
|
|
566
568
|
)
|
|
567
569
|
government_id = signer_government_id(p)
|
|
568
570
|
body['government_id'] = government_id unless government_id.nil?
|
|
571
|
+
require_full_name ? body : signer_update_payload(p, body)
|
|
572
|
+
end
|
|
573
|
+
|
|
574
|
+
def signer_update_payload(p, body)
|
|
575
|
+
p['whatsapp_phone_number'] = p['phone'] if !p.key?('whatsapp_phone_number') && p.key?('phone')
|
|
576
|
+
%w[email whatsapp_phone_number government_id].each do |key|
|
|
577
|
+
body[key] = nil if p.key?(key) && p[key].nil?
|
|
578
|
+
end
|
|
579
|
+
require_string(body['full_name'], 'Full name') if p.key?('full_name') || p.key?('name')
|
|
569
580
|
body
|
|
570
581
|
end
|
|
571
582
|
|
data/lib/assinafy/version.rb
CHANGED
data/lib/assinafy.rb
CHANGED
|
@@ -22,6 +22,7 @@ require_relative 'assinafy/resources/signer_resource'
|
|
|
22
22
|
require_relative 'assinafy/resources/signer_document_resource'
|
|
23
23
|
require_relative 'assinafy/resources/assignment_resource'
|
|
24
24
|
require_relative 'assinafy/resources/envelope_resource'
|
|
25
|
+
require_relative 'assinafy/resources/scheduled_send_resource'
|
|
25
26
|
require_relative 'assinafy/resources/webhook_resource'
|
|
26
27
|
require_relative 'assinafy/resources/template_resource'
|
|
27
28
|
require_relative 'assinafy/resources/field_resource'
|
data/sig/assinafy.rbs
CHANGED
|
@@ -291,11 +291,17 @@ module Assinafy
|
|
|
291
291
|
def replace_tags: (String document_id, Array[String] tags, ?String? account_id_override) -> Array[api_object]
|
|
292
292
|
def append_tags: (String document_id, Array[String] tags, ?String? account_id_override) -> Array[api_object]
|
|
293
293
|
def detach_tag: (String document_id, String tag_id, ?String? account_id_override) -> api_object
|
|
294
|
+
def signer_capacities: (String document_id) -> Array[api_object]
|
|
295
|
+
def notification_history: (String document_id) -> Array[api_object]
|
|
296
|
+
def watchers: (String document_id) -> Array[api_object]
|
|
297
|
+
def set_watchers: (String document_id, Array[String] watcher_ids) -> Array[api_object]
|
|
294
298
|
def fully_signed?: (String document_id) -> bool
|
|
295
299
|
def signing_progress: (String document_id) -> signing_progress
|
|
296
300
|
end
|
|
297
301
|
|
|
298
302
|
class EnvelopeResource < BaseResource
|
|
303
|
+
def schedule: (params payload, ?String? account_id_override, send_at: String | Integer) -> api_object
|
|
304
|
+
def estimate_resend_cost: (String envelope_id, String signer_id, ?String? account_id_override) -> api_object
|
|
299
305
|
def list: (?params params, ?String? account_id_override) -> list_result
|
|
300
306
|
def create: (params payload, ?String? account_id_override, ?idempotency_key: String?) -> api_object
|
|
301
307
|
def estimate_cost: (params payload, ?String? account_id_override) -> api_object
|
|
@@ -310,6 +316,14 @@ module Assinafy
|
|
|
310
316
|
def remove_document: (String envelope_id, String document_id, ?String? account_id_override) -> api_object
|
|
311
317
|
end
|
|
312
318
|
|
|
319
|
+
class ScheduledSendResource < BaseResource
|
|
320
|
+
def self.require_send_at: (String | Integer value) -> Time
|
|
321
|
+
def self.scheduled_expiration: (String | Integer | nil value, Time send_time) -> String?
|
|
322
|
+
def list: (?params params, ?String? account_id_override) -> list_result
|
|
323
|
+
def cancel: (String scheduled_send_id, ?String? account_id_override) -> api_object
|
|
324
|
+
def send_now: (String scheduled_send_id, ?String? account_id_override) -> api_object
|
|
325
|
+
end
|
|
326
|
+
|
|
313
327
|
class ContractResource < BaseResource
|
|
314
328
|
STATUSES: Array[String]
|
|
315
329
|
RELATION_TYPES: Array[String]
|
|
@@ -381,6 +395,8 @@ module Assinafy
|
|
|
381
395
|
end
|
|
382
396
|
|
|
383
397
|
class AssignmentResource < BaseResource
|
|
398
|
+
SIGNER_CAPACITIES: Array[String]
|
|
399
|
+
def schedule: (String document_id, params payload, send_at: String | Integer) -> api_object
|
|
384
400
|
OPTIONAL_FIELDS: Array[Symbol]
|
|
385
401
|
METHODS: Array[String]
|
|
386
402
|
VERIFICATION_METHODS: Array[String]
|
|
@@ -502,6 +518,7 @@ module Assinafy
|
|
|
502
518
|
attr_reader accounts: Resources::AccountResource
|
|
503
519
|
attr_reader users: Resources::UserResource
|
|
504
520
|
attr_reader documents: Resources::DocumentResource
|
|
521
|
+
attr_reader scheduled_sends: Resources::ScheduledSendResource
|
|
505
522
|
attr_reader envelopes: Resources::EnvelopeResource
|
|
506
523
|
attr_reader contracts: Resources::ContractResource
|
|
507
524
|
attr_reader signers: Resources::SignerResource
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: assinafy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Assinafy SDK Contributors
|
|
@@ -134,8 +134,9 @@ dependencies:
|
|
|
134
134
|
- !ruby/object:Gem::Version
|
|
135
135
|
version: '3.0'
|
|
136
136
|
description: Ruby SDK for Assinafy. Covers the documented authentication, OAuth 2.1,
|
|
137
|
-
account, user, document, contract, signer, assignment,
|
|
138
|
-
field APIs, plus the high-level upload_and_request_signatures
|
|
137
|
+
account, user, document, envelope, contract, signer, assignment, scheduled-send,
|
|
138
|
+
webhook, template, tag, and field APIs, plus the high-level upload_and_request_signatures
|
|
139
|
+
helper.
|
|
139
140
|
email:
|
|
140
141
|
- sdk@assinafy.com.br
|
|
141
142
|
executables: []
|
|
@@ -162,6 +163,7 @@ files:
|
|
|
162
163
|
- lib/assinafy/resources/envelope_resource.rb
|
|
163
164
|
- lib/assinafy/resources/field_resource.rb
|
|
164
165
|
- lib/assinafy/resources/oauth_resource.rb
|
|
166
|
+
- lib/assinafy/resources/scheduled_send_resource.rb
|
|
165
167
|
- lib/assinafy/resources/signer_document_resource.rb
|
|
166
168
|
- lib/assinafy/resources/signer_resource.rb
|
|
167
169
|
- lib/assinafy/resources/tag_resource.rb
|