didit-sdk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +25 -0
  3. data/LICENSE +21 -0
  4. data/README.md +277 -0
  5. data/lib/didit/authentication/base64_url.rb +34 -0
  6. data/lib/didit/authentication/cache.rb +201 -0
  7. data/lib/didit/authentication/http.rb +150 -0
  8. data/lib/didit/authentication/issuer.rb +115 -0
  9. data/lib/didit/authentication/jws.rb +231 -0
  10. data/lib/didit/authentication/key_set.rb +89 -0
  11. data/lib/didit/authentication/pkce.rb +64 -0
  12. data/lib/didit/authentication/types.rb +175 -0
  13. data/lib/didit/authentication.rb +546 -0
  14. data/lib/didit/client.rb +211 -0
  15. data/lib/didit/errors.rb +153 -0
  16. data/lib/didit/file_part.rb +85 -0
  17. data/lib/didit/internal/config.rb +94 -0
  18. data/lib/didit/internal/errors.rb +83 -0
  19. data/lib/didit/internal/log.rb +41 -0
  20. data/lib/didit/internal/multipart.rb +60 -0
  21. data/lib/didit/internal/request.rb +322 -0
  22. data/lib/didit/internal/transport.rb +198 -0
  23. data/lib/didit/internal/util.rb +76 -0
  24. data/lib/didit/internal.rb +15 -0
  25. data/lib/didit/model.rb +199 -0
  26. data/lib/didit/page.rb +130 -0
  27. data/lib/didit/raw_response.rb +57 -0
  28. data/lib/didit/resource.rb +15 -0
  29. data/lib/didit/resources/account.rb +309 -0
  30. data/lib/didit/resources/address_validation.rb +73 -0
  31. data/lib/didit/resources/age_estimation.rb +110 -0
  32. data/lib/didit/resources/aml.rb +166 -0
  33. data/lib/didit/resources/aml_monitoring.rb +30 -0
  34. data/lib/didit/resources/analytics.rb +87 -0
  35. data/lib/didit/resources/bank.rb +65 -0
  36. data/lib/didit/resources/billing.rb +61 -0
  37. data/lib/didit/resources/biometric_templates.rb +234 -0
  38. data/lib/didit/resources/blocklist.rb +130 -0
  39. data/lib/didit/resources/business_sessions.rb +29 -0
  40. data/lib/didit/resources/businesses.rb +471 -0
  41. data/lib/didit/resources/cases.rb +2116 -0
  42. data/lib/didit/resources/customization.rb +153 -0
  43. data/lib/didit/resources/database_validation.rb +327 -0
  44. data/lib/didit/resources/document_ai.rb +145 -0
  45. data/lib/didit/resources/email.rb +254 -0
  46. data/lib/didit/resources/face_match.rb +103 -0
  47. data/lib/didit/resources/face_search.rb +103 -0
  48. data/lib/didit/resources/fraud_checks.rb +130 -0
  49. data/lib/didit/resources/id_verification.rb +163 -0
  50. data/lib/didit/resources/id_wallets.rb +1468 -0
  51. data/lib/didit/resources/investigator.rb +419 -0
  52. data/lib/didit/resources/ip.rb +68 -0
  53. data/lib/didit/resources/kyb.rb +256 -0
  54. data/lib/didit/resources/lists.rb +332 -0
  55. data/lib/didit/resources/monitoring_events.rb +466 -0
  56. data/lib/didit/resources/networks.rb +427 -0
  57. data/lib/didit/resources/passive_liveness.rb +103 -0
  58. data/lib/didit/resources/phone.rb +271 -0
  59. data/lib/didit/resources/pricing.rb +40 -0
  60. data/lib/didit/resources/proof_of_address.rb +167 -0
  61. data/lib/didit/resources/questionnaires.rb +170 -0
  62. data/lib/didit/resources/regulatory_reports.rb +314 -0
  63. data/lib/didit/resources/report_templates.rb +146 -0
  64. data/lib/didit/resources/sessions.rb +2820 -0
  65. data/lib/didit/resources/transactions.rb +981 -0
  66. data/lib/didit/resources/travel_rule.rb +1202 -0
  67. data/lib/didit/resources/users.rb +521 -0
  68. data/lib/didit/resources/wallet_screening.rb +190 -0
  69. data/lib/didit/resources/webhooks.rb +396 -0
  70. data/lib/didit/resources/workflows.rb +214 -0
  71. data/lib/didit/resources.rb +263 -0
  72. data/lib/didit/types/account.rb +11 -0
  73. data/lib/didit/types/account_components.rb +105 -0
  74. data/lib/didit/types/address_validation.rb +8 -0
  75. data/lib/didit/types/age_estimation.rb +89 -0
  76. data/lib/didit/types/aml.rb +193 -0
  77. data/lib/didit/types/aml_monitoring.rb +73 -0
  78. data/lib/didit/types/analytics.rb +62 -0
  79. data/lib/didit/types/bank.rb +8 -0
  80. data/lib/didit/types/billing.rb +18 -0
  81. data/lib/didit/types/biometric_templates.rb +292 -0
  82. data/lib/didit/types/blocklist.rb +31 -0
  83. data/lib/didit/types/businesses.rb +45 -0
  84. data/lib/didit/types/cases.rb +368 -0
  85. data/lib/didit/types/components.rb +12206 -0
  86. data/lib/didit/types/customization.rb +8 -0
  87. data/lib/didit/types/database_validation.rb +177 -0
  88. data/lib/didit/types/document_ai.rb +135 -0
  89. data/lib/didit/types/email.rb +116 -0
  90. data/lib/didit/types/face_match.rb +93 -0
  91. data/lib/didit/types/face_search.rb +129 -0
  92. data/lib/didit/types/fraud_checks.rb +8 -0
  93. data/lib/didit/types/id_verification.rb +231 -0
  94. data/lib/didit/types/id_wallets.rb +8 -0
  95. data/lib/didit/types/investigator.rb +221 -0
  96. data/lib/didit/types/ip.rb +8 -0
  97. data/lib/didit/types/kyb.rb +1391 -0
  98. data/lib/didit/types/lists.rb +111 -0
  99. data/lib/didit/types/monitoring_events.rb +235 -0
  100. data/lib/didit/types/networks.rb +120 -0
  101. data/lib/didit/types/passive_liveness.rb +95 -0
  102. data/lib/didit/types/phone.rb +69 -0
  103. data/lib/didit/types/proof_of_address.rb +166 -0
  104. data/lib/didit/types/questionnaires.rb +29 -0
  105. data/lib/didit/types/regulatory_reports.rb +100 -0
  106. data/lib/didit/types/report_templates.rb +41 -0
  107. data/lib/didit/types/sessions.rb +1441 -0
  108. data/lib/didit/types/transactions.rb +245 -0
  109. data/lib/didit/types/travel_rule.rb +168 -0
  110. data/lib/didit/types/users.rb +180 -0
  111. data/lib/didit/types/wallet_screening.rb +49 -0
  112. data/lib/didit/types/webhooks.rb +355 -0
  113. data/lib/didit/types/workflows.rb +32 -0
  114. data/lib/didit/types.rb +1681 -0
  115. data/lib/didit/version.rb +5 -0
  116. data/lib/didit/webhooks/canonical_json.rb +187 -0
  117. data/lib/didit/webhooks/client_methods.rb +23 -0
  118. data/lib/didit/webhooks/events.rb +221 -0
  119. data/lib/didit/webhooks/headers.rb +83 -0
  120. data/lib/didit/webhooks/verifier.rb +260 -0
  121. data/lib/didit/webhooks.rb +99 -0
  122. data/lib/didit-sdk.rb +4 -0
  123. data/lib/didit.rb +31 -0
  124. data/sig/didit/authentication/base64_url.rbs +10 -0
  125. data/sig/didit/authentication/cache.rbs +60 -0
  126. data/sig/didit/authentication/http.rbs +37 -0
  127. data/sig/didit/authentication/issuer.rbs +17 -0
  128. data/sig/didit/authentication/jws.rbs +41 -0
  129. data/sig/didit/authentication/jwt.rbs +14 -0
  130. data/sig/didit/authentication/key_set.rbs +25 -0
  131. data/sig/didit/authentication/pkce.rbs +20 -0
  132. data/sig/didit/authentication/types.rbs +114 -0
  133. data/sig/didit/authentication.rbs +81 -0
  134. data/sig/didit/client.rbs +61 -0
  135. data/sig/didit/errors.rbs +80 -0
  136. data/sig/didit/file_part.rbs +19 -0
  137. data/sig/didit/internal.rbs +199 -0
  138. data/sig/didit/model.rbs +42 -0
  139. data/sig/didit/page.rbs +34 -0
  140. data/sig/didit/raw_response.rbs +20 -0
  141. data/sig/didit/resource.rbs +8 -0
  142. data/sig/didit/resources/account.rbs +23 -0
  143. data/sig/didit/resources/address_validation.rbs +9 -0
  144. data/sig/didit/resources/age_estimation.rbs +9 -0
  145. data/sig/didit/resources/aml.rbs +10 -0
  146. data/sig/didit/resources/aml_monitoring.rbs +9 -0
  147. data/sig/didit/resources/analytics.rbs +9 -0
  148. data/sig/didit/resources/bank.rbs +9 -0
  149. data/sig/didit/resources/billing.rbs +10 -0
  150. data/sig/didit/resources/biometric_templates.rbs +13 -0
  151. data/sig/didit/resources/blocklist.rbs +11 -0
  152. data/sig/didit/resources/business_sessions.rbs +9 -0
  153. data/sig/didit/resources/businesses.rbs +22 -0
  154. data/sig/didit/resources/cases.rbs +103 -0
  155. data/sig/didit/resources/customization.rbs +10 -0
  156. data/sig/didit/resources/database_validation.rbs +9 -0
  157. data/sig/didit/resources/document_ai.rbs +9 -0
  158. data/sig/didit/resources/email.rbs +11 -0
  159. data/sig/didit/resources/face_match.rbs +9 -0
  160. data/sig/didit/resources/face_search.rbs +9 -0
  161. data/sig/didit/resources/fraud_checks.rbs +11 -0
  162. data/sig/didit/resources/id_verification.rbs +9 -0
  163. data/sig/didit/resources/id_wallets.rbs +37 -0
  164. data/sig/didit/resources/investigator.rbs +23 -0
  165. data/sig/didit/resources/ip.rbs +9 -0
  166. data/sig/didit/resources/kyb.rbs +12 -0
  167. data/sig/didit/resources/lists.rbs +20 -0
  168. data/sig/didit/resources/monitoring_events.rbs +16 -0
  169. data/sig/didit/resources/networks.rbs +25 -0
  170. data/sig/didit/resources/passive_liveness.rbs +9 -0
  171. data/sig/didit/resources/phone.rbs +11 -0
  172. data/sig/didit/resources/pricing.rbs +9 -0
  173. data/sig/didit/resources/proof_of_address.rbs +9 -0
  174. data/sig/didit/resources/questionnaires.rbs +13 -0
  175. data/sig/didit/resources/regulatory_reports.rbs +16 -0
  176. data/sig/didit/resources/report_templates.rbs +13 -0
  177. data/sig/didit/resources/sessions.rbs +78 -0
  178. data/sig/didit/resources/transactions.rbs +43 -0
  179. data/sig/didit/resources/travel_rule.rbs +62 -0
  180. data/sig/didit/resources/users.rbs +21 -0
  181. data/sig/didit/resources/wallet_screening.rbs +11 -0
  182. data/sig/didit/resources/webhooks.rbs +23 -0
  183. data/sig/didit/resources/workflows.rbs +13 -0
  184. data/sig/didit/resources.rbs +50 -0
  185. data/sig/didit/types/account.rbs +22 -0
  186. data/sig/didit/types/account_components.rbs +94 -0
  187. data/sig/didit/types/address_validation.rbs +7 -0
  188. data/sig/didit/types/age_estimation.rbs +80 -0
  189. data/sig/didit/types/aml.rbs +174 -0
  190. data/sig/didit/types/aml_monitoring.rbs +67 -0
  191. data/sig/didit/types/analytics.rbs +57 -0
  192. data/sig/didit/types/bank.rbs +9 -0
  193. data/sig/didit/types/billing.rbs +19 -0
  194. data/sig/didit/types/biometric_templates.rbs +268 -0
  195. data/sig/didit/types/blocklist.rbs +33 -0
  196. data/sig/didit/types/businesses.rbs +54 -0
  197. data/sig/didit/types/cases.rbs +414 -0
  198. data/sig/didit/types/components.rbs +10920 -0
  199. data/sig/didit/types/customization.rbs +7 -0
  200. data/sig/didit/types/database_validation.rbs +152 -0
  201. data/sig/didit/types/document_ai.rbs +123 -0
  202. data/sig/didit/types/email.rbs +112 -0
  203. data/sig/didit/types/face_match.rbs +86 -0
  204. data/sig/didit/types/face_search.rbs +112 -0
  205. data/sig/didit/types/fraud_checks.rbs +9 -0
  206. data/sig/didit/types/id_verification.rbs +196 -0
  207. data/sig/didit/types/id_wallets.rbs +55 -0
  208. data/sig/didit/types/investigator.rbs +212 -0
  209. data/sig/didit/types/ip.rbs +7 -0
  210. data/sig/didit/types/kyb.rbs +1254 -0
  211. data/sig/didit/types/lists.rbs +106 -0
  212. data/sig/didit/types/monitoring_events.rbs +234 -0
  213. data/sig/didit/types/networks.rbs +113 -0
  214. data/sig/didit/types/passive_liveness.rbs +87 -0
  215. data/sig/didit/types/phone.rbs +65 -0
  216. data/sig/didit/types/proof_of_address.rbs +144 -0
  217. data/sig/didit/types/questionnaires.rbs +30 -0
  218. data/sig/didit/types/regulatory_reports.rbs +101 -0
  219. data/sig/didit/types/report_templates.rbs +42 -0
  220. data/sig/didit/types/sessions.rbs +1349 -0
  221. data/sig/didit/types/transactions.rbs +273 -0
  222. data/sig/didit/types/travel_rule.rbs +188 -0
  223. data/sig/didit/types/users.rbs +181 -0
  224. data/sig/didit/types/wallet_screening.rbs +40 -0
  225. data/sig/didit/types/webhooks.rbs +311 -0
  226. data/sig/didit/types/workflows.rbs +30 -0
  227. data/sig/didit/webhooks/canonical_json.rbs +25 -0
  228. data/sig/didit/webhooks/client_methods.rbs +11 -0
  229. data/sig/didit/webhooks/events.rbs +125 -0
  230. data/sig/didit/webhooks/headers.rbs +22 -0
  231. data/sig/didit/webhooks/verifier.rbs +54 -0
  232. data/sig/didit/webhooks.rbs +37 -0
  233. data/sig/didit.rbs +20 -0
  234. metadata +300 -0
@@ -0,0 +1,254 @@
1
+ # Code generated by codegen from openapi/*.json. DO NOT EDIT.
2
+ # frozen_string_literal: true
3
+
4
+ module Didit
5
+ module Resources
6
+ # The +email+ resource.
7
+ class Email < Didit::Resource
8
+ # Risk-score an email address
9
+ #
10
+ # Return deliverability, disposable-address, breach, cross-session match, and normalized risk-intelligence
11
+ # signals without sending an OTP. The endpoint creates an API session and returns its id as `request_id`.
12
+ #
13
+ # **Decision.** The top-level `status` mirrors `email.status`. It is normally `Approved`; the risk evaluation
14
+ # can produce `In Review` or `Declined`.
15
+ #
16
+ # **Compatibility aliases.** Live responses expose the normalized intelligence object as both
17
+ # `email.email_intelligence` and `email.enrichment`. The values are identical. New integrations can read
18
+ # `email.enrichment`. Both keys are absent when no usable intelligence data was returned.
19
+ #
20
+ # **Billing.** Live calls use Email Risk API pricing. The request is billable once the lookup starts, even when
21
+ # some best-effort fields are unavailable.
22
+ #
23
+ # **Sandbox.** Sandbox keys validate the request and return deterministic approved data without sending an
24
+ # email, consuming credits, creating a session, or contributing to Networks.
25
+ #
26
+ # **Authentication.** Send your application's API key in `x-api-key`. Missing or invalid credentials return
27
+ # `403` - this API never returns `401`.
28
+ #
29
+ # **Rate limit.** Shared write budget of 300 requests per minute per API key across all POST/PATCH/DELETE
30
+ # endpoints.
31
+ #
32
+ # **Social footprint.** Set `enable_social` to `true` to add a `email_social` block: the online platforms this
33
+ # address is registered on, with per-category counts and any profile details available. `profiles_registered: 0`
34
+ # means the platforms were checked and the address was found on none of them - a valid, billable answer. The
35
+ # block is absent when the add-on was not requested or the check could not be completed, and it is not billed in
36
+ # that case. Billing adds one `email_social` unit per request on top of this endpoint's own price.
37
+ #
38
+ # +POST /v3/email/risk/+
39
+ #
40
+ # @param email [String] Email address to score.
41
+ # @param country_code [String] Optional ISO 3166-1 alpha-2 or alpha-3 country hint for intelligence coverage.
42
+ # @param signals [Hash] Optional device and network context observed by your application. All fields are
43
+ # optional. Passing them feeds cross-session match detection in Networks.
44
+ # @param vendor_data [String] Your stable reference for this request. Stored on the API session and echoed in
45
+ # the response.
46
+ # @param metadata [Hash, nil] Your non-sensitive JSON metadata. Stored on the API session and echoed in the
47
+ # response.
48
+ # @param enable_social [Boolean] When true, also look up the social footprint of the address - the email,
49
+ # social, professional, e-commerce and entertainment platforms it is registered on. Billed as one `email_social`
50
+ # unit per request in addition to this endpoint's own price.
51
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
52
+ # @return [Didit::Types::EmailRiskResponse]
53
+ def assess_risk(
54
+ email:,
55
+ country_code: OMIT,
56
+ signals: OMIT,
57
+ vendor_data: OMIT,
58
+ metadata: OMIT,
59
+ enable_social: OMIT,
60
+ request_options: nil
61
+ )
62
+ @client.request(
63
+ :post,
64
+ "/v3/email/risk/",
65
+ body: {
66
+ "email" => email,
67
+ "country_code" => country_code,
68
+ "signals" => signals,
69
+ "vendor_data" => vendor_data,
70
+ "metadata" => metadata,
71
+ "enable_social" => enable_social
72
+ },
73
+ response: Types::EmailRiskResponse,
74
+ request_options: request_options
75
+ )
76
+ end
77
+
78
+ # Check Email Code
79
+ #
80
+ # Verify the OTP delivered by [`POST /v3/email/send/`](/standalone-apis/email-send) and get the final
81
+ # verification result plus email intelligence: deliverability, breach exposure (`is_breached` and the `breaches`
82
+ # list from a breach-intelligence database), disposable-provider detection, and duplicate usage of the address
83
+ # across your sessions.
84
+ #
85
+ # **How the check finds the verification.** Matching is by your application plus the `email` address -
86
+ # `request_id` is not an input. The most recent pending verification created within the last **5 minutes** is
87
+ # checked. If there is none (never sent, already finalized, undeliverable at send time, or older than 5 minutes)
88
+ # the endpoint returns `200` with `status: "Expired or Not Found"`.
89
+ #
90
+ # **Attempt budget.** Each verification allows **3 code attempts**. The first two wrong codes return `status:
91
+ # "Failed"` with the attempts remaining and `email: null`; the third wrong code finalizes the verification as
92
+ # `Declined` with an `EMAIL_CODE_ATTEMPTS_EXCEEDED` warning and returns the full email report. Codes are
93
+ # compared case-insensitively (relevant for `alphanumeric_code` sends); only the most recently sent code is
94
+ # valid.
95
+ #
96
+ # **Outcomes.** `Approved` - correct code and no declining risk. `Declined` - terminal: the code was correct but
97
+ # a declining risk matched (a `DECLINE` action below, a blocklisted address, or the address found undeliverable
98
+ # at finalization), or the attempt budget was exhausted. `Failed` - wrong code, attempts remaining. `Expired or
99
+ # Not Found` - nothing to check. On `Approved`/`Declined` the `request_id` equals the send's `request_id` (the
100
+ # session id) and `email` carries the full report (`is_breached`, `breaches`, `is_disposable`,
101
+ # `is_undeliverable`, `warnings`, `lifecycle`, `matches`); on `Failed` and `Expired or Not Found` the
102
+ # `request_id` is a one-off random UUID.
103
+ #
104
+ # **Risk actions.** `duplicated_email_action`, `breached_email_action`, and `disposable_email_action` decide
105
+ # what happens when the corresponding risk is detected on a correct code: `DECLINE` flips the final status to
106
+ # `Declined`; `NO_ACTION` (default) records the risk in `email.warnings` without affecting the status.
107
+ #
108
+ # **Billing.** Checks are free - the credit is consumed by the successful send.
109
+ #
110
+ # **Session persistence.** A finalized check updates the session created by the send (visible in the Business
111
+ # Console, queryable via `GET /v3/session/{sessionId}/decision/`) and fires a `status.updated` webhook.
112
+ #
113
+ # **Sandbox.** Sandbox API keys skip all processing: any well-formed code (`123456` included) returns a static
114
+ # `Approved` payload with a simplified `email` object (`status`, `email`, `is_breached`, `is_disposable`,
115
+ # `is_undeliverable`); malformed input still returns `400`. Nothing is persisted.
116
+ #
117
+ # **Authentication.** Send your application's API key in the `x-api-key` header. Missing or invalid credentials
118
+ # return `403` (`{"detail": "You do not have permission to perform this action."}`) - this API never returns
119
+ # `401`.
120
+ #
121
+ # **Rate limit.** Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints;
122
+ # exceeding it returns `429`.
123
+ #
124
+ # **Social footprint.** Set `enable_social` to `true` to add a `email_social` block: the online platforms this
125
+ # address is registered on, with per-category counts and any profile details available. `profiles_registered: 0`
126
+ # means the platforms were checked and the address was found on none of them - a valid, billable answer. The
127
+ # block is absent when the add-on was not requested or the check could not be completed, and it is not billed in
128
+ # that case. Billing adds one `email_social` unit per request on top of this endpoint's own price.
129
+ #
130
+ # +POST /v3/email/check/+
131
+ #
132
+ # @param email [String] The same email address used in the matching [`POST
133
+ # /v3/email/send/`](/standalone-apis/email-send) call. This is what links the check to the send.
134
+ # @param code [String] The OTP the end user received: 4-8 digits, or 4-8 letters/digits when `alphanumeric_code:
135
+ # true` was used at send time. Comparison is case-insensitive.
136
+ # @param duplicated_email_action [String] What to do when the same address was already used and approved by a
137
+ # different user (only previously Approved verifications count) (different `vendor_data`) of your application.
138
+ # `DECLINE` flips the final `status` to `Declined`; `NO_ACTION` records the risk in `email.warnings` and fills
139
+ # `email.matches`.
140
+ # @param breached_email_action [String] What to do when the address appears in known data breaches
141
+ # (`email.is_breached`). `DECLINE` flips the final `status` to `Declined`; `NO_ACTION` records the risk in
142
+ # `email.warnings`.
143
+ # @param disposable_email_action [String] What to do when the domain belongs to a disposable/temporary-mail
144
+ # provider (`email.is_disposable`). `DECLINE` flips the final `status` to `Declined`; `NO_ACTION` records the
145
+ # risk in `email.warnings`.
146
+ # @param enable_social [Boolean] When true, also look up the social footprint of the address - the email,
147
+ # social, professional, e-commerce and entertainment platforms it is registered on. Billed as one `email_social`
148
+ # unit per request in addition to this endpoint's own price.
149
+ # @param email_no_social_presence_action [String] Action when the social footprint check finds the address
150
+ # registered on none of the platforms it covers. Only NO_ACTION and DECLINE are accepted on this endpoint;
151
+ # REVIEW is available on the workflow configuration key of the same name.
152
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
153
+ # @return [Didit::Types::EmailVerificationCheckResponse]
154
+ def check_code(
155
+ email:,
156
+ code:,
157
+ duplicated_email_action: OMIT,
158
+ breached_email_action: OMIT,
159
+ disposable_email_action: OMIT,
160
+ enable_social: OMIT,
161
+ email_no_social_presence_action: OMIT,
162
+ request_options: nil
163
+ )
164
+ @client.request(
165
+ :post,
166
+ "/v3/email/check/",
167
+ body: {
168
+ "email" => email,
169
+ "code" => code,
170
+ "duplicated_email_action" => duplicated_email_action,
171
+ "breached_email_action" => breached_email_action,
172
+ "disposable_email_action" => disposable_email_action,
173
+ "enable_social" => enable_social,
174
+ "email_no_social_presence_action" => email_no_social_presence_action
175
+ },
176
+ response: Types::EmailVerificationCheckResponse,
177
+ request_options: request_options
178
+ )
179
+ end
180
+
181
+ # Send Email Code
182
+ #
183
+ # Send a one-time passcode (OTP) to an email address, then verify it with [`POST
184
+ # /v3/email/check/`](/standalone-apis/email-check).
185
+ #
186
+ # **How send and check pair up.** Verification state is keyed by your application plus the `email` address - the
187
+ # check call does not take `request_id`. Each new send creates a pending verification that lives for **5
188
+ # minutes**: call the check with the same address and the code the user received before the window closes.
189
+ # Calling send again for the same address while a verification is pending generates a fresh code for that same
190
+ # verification (`status: "Retry"`, same `request_id`); the previous code stops working. At most one retry is
191
+ # attached this way (two sends total); a further send starts a fresh verification with a new `request_id`. The
192
+ # 5-minute window is measured from the first send and is not extended by retries.
193
+ #
194
+ # **Deliverability pre-check.** Before anything is sent, the address goes through syntax and DNS/MX validation.
195
+ # Addresses that cannot receive mail return `200` with `status: "Undeliverable"` and `reason:
196
+ # "email_can_not_be_delivered"` - no email is sent, nothing is billed, and the verification is immediately
197
+ # finalized as `Declined` (a follow-up check returns `Expired or Not Found`). A downstream send failure reports
198
+ # the same way.
199
+ #
200
+ # **Code format and branding.** Codes are 4-8 characters (`options.code_size`, default 6), numeric by default;
201
+ # set `options.alphanumeric_code: true` for uppercase letters and digits (the check comparison is
202
+ # case-insensitive). The email template is localized via `options.locale` (54 supported languages) and can use
203
+ # your application's white-label branding via `options.use_white_label_customization`.
204
+ #
205
+ # **Billing.** One Email Verification API credit per successful send (`status: "Success"`), charged at send
206
+ # time. `Retry` and `Undeliverable` sends are free, and checks are free.
207
+ #
208
+ # **Session persistence.** Every new verification is persisted as an API-type session: `request_id` is a real
209
+ # session id you can pass to `GET /v3/session/{sessionId}/decision/`, the verification appears in the Business
210
+ # Console, and `status.updated` webhooks fire as it progresses.
211
+ #
212
+ # **Sandbox.** Sandbox API keys skip delivery and billing: after request validation (malformed input still
213
+ # returns `400`), the endpoint returns a static `Success` payload with a random `request_id`; no email is sent
214
+ # and nothing is persisted. Use code `123456` on the sandbox check.
215
+ #
216
+ # **Authentication.** Send your application's API key in the `x-api-key` header. Missing or invalid credentials
217
+ # return `403` (`{"detail": "You do not have permission to perform this action."}`) - this API never returns
218
+ # `401`.
219
+ #
220
+ # **Rate limit.** Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints;
221
+ # exceeding it returns `429`.
222
+ #
223
+ # +POST /v3/email/send/+
224
+ #
225
+ # @param email [String] Recipient email address. Malformed addresses return `400`; syntactically valid addresses
226
+ # that cannot receive mail (failed DNS/MX validation) return `200` with `status: "Undeliverable"`.
227
+ # @param options [Hash] OTP format, localization, and branding options. All fields are optional.
228
+ # @param signals [Hash] Optional device and network signals about the end user, forwarded to the anti-fraud
229
+ # layer to improve detection of abusive or automated traffic. All fields are optional.
230
+ # @param vendor_data [String] Optional caller-controlled identifier (your internal user id, an email, a UUID,
231
+ # etc.) persisted on the session and echoed back in the send response, the matching check response, webhooks,
232
+ # and the Business Console. Use it to correlate Didit's `request_id` with your user record.
233
+ # @param metadata [Hash, nil] Optional free-form JSON object persisted on the session and echoed back in the
234
+ # send response, the matching check response, webhooks, and the Business Console.
235
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
236
+ # @return [Didit::Types::EmailVerificationSendResponse]
237
+ def send_code(email:, options: OMIT, signals: OMIT, vendor_data: OMIT, metadata: OMIT, request_options: nil)
238
+ @client.request(
239
+ :post,
240
+ "/v3/email/send/",
241
+ body: {
242
+ "email" => email,
243
+ "options" => options,
244
+ "signals" => signals,
245
+ "vendor_data" => vendor_data,
246
+ "metadata" => metadata
247
+ },
248
+ response: Types::EmailVerificationSendResponse,
249
+ request_options: request_options
250
+ )
251
+ end
252
+ end
253
+ end
254
+ end
@@ -0,0 +1,103 @@
1
+ # Code generated by codegen from openapi/*.json. DO NOT EDIT.
2
+ # frozen_string_literal: true
3
+
4
+ module Didit
5
+ module Resources
6
+ # The +face_match+ resource.
7
+ class FaceMatch < Didit::Resource
8
+ # Face Match
9
+ #
10
+ # Compare two face images (1:1) and get back a similarity `score` (0-100) plus an `Approved`/`Declined`
11
+ # `status`.
12
+ #
13
+ # **How it works.** Both images are decoded and analyzed by a biometric model (set `rotate_image=true` if
14
+ # captures may be sideways or upside down), then a similarity score between the two faces is computed. A score
15
+ # **strictly above** `face_match_score_decline_threshold` (default `30`) returns `status: "Approved"`; a score
16
+ # at or below it returns `Declined` with a `LOW_FACE_MATCH_SIMILARITY` warning. If no face pair can be scored at
17
+ # all, the call still returns `200` with `status: "Declined"` and a `NO_REFERENCE_IMAGE` warning - `score` is
18
+ # `null` on the default save path, or `0` with `save_api_request=false`. Submit one clear, front-facing face per
19
+ # image for best results.
20
+ #
21
+ # **Billing.** Each `200` response consumes one Face Match API credit (paid from your plan credit or top-up
22
+ # balance). When the organization's balance cannot cover the call, the endpoint returns `403` with the
23
+ # not-enough-credits error before any image processing.
24
+ #
25
+ # **Session persistence (`save_api_request`, default `true`).** When `true`, the call is persisted as an
26
+ # API-type session: it appears in the Business Console, the returned `request_id` is a real session id you can
27
+ # pass to `GET /v3/session/{sessionId}/decision/`, both images are stored as the session's face-match
28
+ # source/target images, and a `status.updated` webhook is emitted to your configured webhook endpoints. When
29
+ # `false`, nothing is stored and `request_id` is a one-off correlation UUID that cannot be looked up later.
30
+ #
31
+ # **Face search index.** This endpoint never enrolls faces into your face search index and never runs blocklist
32
+ # or duplicate screening - use `POST /v3/passive-liveness/` or `POST /v3/face-search/` for those.
33
+ #
34
+ # **Sandbox.** Sandbox API keys skip all processing and billing: after request validation (malformed input still
35
+ # returns `400`), the endpoint returns a static `Approved` mock payload, no session is persisted, and no credits
36
+ # are consumed.
37
+ #
38
+ # **Authentication.** Send your application's API key in the `x-api-key` header. Missing or invalid credentials
39
+ # return `403` (`{"detail": "You do not have permission to perform this action."}`) - this API never returns
40
+ # `401`.
41
+ #
42
+ # **Rate limit.** Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints;
43
+ # exceeding it returns `429`.
44
+ #
45
+ # +POST /v3/face-match/+
46
+ #
47
+ # @param user_image [Pathname, IO, String, Didit::FilePart] Live or candidate face image to verify (e.g. a
48
+ # selfie). Submit a single front-facing photo with the subject's face clearly visible and well lit. Allowed
49
+ # extensions: `tiff`, `jpg`, `jpeg`, `png`, `webp`. Maximum upload size: **5 MB** (larger files are rejected
50
+ # with `400`). Images are automatically compressed to ~0.5 MB before processing, so very high resolutions do not
51
+ # improve accuracy.
52
+ # @param ref_image [Pathname, IO, String, Didit::FilePart] Reference face image to compare against (e.g. an ID
53
+ # document portrait or a previously enrolled photo). Same format and size limits as `user_image`.
54
+ # @param face_match_score_decline_threshold [Numeric] Similarity threshold (0-100) that drives the response
55
+ # `status`. A computed score **at or below** this value sets `status` to `Declined` and adds a
56
+ # `LOW_FACE_MATCH_SIMILARITY` warning; a score strictly above it returns `Approved`. Default `30` is permissive
57
+ # - raise it (e.g. `50`-`60`) for stricter verification. Values outside 0-100 return `400`.
58
+ # @param rotate_image [Boolean] When `true`, the service tries the input images in 90-degree increments (0, 90,
59
+ # 180, 270) and uses the orientation that yields the best face detection - useful for mobile captures with
60
+ # missing EXIF orientation. Adds latency, so only enable it if you cannot guarantee upright images.
61
+ # @param save_api_request [Boolean] When `true` (default), persists the call as an API-type session - visible in
62
+ # the Business Console, retrievable via `GET /v3/session/{sessionId}/decision/` using the returned `request_id`,
63
+ # and announced through a `status.updated` webhook. When `false`, nothing is stored and `request_id` is a
64
+ # transient UUID for response correlation only.
65
+ # @param vendor_data [String] Optional opaque string (your internal user id, email, UUID…) stored on the
66
+ # persisted session and echoed back in the response. Use it to correlate API calls with your own records and to
67
+ # filter sessions later.
68
+ # @param metadata [Hash] Optional JSON object stored with the session (when `save_api_request=true`) and echoed
69
+ # back in the response. In multipart requests, send it as a JSON-encoded string field (e.g.
70
+ # `metadata={"flow":"login"}`) - it is parsed into an object.
71
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
72
+ # @return [Didit::Types::FaceMatchCompareResponse]
73
+ def compare(
74
+ user_image:,
75
+ ref_image:,
76
+ face_match_score_decline_threshold: OMIT,
77
+ rotate_image: OMIT,
78
+ save_api_request: OMIT,
79
+ vendor_data: OMIT,
80
+ metadata: OMIT,
81
+ request_options: nil
82
+ )
83
+ @client.request(
84
+ :post,
85
+ "/v3/face-match/",
86
+ body: {
87
+ "user_image" => user_image,
88
+ "ref_image" => ref_image,
89
+ "face_match_score_decline_threshold" => face_match_score_decline_threshold,
90
+ "rotate_image" => rotate_image,
91
+ "save_api_request" => save_api_request,
92
+ "vendor_data" => vendor_data,
93
+ "metadata" => metadata
94
+ },
95
+ encoding: :multipart,
96
+ file_fields: %w[ref_image user_image],
97
+ response: Types::FaceMatchCompareResponse,
98
+ request_options: request_options
99
+ )
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,103 @@
1
+ # Code generated by codegen from openapi/*.json. DO NOT EDIT.
2
+ # frozen_string_literal: true
3
+
4
+ module Didit
5
+ module Resources
6
+ # The +face_search+ resource.
7
+ class FaceSearch < Didit::Resource
8
+ # Face Search
9
+ #
10
+ # Search a face image (1:N) against your application's face search index - faces enrolled from verification
11
+ # sessions, saved standalone API calls, direct user-profile face uploads, and your block/allow lists - and get
12
+ # back ranked similarity matches plus blocklist and duplicate warnings.
13
+ #
14
+ # **How it works.** The largest detected face in `user_image` is embedded and searched against the index, scoped
15
+ # to your application. Up to **5 matches** above the similarity floor are returned in `matches`, each with
16
+ # `similarity_percentage`, the originating session (`session_id`, `session_number`, `status`, `vendor_data`),
17
+ # `user_details` extracted during that session's document verification, `is_blocklisted` / `is_allowlisted`
18
+ # flags, and a `source` discriminator (`session`, `imported`, or `list_entry`).
19
+ #
20
+ # - `search_type=most_similar` (default) ranks every enrolled face by similarity - use it for deduplication and
21
+ # fraud-ring investigation.
22
+ # - `search_type=blocklisted_or_approved` restricts candidates to blocklisted faces, allowlisted faces, faces
23
+ # from approved sessions, and imported user-profile faces, ranking blocklisted entries first - use it when the
24
+ # primary goal is blocklist screening.
25
+ #
26
+ # `status` is `Declined` only when a `FACE_IN_BLOCKLIST` or `POSSIBLE_FACE_IN_BLOCKLIST` warning fires;
27
+ # `DUPLICATED_FACE` / `POSSIBLE_DUPLICATED_FACE` (`information`) and `MULTIPLE_FACES_DETECTED` (`warning`) never
28
+ # decline. Unlike Passive Liveness, this endpoint does **not** exclude prior sessions with the same
29
+ # `vendor_data` from matching. A passive-liveness analysis also runs internally and is stored with the persisted
30
+ # session, but its result is not part of this response.
31
+ #
32
+ # **Billing.** Each `200` response consumes one Face Search API credit (paid from your plan credit or top-up
33
+ # balance). Insufficient balance returns `403` before any image processing.
34
+ #
35
+ # **Session persistence and face enrollment (`save_api_request`, default `true`).** When `true`, the call is
36
+ # persisted as an API-type session (Business Console, `GET /v3/session/{sessionId}/decision/` via the returned
37
+ # `request_id`, `status.updated` webhook) and the searched face is enrolled into your face search index. Faces
38
+ # enrolled by Face Search calls are excluded from future Face Search results, so repeated searches never match
39
+ # each other. When `false`, the call is one-shot: nothing is stored, the face is not enrolled, and
40
+ # `match_image_url` values are internal storage paths rather than downloadable URLs.
41
+ #
42
+ # **Sandbox.** Sandbox API keys skip all processing and billing: after request validation (malformed input still
43
+ # returns `400`), the endpoint returns a static `Approved` mock payload, no session is persisted, and no credits
44
+ # are consumed.
45
+ #
46
+ # **Authentication.** Send your application's API key in the `x-api-key` header. Missing or invalid credentials
47
+ # return `403` (`{"detail": "You do not have permission to perform this action."}`) - this API never returns
48
+ # `401`.
49
+ #
50
+ # **Rate limit.** Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints;
51
+ # exceeding it returns `429`.
52
+ #
53
+ # +POST /v3/face-search/+
54
+ #
55
+ # @param user_image [Pathname, IO, String, Didit::FilePart] Front-facing face image to search with. Allowed
56
+ # extensions: `tiff`, `jpg`, `jpeg`, `png`, `webp`. Maximum upload size: **5 MB** (larger files are rejected
57
+ # with `400`). Images are automatically compressed to ~0.5 MB before processing, so very high resolutions do not
58
+ # improve accuracy. The image must contain at least one detectable face - otherwise the endpoint returns `400`.
59
+ # When several faces are...
60
+ # @param search_type [String] Search policy. `most_similar` (default) ranks every enrolled face in your
61
+ # application by similarity. `blocklisted_or_approved` restricts candidates to blocklisted faces, allowlisted
62
+ # faces, faces from approved sessions, and imported user-profile faces - with blocklisted entries ranked first.
63
+ # @param rotate_image [Boolean] When `true`, the service tries 90-degree rotations of the input and uses the
64
+ # orientation that yields the best face detection. Useful when EXIF orientation is missing. Adds latency.
65
+ # @param save_api_request [Boolean] When `true` (default), persists the call as an API-type session, emits a
66
+ # `status.updated` webhook, presigns `match_image_url` values, and enrolls the searched face into your face
67
+ # search index (Face Search enrollments are excluded from future searches). When `false`, the search is one-shot
68
+ # - no session is stored and the face is not enrolled.
69
+ # @param vendor_data [String] Optional opaque identifier (your user id, email, UUID…) stored on the persisted
70
+ # session and echoed back. It does not exclude same-user faces from the search results.
71
+ # @param metadata [Hash] Optional JSON object stored with the session (when `save_api_request=true`) and echoed
72
+ # back. In multipart requests, send it as a JSON-encoded string field - it is parsed into an object.
73
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
74
+ # @return [Didit::Types::FaceSearchSearchResponse]
75
+ def search(
76
+ user_image:,
77
+ search_type: OMIT,
78
+ rotate_image: OMIT,
79
+ save_api_request: OMIT,
80
+ vendor_data: OMIT,
81
+ metadata: OMIT,
82
+ request_options: nil
83
+ )
84
+ @client.request(
85
+ :post,
86
+ "/v3/face-search/",
87
+ body: {
88
+ "user_image" => user_image,
89
+ "search_type" => search_type,
90
+ "rotate_image" => rotate_image,
91
+ "save_api_request" => save_api_request,
92
+ "vendor_data" => vendor_data,
93
+ "metadata" => metadata
94
+ },
95
+ encoding: :multipart,
96
+ file_fields: %w[user_image],
97
+ response: Types::FaceSearchSearchResponse,
98
+ request_options: request_options
99
+ )
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,130 @@
1
+ # Code generated by codegen from openapi/*.json. DO NOT EDIT.
2
+ # frozen_string_literal: true
3
+
4
+ module Didit
5
+ module Resources
6
+ # The +fraud_checks+ resource.
7
+ class FraudChecks < Didit::Resource
8
+ # Run a Fraud Check
9
+ #
10
+ # Submit one or more typed identifiers and receive normalization, fresh enrichment, authoritative validation
11
+ # where the country and identifier type are covered, independent risk dimensions and a recommendation in one
12
+ # response.
13
+ #
14
+ # These profiles support identifier checks. Selfie-based identity binding (`biometric_identity`) requires
15
+ # profile version `2026-09-14.2` and a Brazilian CPF; it runs only with the user's consent and when your
16
+ # organization is entitled to it. Earlier versions report it as `not_available_in_profile_version`. Modules that
17
+ # cannot run are reported as skipped with a deterministic reason; a source that could not answer is never
18
+ # reported as an identity mismatch.
19
+ #
20
+ # +POST /v3/fraud/checks/+
21
+ #
22
+ # @param subject [Hash]
23
+ # @param client_reference [String] Your own reference for this check. Doubles as the idempotency key: reusing it
24
+ # with the same body returns the original check without running or billing the modules again; reusing it with a
25
+ # different body returns 409.
26
+ # @param profile [String] Orchestration profile id. Defaults to the Didit `standard` profile.
27
+ # @param profile_version [String] Pin a frozen profile version. Defaults to the current version of the profile.
28
+ # @param context [Hash]
29
+ # @param checks [Hash]
30
+ # @param vendor_data [String]
31
+ # @param metadata [Object]
32
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
33
+ # @return [Didit::Types::FraudCheckResponse]
34
+ def create(
35
+ subject:,
36
+ client_reference: OMIT,
37
+ profile: OMIT,
38
+ profile_version: OMIT,
39
+ context: OMIT,
40
+ checks: OMIT,
41
+ vendor_data: OMIT,
42
+ metadata: OMIT,
43
+ request_options: nil
44
+ )
45
+ @client.request(
46
+ :post,
47
+ "/v3/fraud/checks/",
48
+ body: {
49
+ "subject" => subject,
50
+ "client_reference" => client_reference,
51
+ "profile" => profile,
52
+ "profile_version" => profile_version,
53
+ "context" => context,
54
+ "checks" => checks,
55
+ "vendor_data" => vendor_data,
56
+ "metadata" => metadata
57
+ },
58
+ response: Types::FraudCheckResponse,
59
+ request_options: request_options
60
+ )
61
+ end
62
+
63
+ # Plan a Fraud Check
64
+ #
65
+ # Validate selected checks and estimate their price without executing, creating a session or billing.
66
+ #
67
+ # +POST /v3/fraud/checks/plan/+
68
+ #
69
+ # @param subject [Hash]
70
+ # @param client_reference [String] Your own reference for this check. Doubles as the idempotency key: reusing it
71
+ # with the same body returns the original check without running or billing the modules again; reusing it with a
72
+ # different body returns 409.
73
+ # @param profile [String] Orchestration profile id. Defaults to the Didit `standard` profile.
74
+ # @param profile_version [String] Pin a frozen profile version. Defaults to the current version of the profile.
75
+ # @param context [Hash]
76
+ # @param checks [Hash]
77
+ # @param vendor_data [String]
78
+ # @param metadata [Object]
79
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
80
+ # @return [Didit::Types::FraudCheckPlan]
81
+ def plan(
82
+ subject:,
83
+ client_reference: OMIT,
84
+ profile: OMIT,
85
+ profile_version: OMIT,
86
+ context: OMIT,
87
+ checks: OMIT,
88
+ vendor_data: OMIT,
89
+ metadata: OMIT,
90
+ request_options: nil
91
+ )
92
+ @client.request(
93
+ :post,
94
+ "/v3/fraud/checks/plan/",
95
+ body: {
96
+ "subject" => subject,
97
+ "client_reference" => client_reference,
98
+ "profile" => profile,
99
+ "profile_version" => profile_version,
100
+ "context" => context,
101
+ "checks" => checks,
102
+ "vendor_data" => vendor_data,
103
+ "metadata" => metadata
104
+ },
105
+ response: Types::FraudCheckPlan,
106
+ request_options: request_options
107
+ )
108
+ end
109
+
110
+ # Retrieve a Fraud Check
111
+ #
112
+ # Fetch a previously created check by its `check_id`.
113
+ #
114
+ # +GET /v3/fraud/checks/{check_id}/+
115
+ #
116
+ # @param check_id [String]
117
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
118
+ # @return [Didit::Types::FraudCheckResponse]
119
+ def retrieve(check_id, request_options: nil)
120
+ @client.request(
121
+ :get,
122
+ "/v3/fraud/checks/{check_id}/",
123
+ path_params: { "check_id" => check_id },
124
+ response: Types::FraudCheckResponse,
125
+ request_options: request_options
126
+ )
127
+ end
128
+ end
129
+ end
130
+ end