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,309 @@
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 +account+ resource.
7
+ class Account < Didit::Resource
8
+ # @return [Didit::Resources::Account::Applications]
9
+ def applications
10
+ @applications ||= Applications.new(@client)
11
+ end
12
+
13
+ # @return [Didit::Resources::Account::Organizations]
14
+ def organizations
15
+ @organizations ||= Organizations.new(@client)
16
+ end
17
+
18
+ # Programmatic Login
19
+ #
20
+ # Authenticate any verified email/password Didit account and receive an RS256 JWT pair (default lifetime
21
+ # 86400s). Console-created email/password accounts can use this endpoint; OAuth-only console accounts must set a
22
+ # password first.
23
+ #
24
+ # +POST /programmatic/login/+
25
+ #
26
+ # @param email [String]
27
+ # @param password [String]
28
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
29
+ # @return [Didit::Types::LoginResponse]
30
+ def login(email:, password:, request_options: nil)
31
+ @client.request(
32
+ :post,
33
+ "/programmatic/login/",
34
+ body: {
35
+ "email" => email,
36
+ "password" => password
37
+ },
38
+ auth: :none,
39
+ api: :account,
40
+ response: Types::LoginResponse,
41
+ request_options: request_options
42
+ )
43
+ end
44
+
45
+ # Register Account
46
+ #
47
+ # Step 1 of programmatic onboarding. Creates a pending account and emails a 6-char code (10 min TTL). The
48
+ # address is checked before any account is created: one that cannot receive the code returns 400
49
+ # `email_undeliverable`. Rate limits: 5/IP/hour, plus a shared hourly budget per network (/24 for IPv4, /64 for
50
+ # IPv6).
51
+ #
52
+ # +POST /programmatic/register/+
53
+ #
54
+ # @param email [String] Any valid email address (personal, work, alias). Used as the unique account identifier.
55
+ # @param password [String] Minimum 8 characters. Must contain at least one uppercase letter (`A-Z`), one
56
+ # lowercase letter (`a-z`), one digit (`0-9`), and one special character from `!@#$%^&*()_+-=[]{}|;:,.<>?`.
57
+ # Validation reports one failed rule at a time.
58
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
59
+ # @return [Didit::Types::RegisterResponse]
60
+ def register(email:, password:, request_options: nil)
61
+ @client.request(
62
+ :post,
63
+ "/programmatic/register/",
64
+ body: {
65
+ "email" => email,
66
+ "password" => password
67
+ },
68
+ auth: :none,
69
+ api: :account,
70
+ response: Types::RegisterResponse,
71
+ request_options: request_options
72
+ )
73
+ end
74
+
75
+ # Resend the email verification code
76
+ #
77
+ # Resend the 6-character verification code for an unverified programmatic account. Requires the account's email
78
+ # and password so only the owner can trigger a new code (no console Basic Auth). A fresh code replaces the
79
+ # previous one and is valid for 10 minutes.
80
+ #
81
+ # Rate limits: a per-email cooldown of 60 seconds between resends (HTTP 429 with `Retry-After`), and the same
82
+ # 5-per-IP-per-hour and per-network hourly budgets as registration.
83
+ #
84
+ # +POST /programmatic/resend-otp/+
85
+ #
86
+ # @param email [String] Email of the pending (unverified) account.
87
+ # @param password [String] Password chosen at registration.
88
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
89
+ # @return [Didit::Types::AccountResendOtpResponse]
90
+ def resend_otp(email:, password:, request_options: nil)
91
+ @client.request(
92
+ :post,
93
+ "/programmatic/resend-otp/",
94
+ body: {
95
+ "email" => email,
96
+ "password" => password
97
+ },
98
+ auth: :none,
99
+ api: :account,
100
+ response: Types::AccountResendOtpResponse,
101
+ request_options: request_options
102
+ )
103
+ end
104
+
105
+ # Verify Email and Issue Credentials
106
+ #
107
+ # Step 2 of onboarding. Exchanges the 6-char code for a verified account, a default org+app, and a JWT pair.
108
+ # Persist the returned `api_key`.
109
+ #
110
+ # +POST /programmatic/verify-email/+
111
+ #
112
+ # @param email [String] Email used during `POST /programmatic/register/`.
113
+ # @param code [String] 6-character alphanumeric code from the verification email. Codes expire 10 minutes after
114
+ # the most recent code was sent.
115
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
116
+ # @return [Didit::Types::VerifyEmailResponse]
117
+ def verify_email(email:, code:, request_options: nil)
118
+ @client.request(
119
+ :post,
120
+ "/programmatic/verify-email/",
121
+ body: {
122
+ "email" => email,
123
+ "code" => code
124
+ },
125
+ auth: :none,
126
+ api: :account,
127
+ response: Types::VerifyEmailResponse,
128
+ request_options: request_options
129
+ )
130
+ end
131
+
132
+ # The +account.applications+ resource.
133
+ class Applications < Didit::Resource
134
+ # Create Application
135
+ #
136
+ # Create an application inside an organization. The response includes `api_key`; persist it now (recoverable
137
+ # via GET). Requires owner/admin JWT.
138
+ #
139
+ # +POST /organizations/me/{org_id}/applications/+
140
+ #
141
+ # @param org_id [String] UUID of the organization. Look it up with `GET /organizations/me/`.
142
+ # @param name [String] Application display name. Defaults to `"<organization name> App"`.
143
+ # @param website_url [String] Website or app URL associated with this application.
144
+ # @param redirect_uris [Array<String>] Allowed redirect URIs for OAuth-style and verification redirect flows.
145
+ # @param terms_url [String] Terms of service URL shown in the verification flow.
146
+ # @param privacy_url [String] Privacy policy URL shown in the verification flow.
147
+ # @param description [String] Internal description for the application (not shown to end users).
148
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
149
+ # @return [Didit::Types::Application]
150
+ def create(
151
+ org_id,
152
+ name: OMIT,
153
+ website_url: OMIT,
154
+ redirect_uris: OMIT,
155
+ terms_url: OMIT,
156
+ privacy_url: OMIT,
157
+ description: OMIT,
158
+ request_options: nil
159
+ )
160
+ @client.request(
161
+ :post,
162
+ "/organizations/me/{org_id}/applications/",
163
+ path_params: { "org_id" => org_id },
164
+ body: {
165
+ "name" => name,
166
+ "website_url" => website_url,
167
+ "redirect_uris" => redirect_uris,
168
+ "terms_url" => terms_url,
169
+ "privacy_url" => privacy_url,
170
+ "description" => description
171
+ },
172
+ auth: :account_token,
173
+ api: :account,
174
+ response: Types::Application,
175
+ request_options: request_options
176
+ )
177
+ end
178
+
179
+ # List the organization's applications
180
+ #
181
+ # List the organization's applications, 50 per page by default. Use this to discover `app_id` values when
182
+ # recovering credentials from a new machine, then call `GET /organizations/me/{org_id}/applications/{app_id}/`
183
+ # for the API key. Requires an owner or admin Bearer token.
184
+ #
185
+ # +GET /organizations/me/{org_id}/applications/+
186
+ #
187
+ # @param org_id [String] UUID of the organization. Look it up with `GET /organizations/me/`.
188
+ # @param limit [Integer] Number of applications per page. Defaults to 50.
189
+ # @param offset [Integer] Number of applications to skip before the page starts. Defaults to 0.
190
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
191
+ # @return [Didit::Page<Didit::Types::Application>]
192
+ def list(org_id, limit: OMIT, offset: OMIT, request_options: nil)
193
+ @client.request(
194
+ :get,
195
+ "/organizations/me/{org_id}/applications/",
196
+ path_params: { "org_id" => org_id },
197
+ query: {
198
+ "limit" => limit,
199
+ "offset" => offset
200
+ },
201
+ auth: :account_token,
202
+ api: :account,
203
+ page: Types::Application,
204
+ request_options: request_options
205
+ )
206
+ end
207
+
208
+ # Get Application Credentials
209
+ #
210
+ # Read one application's full record including `client_id` and `api_key`. Use this to recover a lost
211
+ # `api_key`.
212
+ #
213
+ # +GET /organizations/me/{org_id}/applications/{app_id}/+
214
+ #
215
+ # @param org_id [String] UUID of the organization that owns the application.
216
+ # @param app_id [String] UUID of the application whose credentials you want to read.
217
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
218
+ # @return [Didit::Types::Application]
219
+ def retrieve(org_id, app_id, request_options: nil)
220
+ @client.request(
221
+ :get,
222
+ "/organizations/me/{org_id}/applications/{app_id}/",
223
+ path_params: { "org_id" => org_id, "app_id" => app_id },
224
+ auth: :account_token,
225
+ api: :account,
226
+ response: Types::Application,
227
+ request_options: request_options
228
+ )
229
+ end
230
+
231
+ # Update Application
232
+ #
233
+ # Update application metadata (name, URLs, redirect URIs). `api_key` and `client_id` are never rotated.
234
+ # `products` is read-only: a `products` key in the body is ignored. Requires owner/admin JWT.
235
+ #
236
+ # +PATCH /organizations/me/{org_id}/applications/{app_id}/+
237
+ #
238
+ # @param org_id [String] UUID of the organization that owns the application.
239
+ # @param app_id [String] UUID of the application to update.
240
+ # @param name [String] Application display name.
241
+ # @param website_url [String] Website or app URL associated with this application.
242
+ # @param redirect_uris [Array<String>] Allowed redirect URIs for OAuth-style and verification redirect flows.
243
+ # @param terms_url [String] Terms of service URL shown in the verification flow.
244
+ # @param privacy_url [String] Privacy policy URL shown in the verification flow.
245
+ # @param description [String] Internal description for the application.
246
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
247
+ # @return [Didit::Types::Application]
248
+ def update(
249
+ org_id,
250
+ app_id,
251
+ name: OMIT,
252
+ website_url: OMIT,
253
+ redirect_uris: OMIT,
254
+ terms_url: OMIT,
255
+ privacy_url: OMIT,
256
+ description: OMIT,
257
+ request_options: nil
258
+ )
259
+ @client.request(
260
+ :patch,
261
+ "/organizations/me/{org_id}/applications/{app_id}/",
262
+ path_params: { "org_id" => org_id, "app_id" => app_id },
263
+ body: {
264
+ "name" => name,
265
+ "website_url" => website_url,
266
+ "redirect_uris" => redirect_uris,
267
+ "terms_url" => terms_url,
268
+ "privacy_url" => privacy_url,
269
+ "description" => description
270
+ },
271
+ auth: :account_token,
272
+ api: :account,
273
+ response: Types::Application,
274
+ request_options: request_options
275
+ )
276
+ end
277
+ end
278
+
279
+ # The +account.organizations+ resource.
280
+ class Organizations < Didit::Resource
281
+ # List My Organizations
282
+ #
283
+ # List organizations the authenticated user belongs to. Each entry's `uuid` is the `org_id` used on the
284
+ # application endpoints.
285
+ #
286
+ # +GET /organizations/me/+
287
+ #
288
+ # @param limit [Integer] Page size. Defaults to 50.
289
+ # @param offset [Integer] Zero-based offset of the first result.
290
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
291
+ # @return [Didit::Page<Didit::Types::Organization>]
292
+ def list(limit: OMIT, offset: OMIT, request_options: nil)
293
+ @client.request(
294
+ :get,
295
+ "/organizations/me/",
296
+ query: {
297
+ "limit" => limit,
298
+ "offset" => offset
299
+ },
300
+ auth: :account_token,
301
+ api: :account,
302
+ page: Types::Organization,
303
+ request_options: request_options
304
+ )
305
+ end
306
+ end
307
+ end
308
+ end
309
+ end
@@ -0,0 +1,73 @@
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 +address_validation+ resource.
7
+ class AddressValidation < Didit::Resource
8
+ # Validate an address
9
+ #
10
+ # Confirm that an address exists and get it back normalised: its delivery lines, components and coordinates. It
11
+ # confirms the address only; it never links the address to a person.
12
+ #
13
+ # **Request.** Send the address on one line (`address`) or as structured fields (`address_line_1` and,
14
+ # optionally, `address_line_2`, `city`, `region`, `postal_code`), never both, and always its `country` (ISO
15
+ # 3166-1 alpha-2 or alpha-3).
16
+ #
17
+ # **Result.** `address_validation.status` is `verified` (confirmed to the building), `partially_verified`
18
+ # (confirmed only to the street or above), `not_verified` (only the region or city matched, or nothing did) or
19
+ # `unavailable` (the validation could not run). HTTP is `200` for every completed request, `unavailable`
20
+ # included; retry an `unavailable` result later.
21
+ #
22
+ # **Billing.** A live call costs $0.10 per validated address. An `unavailable` result is not charged. Nothing is
23
+ # stored apart from the usage record: no session is created and the result is returned only in this response.
24
+ #
25
+ # **Sandbox.** Sandbox keys validate the request and always return a deterministic `verified` result that echoes
26
+ # the address sent, without consuming credits.
27
+ #
28
+ # **Authentication.** Send your application's API key in `x-api-key`. Missing or invalid credentials return
29
+ # `403` - this API never returns `401`.
30
+ #
31
+ # **Rate limit.** Shared write budget of 300 requests per minute per API key across all POST/PATCH/DELETE
32
+ # endpoints.
33
+ #
34
+ # +POST /v3/address-validation/+
35
+ #
36
+ # @param country [String] ISO 3166-1 alpha-2 or alpha-3 code of the address's country.
37
+ # @param address [String] The whole address on one line.
38
+ # @param address_line_1 [String] Street and number.
39
+ # @param address_line_2 [String] Apartment, suite, floor or building.
40
+ # @param city [String] City or locality.
41
+ # @param region [String] State, province or region.
42
+ # @param postal_code [String]
43
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
44
+ # @return [Didit::Types::AddressValidationResponse]
45
+ def validate(
46
+ country:,
47
+ address: OMIT,
48
+ address_line_1: OMIT,
49
+ address_line_2: OMIT,
50
+ city: OMIT,
51
+ region: OMIT,
52
+ postal_code: OMIT,
53
+ request_options: nil
54
+ )
55
+ @client.request(
56
+ :post,
57
+ "/v3/address-validation/",
58
+ body: {
59
+ "country" => country,
60
+ "address" => address,
61
+ "address_line_1" => address_line_1,
62
+ "address_line_2" => address_line_2,
63
+ "city" => city,
64
+ "region" => region,
65
+ "postal_code" => postal_code
66
+ },
67
+ response: Types::AddressValidationResponse,
68
+ request_options: request_options
69
+ )
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,110 @@
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 +age_estimation+ resource.
7
+ class AgeEstimation < Didit::Resource
8
+ # Age Estimation (face age + passive liveness)
9
+ #
10
+ # Estimate a person's age from a single face photo and run a passive liveness check in the same call - returns
11
+ # the model-predicted `age_estimation` (in years), a liveness `score` (0-100), and an `Approved`/`Declined`
12
+ # `status`. The age is **model-predicted from the face, not verified against a document** - use it for age gates
13
+ # and low-friction checks, not as legal proof of age.
14
+ #
15
+ # **How it works.** The image is analyzed for faces (set `rotate_image=true` if captures may be sideways or
16
+ # upside down); each detected face gets an estimated age, and the largest face in the frame drives
17
+ # `age_estimation`. In parallel, a passive liveness model scores whether the photo shows a live person (no user
18
+ # challenge required) and detects presentation attacks (photos of photos, screens, masks). Submit one clear,
19
+ # front-facing, well-lit face per image for best results.
20
+ #
21
+ # **Decision logic.** Any warning declines: `status` is `Approved` only when the `warnings` array is empty. A
22
+ # liveness `score` at or below `face_liveness_score_decline_threshold` (default `30`) adds `LOW_LIVENESS_SCORE`;
23
+ # a detected attack adds `LIVENESS_FACE_ATTACK`; no face found by the liveness model adds `NO_FACE_DETECTED`; no
24
+ # estimable face age adds `AGE_NOT_DETECTED` (`age_estimation` is `null`); an estimated age below
25
+ # `age_estimation_decline_threshold` (default `18`) adds `AGE_BELOW_MINIMUM`. Borderline ages near your
26
+ # threshold deserve a fallback to document-based verification - the model's error grows for faces close to the
27
+ # limit.
28
+ #
29
+ # **Billing.** Each `200` response consumes one Age Estimation API credit (paid from your plan credit or top-up
30
+ # balance). When the organization's balance cannot cover the call, the endpoint returns `403` with the
31
+ # not-enough-credits error before any image processing.
32
+ #
33
+ # **Session persistence (`save_api_request`, default `true`).** When `true`, the call is persisted as an
34
+ # API-type session: it appears in the Business Console, the returned `request_id` is a real session id you can
35
+ # pass to `GET /v3/session/{sessionId}/decision/` (the result is exposed there in `liveness_checks[]`, with
36
+ # `features: ["AGE_ESTIMATION"]`), the face crop and reference image are stored, the face embedding is added to
37
+ # your application's face index (used by face search and duplicate detection), and a `status.updated` webhook is
38
+ # emitted. When `false`, nothing is stored and `request_id` is a one-off correlation UUID that cannot be looked
39
+ # up later.
40
+ #
41
+ # **Sandbox.** Sandbox API keys skip all processing and billing: after request validation (malformed input still
42
+ # returns `400`), the endpoint returns a static `Approved` mock payload (`age_estimation: 30`, no warnings), no
43
+ # session is persisted, and no credits are consumed.
44
+ #
45
+ # **Authentication.** Send your application's API key in the `x-api-key` header. Missing or invalid credentials
46
+ # return `403` (`{"detail": "You do not have permission to perform this action."}`) - this API never returns
47
+ # `401`.
48
+ #
49
+ # **Rate limit.** Shared write budget of 300 requests/min per API key across all POST/PATCH/DELETE endpoints;
50
+ # exceeding it returns `429`.
51
+ #
52
+ # +POST /v3/age-estimation/+
53
+ #
54
+ # @param user_image [Pathname, IO, String, Didit::FilePart] Face photo to analyze (e.g. a selfie). Submit a
55
+ # single front-facing photo with the subject's face clearly visible and well lit. Allowed extensions: `tiff`,
56
+ # `jpg`, `jpeg`, `png`, `webp` (no PDF). Maximum upload size: **5 MB** (larger files are rejected with `400`).
57
+ # Images are automatically compressed to ~0.3 MB before processing, so very high resolutions do not improve
58
+ # accuracy.
59
+ # @param face_liveness_score_decline_threshold [Numeric] Liveness threshold (0-100). A liveness `score` **at or
60
+ # below** this value adds a `LOW_LIVENESS_SCORE` warning and declines. Raise it for stricter anti-spoofing;
61
+ # values outside 0-100 return `400`.
62
+ # @param age_estimation_decline_threshold [Integer] Minimum acceptable estimated age in years. An estimated age
63
+ # **below** this value adds an `AGE_BELOW_MINIMUM` warning and declines. Set `0` to disable the age check (the
64
+ # call then only runs liveness + age estimation without an age-based decision).
65
+ # @param rotate_image [Boolean] When `true`, the service tries the input image in 90-degree increments (0, 90,
66
+ # 180, 270) and uses the orientation that yields the best face detection - useful for mobile captures with
67
+ # missing EXIF orientation. Adds latency, so only enable it if you cannot guarantee upright images.
68
+ # @param save_api_request [Boolean] When `true` (default), persists the call as an API-type session - visible in
69
+ # the Business Console, retrievable via `GET /v3/session/{sessionId}/decision/` using the returned `request_id`,
70
+ # announced through a `status.updated` webhook, and with the detected face added to your application's face
71
+ # index. When `false`, nothing is stored and `request_id` is a transient UUID for response correlation only...
72
+ # @param vendor_data [String] Optional opaque string (your internal user id, email, UUID…) stored on the
73
+ # persisted session and echoed back in the response. Use it to correlate API calls with your own records and to
74
+ # filter sessions later.
75
+ # @param metadata [Hash] Optional JSON object stored with the session (when `save_api_request=true`) and echoed
76
+ # back in the response. In multipart requests, send it as a JSON-encoded string field (e.g.
77
+ # `metadata={"flow":"age-gate"}`) - it is parsed into an object.
78
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
79
+ # @return [Didit::Types::AgeEstimationEstimateResponse]
80
+ def estimate(
81
+ user_image:,
82
+ face_liveness_score_decline_threshold: OMIT,
83
+ age_estimation_decline_threshold: OMIT,
84
+ rotate_image: OMIT,
85
+ save_api_request: OMIT,
86
+ vendor_data: OMIT,
87
+ metadata: OMIT,
88
+ request_options: nil
89
+ )
90
+ @client.request(
91
+ :post,
92
+ "/v3/age-estimation/",
93
+ body: {
94
+ "user_image" => user_image,
95
+ "face_liveness_score_decline_threshold" => face_liveness_score_decline_threshold,
96
+ "age_estimation_decline_threshold" => age_estimation_decline_threshold,
97
+ "rotate_image" => rotate_image,
98
+ "save_api_request" => save_api_request,
99
+ "vendor_data" => vendor_data,
100
+ "metadata" => metadata
101
+ },
102
+ encoding: :multipart,
103
+ file_fields: %w[user_image],
104
+ response: Types::AgeEstimationEstimateResponse,
105
+ request_options: request_options
106
+ )
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,166 @@
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 +aml+ resource.
7
+ class Aml < Didit::Resource
8
+ # Get AML dataset freshness
9
+ #
10
+ # Report how current the datasets behind AML screening are, per source family (`sanctions`, `pep`, `warnings`,
11
+ # `adverse_media`), as audit evidence for [ongoing AML
12
+ # monitoring](https://docs.didit.me/core-technology/aml-screening/continuous-monitoring-aml-screening#proving-that-monitoring-ran).
13
+ # The answer is platform-wide: no session in the path, no customer data in the body, the same answer for every
14
+ # application.
15
+ #
16
+ # Always `200` for an accepted key. Check `availability` first: when it is not `available`, `dataset_freshness`
17
+ # is `null`. Dates are never estimated: a family whose datasets reported no date is absent from `sources`, and a
18
+ # family where only some datasets reported one has `oldest_updated_at: null`. Readings are taken while ongoing
19
+ # monitoring runs, not on each call; `captured_at` says when.
20
+ #
21
+ # A scoped API key needs `sessions: read`; a key limited to some workflows or to approved sessions cannot call
22
+ # this endpoint. Nothing is billed.
23
+ #
24
+ # +GET /v3/aml/dataset-freshness/+
25
+ #
26
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
27
+ # @return [Didit::Types::AmlRetrieveDatasetFreshnessResponse]
28
+ def retrieve_dataset_freshness(request_options: nil)
29
+ @client.request(
30
+ :get,
31
+ "/v3/aml/dataset-freshness/",
32
+ response: Types::AmlRetrieveDatasetFreshnessResponse,
33
+ request_options: request_options
34
+ )
35
+ end
36
+
37
+ # AML screening (standalone)
38
+ #
39
+ # Screen a person or company against PEP, sanctions, warning/watchlist, and adverse-media datasets in one call.
40
+ #
41
+ # **Two-score model.** Each hit carries a `match_score` (0-100, identity confidence) and a `risk_score` (0-100,
42
+ # entity risk). Hits whose `match_score` is below `aml_match_score_threshold` (default **93**) are tagged
43
+ # `review_status: "False Positive"` and ignored for risk purposes; the highest `risk_score` among the remaining
44
+ # hits becomes `aml.score`. The final `aml.status` follows your thresholds: `score` >
45
+ # `aml_score_review_threshold` (default **100**) → `Declined`; `score` > `aml_score_approve_threshold` (default
46
+ # **80**) → `In Review`; otherwise `Approved`. Whenever `score` is non-zero and ≥ the approve threshold a
47
+ # `POSSIBLE_MATCH_FOUND` warning is added (a score of exactly 0 never warns).
48
+ #
49
+ # **Match-score weights.** `aml_name_weight` + `aml_dob_weight` + `aml_country_weight` must sum to exactly 100
50
+ # (defaults 60/25/15). Components missing from the request are re-normalized away; a matching `document_number`
51
+ # acts as a golden key that overrides `match_score` to 100.
52
+ #
53
+ # **Latency.** Plain screenings typically complete in a few seconds. With `include_adverse_media=true` the API
54
+ # waits for adverse-media enrichment (an initial ~5 s pause plus up to ~25 s of polling) - configure a client
55
+ # timeout of **at least 60 seconds**.
56
+ #
57
+ # **Persistence.** `save_api_request` defaults to **true**: the screening is stored as a session (`request_id`
58
+ # works with `GET /v3/session/{sessionId}/decision/`), it appears in the console, a `status.updated` webhook
59
+ # fires, and hit review statuses can be updated later. With `save_api_request=false` nothing is stored and
60
+ # `request_id` is a transient correlation id. `include_ongoing_monitoring=true` keeps re-screening the profile
61
+ # and requires `save_api_request=true` (enforced with a `400`).
62
+ #
63
+ # **Idempotency.** Send an `Idempotency-Key` header when retrying after a timeout or transient error. The key is
64
+ # scoped to your application and the exact request body. The first completed request stores its response; later
65
+ # identical retries return that same response and do not run or bill another AML screening. If the original
66
+ # request is still running, retry later with the same key. If the same key is reused with a different body, the
67
+ # API returns `409`.
68
+ #
69
+ # **Billing.** One AML API credit is charged after the first successful screening. Replayed idempotent responses
70
+ # are not charged again; an insufficient balance returns `403` before any new screening happens.
71
+ #
72
+ # **Sandbox.** Keys from sandbox applications skip screening and billing entirely and return a mocked result -
73
+ # `Approved` with zero hits unless you pass `sandbox_scenario`. `save_api_request` works the same as on live
74
+ # keys, so a saved sandbox screening is retrievable through `GET /v3/session/{sessionId}/decision/` and `GET
75
+ # /v3/session/{sessionId}/generate-pdf/`.
76
+ #
77
+ # +POST /v3/aml/+
78
+ #
79
+ # @param full_name [String] Full name of the person or company to screen. Minimum **2 characters** - the
80
+ # screening provider's own floor. A shorter or blank name returns `400` on this field before any screening runs,
81
+ # so nothing is billed.
82
+ # @param entity_type [String] Type of entity to screen. Defaults to `person`.
83
+ # @param date_of_birth [Date, String] Date of birth (persons) or incorporation date (companies), `YYYY-MM-DD`.
84
+ # Improves match precision via the DOB weight.
85
+ # @param nationality [String] ISO 3166-1 **alpha-2** country code (e.g. `ES`). Invalid codes return `400`.
86
+ # Improves match precision via the country weight.
87
+ # @param document_number [String] Identity document number. Not weighted - acts as a golden key: an exact match
88
+ # overrides the hit's `match_score` to 100, a hard mismatch penalizes it. Sent to the screening provider as a
89
+ # search filter only when it is **2-50 characters**; a value outside that range is accepted and stored, and the
90
+ # screening still runs and is billed, just not narrowed by document number.
91
+ # @param aml_score_approve_threshold [Numeric] Risk-score threshold at or below which the result is `Approved`.
92
+ # Must be ≤ `aml_score_review_threshold` (else `400`).
93
+ # @param aml_score_review_threshold [Numeric] Risk-score threshold above which the result is `Declined`. Scores
94
+ # between the two thresholds produce `In Review`.
95
+ # @param aml_name_weight [Integer] Weight of name similarity in the per-hit match score. The three weights must
96
+ # sum to exactly 100 (else `400`).
97
+ # @param aml_dob_weight [Integer] Weight of date of birth in the per-hit match score.
98
+ # @param aml_country_weight [Integer] Weight of country/nationality in the per-hit match score.
99
+ # @param aml_match_score_threshold [Integer] Per-hit cutoff: hits with `match_score` below this are `False
100
+ # Positive` (excluded from risk assessment); at or above are `Unreviewed` possible matches.
101
+ # @param include_adverse_media [Boolean] Also search news media for negative coverage. Adds up to ~30 s of
102
+ # latency while results are gathered - use a ≥60 s client timeout.
103
+ # @param include_ongoing_monitoring [Boolean] Keep re-screening this profile and push changes via webhook.
104
+ # Requires `save_api_request=true` (else `400`).
105
+ # @param save_api_request [Boolean] Persist the screening as a session (console visibility, decision endpoint,
106
+ # webhooks, hit review). Set to `false` for a stateless check.
107
+ # @param vendor_data [String] Your identifier for the screened user; echoed back and stored with the session.
108
+ # @param metadata [Hash, nil] Free-form JSON stored with the request and echoed back.
109
+ # @param sandbox_scenario [String] Sandbox-only scenario slug. Only accepted when the API key belongs to a
110
+ # sandbox-mode application; rejected on live applications. A standalone screening has no session to arm, so the
111
+ # slug goes on the screening request itself: `decline_aml_hit` returns one production-shaped hit and settles the
112
+ # screening as `Declined`, `review_aml_possible_match` settles it `In Review`, and a scenario that arms no A...
113
+ # @param idempotency_key [String] sent as the Idempotency-Key header
114
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
115
+ # @return [Didit::Types::AmlScreenResponse]
116
+ def screen(
117
+ full_name:,
118
+ entity_type: OMIT,
119
+ date_of_birth: OMIT,
120
+ nationality: OMIT,
121
+ document_number: OMIT,
122
+ aml_score_approve_threshold: OMIT,
123
+ aml_score_review_threshold: OMIT,
124
+ aml_name_weight: OMIT,
125
+ aml_dob_weight: OMIT,
126
+ aml_country_weight: OMIT,
127
+ aml_match_score_threshold: OMIT,
128
+ include_adverse_media: OMIT,
129
+ include_ongoing_monitoring: OMIT,
130
+ save_api_request: OMIT,
131
+ vendor_data: OMIT,
132
+ metadata: OMIT,
133
+ sandbox_scenario: OMIT,
134
+ idempotency_key: OMIT,
135
+ request_options: nil
136
+ )
137
+ @client.request(
138
+ :post,
139
+ "/v3/aml/",
140
+ body: {
141
+ "full_name" => full_name,
142
+ "entity_type" => entity_type,
143
+ "date_of_birth" => date_of_birth,
144
+ "nationality" => nationality,
145
+ "document_number" => document_number,
146
+ "aml_score_approve_threshold" => aml_score_approve_threshold,
147
+ "aml_score_review_threshold" => aml_score_review_threshold,
148
+ "aml_name_weight" => aml_name_weight,
149
+ "aml_dob_weight" => aml_dob_weight,
150
+ "aml_country_weight" => aml_country_weight,
151
+ "aml_match_score_threshold" => aml_match_score_threshold,
152
+ "include_adverse_media" => include_adverse_media,
153
+ "include_ongoing_monitoring" => include_ongoing_monitoring,
154
+ "save_api_request" => save_api_request,
155
+ "vendor_data" => vendor_data,
156
+ "metadata" => metadata,
157
+ "sandbox_scenario" => sandbox_scenario
158
+ },
159
+ headers: { "Idempotency-Key" => idempotency_key },
160
+ response: Types::AmlScreenResponse,
161
+ request_options: request_options
162
+ )
163
+ end
164
+ end
165
+ end
166
+ end