didit-sdk 1.0.0 → 2.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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/README.md +0 -2
  4. data/lib/didit/resources/address_validation.rb +2 -2
  5. data/lib/didit/resources/analytics.rb +29 -0
  6. data/lib/didit/resources/bank.rb +15 -6
  7. data/lib/didit/resources/database_validation.rb +65 -0
  8. data/lib/didit/resources/email.rb +22 -2
  9. data/lib/didit/resources/id_verification.rb +14 -13
  10. data/lib/didit/resources/id_wallets.rb +84 -0
  11. data/lib/didit/resources/ip.rb +2 -2
  12. data/lib/didit/resources/kyb.rb +14 -7
  13. data/lib/didit/resources/phone.rb +28 -2
  14. data/lib/didit/resources/pricing.rb +4 -2
  15. data/lib/didit/resources/sessions.rb +463 -33
  16. data/lib/didit/resources/transactions.rb +7 -2
  17. data/lib/didit/resources/travel_rule.rb +96 -0
  18. data/lib/didit/resources/users.rb +25 -6
  19. data/lib/didit/resources/wallet_screening.rb +5 -6
  20. data/lib/didit/resources/webhooks.rb +8 -1
  21. data/lib/didit/types/aml.rb +19 -0
  22. data/lib/didit/types/components.rb +908 -28
  23. data/lib/didit/types/email.rb +28 -0
  24. data/lib/didit/types/kyb.rb +80 -5
  25. data/lib/didit/types/phone.rb +38 -0
  26. data/lib/didit/types/sessions.rb +476 -5
  27. data/lib/didit/types/travel_rule.rb +7 -0
  28. data/lib/didit/types/wallet_screening.rb +13 -6
  29. data/lib/didit/types.rb +121 -0
  30. data/lib/didit/version.rb +1 -1
  31. data/sig/didit/resources/analytics.rbs +1 -0
  32. data/sig/didit/resources/bank.rbs +1 -1
  33. data/sig/didit/resources/database_validation.rbs +1 -1
  34. data/sig/didit/resources/email.rbs +1 -1
  35. data/sig/didit/resources/id_wallets.rbs +2 -0
  36. data/sig/didit/resources/phone.rbs +1 -1
  37. data/sig/didit/resources/sessions.rbs +14 -5
  38. data/sig/didit/resources/transactions.rbs +1 -1
  39. data/sig/didit/resources/travel_rule.rbs +5 -0
  40. data/sig/didit/resources/users.rbs +1 -1
  41. data/sig/didit/resources/wallet_screening.rbs +1 -1
  42. data/sig/didit/resources/webhooks.rbs +1 -1
  43. data/sig/didit/types/aml.rbs +18 -0
  44. data/sig/didit/types/bank.rbs +1 -1
  45. data/sig/didit/types/components.rbs +780 -4
  46. data/sig/didit/types/database_validation.rbs +1 -1
  47. data/sig/didit/types/email.rbs +22 -1
  48. data/sig/didit/types/id_wallets.rbs +4 -0
  49. data/sig/didit/types/kyb.rbs +75 -5
  50. data/sig/didit/types/phone.rbs +29 -1
  51. data/sig/didit/types/sessions.rbs +462 -2
  52. data/sig/didit/types/travel_rule.rbs +9 -0
  53. data/sig/didit/types/users.rbs +1 -1
  54. data/sig/didit/types/wallet_screening.rbs +5 -1
  55. data/sig/didit/types/webhooks.rbs +1 -1
  56. metadata +1 -1
@@ -414,6 +414,11 @@ module Didit
414
414
  # linked to the same user profile in the Users tab. (2) **Cross-session duplicate detection** - when checking
415
415
  # for duplicated faces, documents, phone numbers, emails, IP addresses, or device fingerprints, sessions with
416
416
  # the...
417
+ # @param multi_account_segment [String] Optional duplicate-detection realm inside your organization. Duplicate
418
+ # face checks compare this session only with other sessions that carry the same segment, so separate account
419
+ # bases (personal and business accounts, or one per B2B sub-client) do not flag a person who legitimately holds
420
+ # one account in each. Omit it to use the single default realm, which is what every session uses today.
421
+ # Blocklist...
417
422
  # @param callback [String] URL to redirect the user to after verification completes. Didit automatically appends
418
423
  # `verificationSessionId` and `status` (Approved, Declined, In Review) as query parameters. Custom URL schemes
419
424
  # (e.g. `myapp://`) are supported for mobile callbacks. If omitted, the workflow's default `callback_url` is
@@ -449,10 +454,10 @@ module Didit
449
454
  # bundled magic values onto the session's input fields (contact_details, expected_details) so the mocked
450
455
  # providers reproduce the scenario's outcome through the real workflow pipeline. See the scenario catalog at GET
451
456
  # /v1/san...
452
- # @param sign [Hash] Electronic Signature input for this session. `documents` are the documents to sign, for a
453
- # workflow whose Electronic Signature step takes documents from the session (`signature_documents_source`
454
- # `session` or `both`): up to 20 documents and 50 MB in total. `field_values` fills the fields whose `prefill`
455
- # is `api.<key>`, on workflow and session documents alike. Creating a session again for the same `...
457
+ # @param sign [Hash] E-signature input for this session. `documents` are the documents to sign, for a workflow
458
+ # whose E-signature step takes documents from the session (`signature_documents_source` `session` or `both`): up
459
+ # to 20 documents and 50 MB in total. `field_values` fills the fields whose `prefill` is `api.<key>`, on
460
+ # workflow and session documents alike. Creating a session again for the same `workflow_id` and `...
456
461
  # @param user_state [String] Where the person lives, when you know it: an ISO 3166-2 subdivision code (`US-IL`,
457
462
  # `ES-M`) or a US state code or name (`IL`, `Illinois`). A state whose law requires explicit biometric consent
458
463
  # (Illinois, Texas, Colorado) makes the verification flow ask for it before capturing a face, with trigger
@@ -466,6 +471,7 @@ module Didit
466
471
  def create(
467
472
  workflow_id:,
468
473
  vendor_data: OMIT,
474
+ multi_account_segment: OMIT,
469
475
  callback: OMIT,
470
476
  callback_method: OMIT,
471
477
  metadata: OMIT,
@@ -486,6 +492,7 @@ module Didit
486
492
  body: {
487
493
  "workflow_id" => workflow_id,
488
494
  "vendor_data" => vendor_data,
495
+ "multi_account_segment" => multi_account_segment,
489
496
  "callback" => callback,
490
497
  "callback_method" => callback_method,
491
498
  "metadata" => metadata,
@@ -504,6 +511,92 @@ module Didit
504
511
  )
505
512
  end
506
513
 
514
+ # Create a KYB party draft
515
+ #
516
+ # Add a party (a person or a company) to the list you are preparing for this KYB session. The same fields and
517
+ # rules as the hosted Key People screen apply: a person needs `full_name` or `first_name` and `last_name`, at
518
+ # least one role and a nationality; a company needs `company_name` and the country of incorporation in
519
+ # `nationality`. Nothing is declared or billed until `POST /v3/session/{sessionId}/kyb/parties/submit/`.
520
+ # Requires `write:businesses`.
521
+ #
522
+ # +POST /v3/session/{sessionId}/kyb/parties/drafts/+
523
+ #
524
+ # @param session_id [String] UUID of the Business Verification (KYB) session. It must belong to the application
525
+ # of the API key.
526
+ # @param entity_type [String] Whether the party is an individual or a company.
527
+ # @param nationality [String] Nationality of a person, or country of incorporation of a company. Required for
528
+ # every party.
529
+ # @param full_name [String] Full name of a person. Send it, or `first_name` and `last_name`.
530
+ # @param first_name [String]
531
+ # @param last_name [String]
532
+ # @param role [String] Role the party holds. Interchangeable with `roles`; when both are sent they are merged.
533
+ # @param roles [Array<String>] Every role the party holds. A person needs at least one role (here or in `role`).
534
+ # @param position [String] Job title of a person.
535
+ # @param date_of_birth [Date, String, nil]
536
+ # @param company_name [String] Name of a company party. Required when `entity_type` is `company`.
537
+ # @param registration_number [String] Registration number of a company party.
538
+ # @param email [String] Where the verification link is sent. Required when the party has to complete
539
+ # verification, which depends on the role settings and ownership thresholds of the workflow.
540
+ # @param ownership_percent [Numeric, nil] Share of the company the party owns.
541
+ # @param phone_number [String]
542
+ # @param custom_fields [Hash] Workflow-defined extra fields.
543
+ # @param skip_verification [Boolean] Ask to skip this party's verification. Honoured only when the party's role
544
+ # allows skipping in the workflow's Key People settings.
545
+ # @param node_id [String] Workflow node of the KYB step. Only needed when the workflow has more than one KYB
546
+ # node; by default Didit uses the session's own node.
547
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
548
+ # @return [Didit::Types::SessionsCreateKybPartyDraftResponse]
549
+ def create_kyb_party_draft(
550
+ session_id,
551
+ entity_type:,
552
+ nationality:,
553
+ full_name: OMIT,
554
+ first_name: OMIT,
555
+ last_name: OMIT,
556
+ role: OMIT,
557
+ roles: OMIT,
558
+ position: OMIT,
559
+ date_of_birth: OMIT,
560
+ company_name: OMIT,
561
+ registration_number: OMIT,
562
+ email: OMIT,
563
+ ownership_percent: OMIT,
564
+ phone_number: OMIT,
565
+ custom_fields: OMIT,
566
+ skip_verification: OMIT,
567
+ node_id: OMIT,
568
+ request_options: nil
569
+ )
570
+ @client.request(
571
+ :post,
572
+ "/v3/session/{sessionId}/kyb/parties/drafts/",
573
+ path_params: { "sessionId" => session_id },
574
+ query: {
575
+ "node_id" => node_id
576
+ },
577
+ body: {
578
+ "entity_type" => entity_type,
579
+ "nationality" => nationality,
580
+ "full_name" => full_name,
581
+ "first_name" => first_name,
582
+ "last_name" => last_name,
583
+ "role" => role,
584
+ "roles" => roles,
585
+ "position" => position,
586
+ "date_of_birth" => date_of_birth,
587
+ "company_name" => company_name,
588
+ "registration_number" => registration_number,
589
+ "email" => email,
590
+ "ownership_percent" => ownership_percent,
591
+ "phone_number" => phone_number,
592
+ "custom_fields" => custom_fields,
593
+ "skip_verification" => skip_verification
594
+ },
595
+ response: Types::SessionsCreateKybPartyDraftResponse,
596
+ request_options: request_options
597
+ )
598
+ end
599
+
507
600
  # Delete a verification session (KYC or KYB)
508
601
  #
509
602
  # Delete a single verification session, User Verification (KYC) or Business Verification (KYB), by its
@@ -517,9 +610,9 @@ module Didit
517
610
  # - All stored files owned by the session: document front/back photos (full, cropped, and privacy-blurred
518
611
  # variants), document-capture videos, portrait crops, NFC chip portrait and signature images, face reference
519
612
  # images, liveness videos, face-match source/target images, Proof of Address documents, and any extra uploaded
520
- # files (KYC); uploaded company documents and extra files (KYB). Electronic Signature documents, signed PDFs,
521
- # evidence PDFs and signature images (KYC and KYB): their download paths stop working. Previously issued media
522
- # URLs (`https://<media-host>/...`) stop resolving.
613
+ # files (KYC); uploaded company documents and extra files (KYB). E-signature documents, signed PDFs, evidence
614
+ # PDFs and signature images (KYC and KYB): their download paths stop working. Previously issued media URLs
615
+ # (`https://<media-host>/...`) stop resolving.
523
616
  # - The session's face data. Its face embedding is deleted too, unless you choose to keep an image-free template
524
617
  # (see **Face biometric data**).
525
618
  # - Webhook deliveries still queued for the session, and their retries. Webhooks already delivered are not
@@ -628,15 +721,40 @@ module Didit
628
721
  )
629
722
  end
630
723
 
724
+ # Delete a KYB party draft
725
+ #
726
+ # Drop one party draft. Declared parties are not affected. Requires `write:businesses`.
727
+ #
728
+ # +DELETE /v3/session/{sessionId}/kyb/parties/drafts/{draftId}/+
729
+ #
730
+ # @param session_id [String] UUID of the Business Verification (KYB) session. It must belong to the application
731
+ # of the API key.
732
+ # @param draft_id [String] UUID of the party draft (`draft_id` returned when it was created).
733
+ # @param node_id [String] Workflow node of the KYB step. Only needed when the workflow has more than one KYB
734
+ # node; by default Didit uses the session's own node.
735
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
736
+ # @return [nil]
737
+ def delete_kyb_party_draft(session_id, draft_id, node_id: OMIT, request_options: nil)
738
+ @client.request(
739
+ :delete,
740
+ "/v3/session/{sessionId}/kyb/parties/drafts/{draftId}/",
741
+ path_params: { "sessionId" => session_id, "draftId" => draft_id },
742
+ query: {
743
+ "node_id" => node_id
744
+ },
745
+ request_options: request_options
746
+ )
747
+ end
748
+
631
749
  # Export AML screening history as CSV
632
750
  #
633
751
  # Download the same ongoing-monitoring history as `GET /v3/session/{sessionId}/aml-screening-history/` as a CSV
634
752
  # file, one line per completed re-screen, newest first, ready to hand to an auditor. The file is streamed whole
635
753
  # (no pagination) and starts with a header line; an empty cell means unknown, dataset dates are never estimated,
636
754
  # and a value that would start a spreadsheet formula is prefixed with an apostrophe. Works for KYC and KYB
637
- # session IDs; pass `node_id` when the session ran more than one AML step. Errors are returned as JSON, not CSV.
638
- # A scoped API key needs `decisions: read` and `media: read`: the response is a file, so a key without `media:
639
- # read` gets `403`.
755
+ # session IDs; pass `node_id` when the session ran more than one AML step. Pass `month` to export one calendar
756
+ # month. Errors are returned as JSON, not CSV. A scoped API key needs `decisions: read` and `media: read`: the
757
+ # response is a file, so a key without `media: read` gets `403`.
640
758
  #
641
759
  # +GET /v3/session/{sessionId}/aml-screening-history/export/+
642
760
  #
@@ -646,15 +764,18 @@ module Didit
646
764
  # route and returns an HTML `404`.
647
765
  # @param node_id [String] Workflow graph node ID of the AML check. Needed only when the session ran more than
648
766
  # one AML step; without it the most recent AML check is used. An unknown node returns `404`.
767
+ # @param month [String] A UTC calendar month as `YYYY-MM`. Only screenings completed in that month are returned;
768
+ # without it every month is returned. A malformed month returns `400`.
649
769
  # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
650
770
  # @return [String, nil] the body bytes, or nil when a block receives the chunks
651
- def export_aml_screening_history(session_id, node_id: OMIT, request_options: nil, &block)
771
+ def export_aml_screening_history(session_id, node_id: OMIT, month: OMIT, request_options: nil, &block)
652
772
  @client.request(
653
773
  :get,
654
774
  "/v3/session/{sessionId}/aml-screening-history/export/",
655
775
  path_params: { "sessionId" => session_id },
656
776
  query: {
657
- "node_id" => node_id
777
+ "node_id" => node_id,
778
+ "month" => month
658
779
  },
659
780
  response: :binary,
660
781
  accept: "text/csv, application/json",
@@ -662,6 +783,35 @@ module Didit
662
783
  )
663
784
  end
664
785
 
786
+ # Export every file of a session
787
+ #
788
+ # Start preparing one ZIP with every image, video and document of a User Verification (KYC) or Business
789
+ # Verification (KYB) session, in original quality: the files are stored in the ZIP as they were captured, never
790
+ # recompressed. Answers `202` with the export; read it with `GET
791
+ # /v3/session/{sessionId}/files-export/{exportId}/` until `status` is `READY`, then download `download_url`.
792
+ # While an export of the same session is still being prepared, that export is returned instead of a new one.
793
+ #
794
+ # The ZIP is deleted 24 hours after it is ready, and at once when the session is deleted. A deleted session
795
+ # cannot be exported. Every export and every download link handed out is written to the session's audit log. A
796
+ # scoped API key needs `media: read` and `decisions: read`; a console user needs the privilege to read sessions.
797
+ #
798
+ # +POST /v3/session/{sessionId}/files-export/+
799
+ #
800
+ # @param session_id [String] UUID of the verification session (the `session_id` returned by `POST
801
+ # /v3/session/`). Accepts both User Verification (KYC) and Business Verification (KYB) session IDs. A deleted
802
+ # session returns `404`.
803
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
804
+ # @return [Didit::Types::SessionFilesExport]
805
+ def export_files(session_id, request_options: nil)
806
+ @client.request(
807
+ :post,
808
+ "/v3/session/{sessionId}/files-export/",
809
+ path_params: { "sessionId" => session_id },
810
+ response: Types::SessionFilesExport,
811
+ request_options: request_options
812
+ )
813
+ end
814
+
665
815
  # Download a PDF report for a verification session
666
816
  #
667
817
  # Render and download a compliance-ready PDF report for a finished verification session. The same path serves
@@ -726,6 +876,31 @@ module Didit
726
876
  )
727
877
  end
728
878
 
879
+ # Get a session files export
880
+ #
881
+ # Progress of an export started with `POST /v3/session/{sessionId}/files-export/`. Once `status` is `READY`,
882
+ # `download_url` is a signed URL of the ZIP that stays valid for a short time; read the export again for a new
883
+ # one until `expires_at`. Each read that hands out a download link is written to the session's audit log. An
884
+ # export of a deleted session returns `404`.
885
+ #
886
+ # +GET /v3/session/{sessionId}/files-export/{exportId}/+
887
+ #
888
+ # @param session_id [String] UUID of the verification session (the `session_id` returned by `POST
889
+ # /v3/session/`). Accepts both User Verification (KYC) and Business Verification (KYB) session IDs. A deleted
890
+ # session returns `404`.
891
+ # @param export_id [String] The `export_id` returned by `POST /v3/session/{sessionId}/files-export/`.
892
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
893
+ # @return [Didit::Types::SessionFilesExport]
894
+ def get_files_export(session_id, export_id, request_options: nil)
895
+ @client.request(
896
+ :get,
897
+ "/v3/session/{sessionId}/files-export/{exportId}/",
898
+ path_params: { "sessionId" => session_id, "exportId" => export_id },
899
+ response: Types::SessionFilesExport,
900
+ request_options: request_options
901
+ )
902
+ end
903
+
729
904
  # Redeem a share token to clone a verification session into your application
730
905
  #
731
906
  # Redeem a share token to clone a KYC or KYB session into the calling application with a fresh `session_id`. Not
@@ -830,6 +1005,12 @@ module Didit
830
1005
  # @param date_to [Date, String] Only sessions created up to this date (UTC), format `YYYY-MM-DD`. For KYC rows
831
1006
  # the entire day is included; for KYB rows the comparison is `created_at <= date_to` (midnight), so use the next
832
1007
  # day's date to include a full day of KYB sessions.
1008
+ # @param tags [String] Comma-separated tag ids (`tags` of your application). Returns the sessions that carry any
1009
+ # of them. Ids that are not valid UUIDs are ignored, and when none is valid the list is empty.
1010
+ # @param decided_from [Time, String] ISO 8601 datetime. Returns the sessions whose status last changed at or
1011
+ # after it. It filters on the time of the last status change, not on creation time.
1012
+ # @param decided_to [Time, String] ISO 8601 datetime. Returns the sessions whose status last changed before it.
1013
+ # Combine with `decided_from` for a half-open window.
833
1014
  # @param country [String] Comma-separated country filter. For KYC rows: ISO 3166-1 alpha-3 codes of the ID
834
1015
  # document's issuing state (e.g. `ESP,USA`), which may differ from nationality. For KYB rows: the registry
835
1016
  # company's country code.
@@ -877,6 +1058,9 @@ module Didit
877
1058
  workflow_id: OMIT,
878
1059
  date_from: OMIT,
879
1060
  date_to: OMIT,
1061
+ tags: OMIT,
1062
+ decided_from: OMIT,
1063
+ decided_to: OMIT,
880
1064
  country: OMIT,
881
1065
  document_type: OMIT,
882
1066
  document_name: OMIT,
@@ -905,6 +1089,9 @@ module Didit
905
1089
  "workflow_id" => workflow_id,
906
1090
  "date_from" => date_from,
907
1091
  "date_to" => date_to,
1092
+ "tags" => tags,
1093
+ "decided_from" => decided_from,
1094
+ "decided_to" => decided_to,
908
1095
  "country" => country,
909
1096
  "document_type" => document_type,
910
1097
  "document_name" => document_name,
@@ -932,8 +1119,8 @@ module Didit
932
1119
  # IDs; pass `node_id` when the session ran more than one AML step. Only ongoing-monitoring re-screens are listed
933
1120
  # (the first screening is part of the session decision) and runs from before this history existed are not
934
1121
  # reconstructed, so a session without ongoing monitoring returns an empty list. `count` is exact up to 100 and
935
- # capped at 100 above that, so follow `next` until it is `null`. A scoped API key needs `decisions: read`; see
936
- # [Continuous AML
1122
+ # capped at 100 above that, so follow `next` until it is `null`. Pass `month` to read one calendar month at a
1123
+ # time. A scoped API key needs `decisions: read`; see [Continuous AML
937
1124
  # monitoring](https://docs.didit.me/core-technology/aml-screening/continuous-monitoring-aml-screening).
938
1125
  #
939
1126
  # +GET /v3/session/{sessionId}/aml-screening-history/+
@@ -944,6 +1131,8 @@ module Didit
944
1131
  # route and returns an HTML `404`.
945
1132
  # @param node_id [String] Workflow graph node ID of the AML check. Needed only when the session ran more than
946
1133
  # one AML step; without it the most recent AML check is used. An unknown node returns `404`.
1134
+ # @param month [String] A UTC calendar month as `YYYY-MM`. Only screenings completed in that month are returned;
1135
+ # without it every month is returned. A malformed month returns `400`.
947
1136
  # @param limit [Integer] Maximum number of screening runs per page. Defaults to 50. A value below 1 or a
948
1137
  # non-numeric value falls back to 50; a value above 1,000,000 returns `400`.
949
1138
  # @param offset [Integer] Number of results to skip before the first returned one. Defaults to 0; a negative or
@@ -957,6 +1146,7 @@ module Didit
957
1146
  def list_aml_screening_history(
958
1147
  session_id,
959
1148
  node_id: OMIT,
1149
+ month: OMIT,
960
1150
  limit: OMIT,
961
1151
  offset: OMIT,
962
1152
  ordering: OMIT,
@@ -968,6 +1158,7 @@ module Didit
968
1158
  path_params: { "sessionId" => session_id },
969
1159
  query: {
970
1160
  "node_id" => node_id,
1161
+ "month" => month,
971
1162
  "limit" => limit,
972
1163
  "offset" => offset,
973
1164
  "ordering" => ordering
@@ -1047,6 +1238,63 @@ module Didit
1047
1238
  )
1048
1239
  end
1049
1240
 
1241
+ # List the parties named by the uploaded documents
1242
+ #
1243
+ # Return the shareholders and directors that the documents uploaded to this KYB session name, merged per person
1244
+ # and attributed to the documents that named them. Show them to your applicant to confirm, then declare them
1245
+ # with the party draft endpoints. A range stays a range: `ownership_percent.text` keeps the verbatim figure and
1246
+ # `min` / `max` the numbers read from it. Nobody is labelled a UBO here; that is decided when the parties are
1247
+ # submitted, from the role settings and ownership thresholds of the workflow. The same list is in the session
1248
+ # decision as `document_verifications[].extracted_parties`. Requires `read:businesses` or `read:sessions`.
1249
+ #
1250
+ # +GET /v3/session/{sessionId}/kyb/extracted-parties/+
1251
+ #
1252
+ # @param session_id [String] UUID of the Business Verification (KYB) session. It must belong to the application
1253
+ # of the API key.
1254
+ # @param node_id [String] Workflow node of the KYB step. Only needed when the workflow has more than one KYB
1255
+ # node; by default Didit uses the session's own node.
1256
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
1257
+ # @return [Didit::Types::SessionsListKybExtractedPartiesResponse]
1258
+ def list_kyb_extracted_parties(session_id, node_id: OMIT, request_options: nil)
1259
+ @client.request(
1260
+ :get,
1261
+ "/v3/session/{sessionId}/kyb/extracted-parties/",
1262
+ path_params: { "sessionId" => session_id },
1263
+ query: {
1264
+ "node_id" => node_id
1265
+ },
1266
+ response: Types::SessionsListKybExtractedPartiesResponse,
1267
+ request_options: request_options
1268
+ )
1269
+ end
1270
+
1271
+ # List the KYB party drafts
1272
+ #
1273
+ # List the parties you are preparing for this KYB session, oldest first. A draft is not a declared party: it
1274
+ # does not appear in the decision or the console and creates no verification session until you submit it with
1275
+ # `POST /v3/session/{sessionId}/kyb/parties/submit/`. Requires `write:businesses`.
1276
+ #
1277
+ # +GET /v3/session/{sessionId}/kyb/parties/drafts/+
1278
+ #
1279
+ # @param session_id [String] UUID of the Business Verification (KYB) session. It must belong to the application
1280
+ # of the API key.
1281
+ # @param node_id [String] Workflow node of the KYB step. Only needed when the workflow has more than one KYB
1282
+ # node; by default Didit uses the session's own node.
1283
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
1284
+ # @return [Didit::Types::SessionsListKybPartyDraftsResponse]
1285
+ def list_kyb_party_drafts(session_id, node_id: OMIT, request_options: nil)
1286
+ @client.request(
1287
+ :get,
1288
+ "/v3/session/{sessionId}/kyb/parties/drafts/",
1289
+ path_params: { "sessionId" => session_id },
1290
+ query: {
1291
+ "node_id" => node_id
1292
+ },
1293
+ response: Types::SessionsListKybPartyDraftsResponse,
1294
+ request_options: request_options
1295
+ )
1296
+ end
1297
+
1050
1298
  # List networks for a session
1051
1299
  #
1052
1300
  # List the networks the session's vendor user belongs to. Resolves through the session's vendor_data-linked
@@ -1225,8 +1473,8 @@ module Didit
1225
1473
  # `ip_analyses`, `database_validations`, `questionnaire_responses`) is a JSON array whose items each carry a
1226
1474
  # `node_id` identifying the workflow graph node that produced them. Read NFC as `response.nfc_verifications[0]`
1227
1475
  # - never as a singular `nfc` field. A block is `null` until the workflow has run that feature at least once;
1228
- # features the workflow does not include never appear with data. Electronic Signature results are in
1229
- # `signatures`, which is present only when the workflow has an Electronic Signature step.
1476
+ # features the workflow does not include never appear with data. E-signature results are in `signatures`, which
1477
+ # is present only when the workflow has an E-signature step.
1230
1478
  #
1231
1479
  # **When to call.** The recommended pattern is event-driven: wait for the `status.updated` webhook that fires
1232
1480
  # when the session reaches a decision (`Approved`, `Declined`, `In Review`), then call this endpoint once to
@@ -1401,11 +1649,47 @@ module Didit
1401
1649
  )
1402
1650
  end
1403
1651
 
1652
+ # Submit the KYB party drafts
1653
+ #
1654
+ # Declare the stored drafts as the company's key people. This is the hosted Key People step under your API key:
1655
+ # Didit decides from the role settings and ownership thresholds of the workflow which parties must be verified,
1656
+ # creates one individual KYC session (or a KYB sub-session for a corporate owner) for each of them, sends the
1657
+ # emails the workflow asks for, and advances the session. Each child session is billed like in the hosted flow.
1658
+ # The drafts are consumed. Repeating the call after a successful submit changes nothing and answers `200` with
1659
+ # `already_submitted: true` and the parties that already exist. The session must be on the Key People step. Send
1660
+ # each person's `kyc_session_url` to them, or embed it. Requires `write:businesses`.
1661
+ #
1662
+ # +POST /v3/session/{sessionId}/kyb/parties/submit/+
1663
+ #
1664
+ # @param session_id [String] UUID of the Business Verification (KYB) session. It must belong to the application
1665
+ # of the API key.
1666
+ # @param locale [String] Locale used to translate the response of the step the session advances to.
1667
+ # @param node_id [String] Workflow node of the KYB step. Only needed when the workflow has more than one KYB
1668
+ # node; by default Didit uses the session's own node.
1669
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
1670
+ # @return [Didit::Types::SessionsSubmitKybPartiesResponse]
1671
+ def submit_kyb_parties(session_id, locale: OMIT, node_id: OMIT, request_options: nil)
1672
+ @client.request(
1673
+ :post,
1674
+ "/v3/session/{sessionId}/kyb/parties/submit/",
1675
+ path_params: { "sessionId" => session_id },
1676
+ query: {
1677
+ "node_id" => node_id
1678
+ },
1679
+ body: {
1680
+ "locale" => locale
1681
+ },
1682
+ response: Types::SessionsSubmitKybPartiesResponse,
1683
+ request_options: request_options
1684
+ )
1685
+ end
1686
+
1404
1687
  # Update an AML hit review status
1405
1688
  #
1406
1689
  # Set the review status of a **single AML hit** (a potential sanction / PEP / watchlist / adverse-media match)
1407
1690
  # returned by AML screening, without changing the overall session decision. Identify the hit by its `hit_id`
1408
- # (the `id` of an entry in the AML check's `hits` array - see the session decision).
1691
+ # (the `id` of an entry in the AML check's `hits` array - see the session decision). A hit id returned in the
1692
+ # earlier format is still accepted; the response always names the hit by its current `id`.
1409
1693
  #
1410
1694
  # `review_status` is one of `Unreviewed`, `Confirmed Match`, `False Positive`, or `Inconclusive`. Reviewer
1411
1695
  # decisions are preserved across ongoing-monitoring updates, so a hit you mark `False Positive` stays that way
@@ -1422,7 +1706,8 @@ module Didit
1422
1706
  #
1423
1707
  # @param session_id [String] UUID of the verification session. Accepts both user (KYC) and business (KYB)
1424
1708
  # session IDs - the service resolves the ID across both session types.
1425
- # @param hit_id [String] The `id` of the hit in the AML check's `hits` array.
1709
+ # @param hit_id [String] The `id` of the hit in the AML check's `hits` array (`hit_...`). A hit id returned in
1710
+ # the earlier format is still accepted.
1426
1711
  # @param review_status [String] The new review status for the hit.
1427
1712
  # @param node_id [String] Optional graph node ID. Use it (here or as a query parameter) when the session has
1428
1713
  # multiple AML checks.
@@ -1942,6 +2227,92 @@ module Didit
1942
2227
  )
1943
2228
  end
1944
2229
 
2230
+ # Edit a KYB party draft
2231
+ #
2232
+ # Change fields of one party draft. The edit is merged into the stored draft and the merged party is validated
2233
+ # as a whole, so an edit that would leave the party incomplete is rejected. Changing `first_name` or `last_name`
2234
+ # replaces the stored full name. Requires `write:businesses`.
2235
+ #
2236
+ # +PATCH /v3/session/{sessionId}/kyb/parties/drafts/{draftId}/+
2237
+ #
2238
+ # @param session_id [String] UUID of the Business Verification (KYB) session. It must belong to the application
2239
+ # of the API key.
2240
+ # @param draft_id [String] UUID of the party draft (`draft_id` returned when it was created).
2241
+ # @param entity_type [String] Whether the party is an individual or a company.
2242
+ # @param full_name [String] Full name of a person. Send it, or `first_name` and `last_name`.
2243
+ # @param first_name [String]
2244
+ # @param last_name [String]
2245
+ # @param role [String] Role the party holds. Interchangeable with `roles`; when both are sent they are merged.
2246
+ # @param roles [Array<String>] Every role the party holds. A person needs at least one role (here or in `role`).
2247
+ # @param position [String] Job title of a person.
2248
+ # @param date_of_birth [Date, String, nil]
2249
+ # @param company_name [String] Name of a company party. Required when `entity_type` is `company`.
2250
+ # @param registration_number [String] Registration number of a company party.
2251
+ # @param email [String] Where the verification link is sent. Required when the party has to complete
2252
+ # verification, which depends on the role settings and ownership thresholds of the workflow.
2253
+ # @param ownership_percent [Numeric, nil] Share of the company the party owns.
2254
+ # @param nationality [String] Nationality of a person, or country of incorporation of a company. Required for
2255
+ # every party.
2256
+ # @param phone_number [String]
2257
+ # @param custom_fields [Hash] Workflow-defined extra fields.
2258
+ # @param skip_verification [Boolean] Ask to skip this party's verification. Honoured only when the party's role
2259
+ # allows skipping in the workflow's Key People settings.
2260
+ # @param node_id [String] Workflow node of the KYB step. Only needed when the workflow has more than one KYB
2261
+ # node; by default Didit uses the session's own node.
2262
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
2263
+ # @return [Didit::Types::SessionsUpdateKybPartyDraftResponse]
2264
+ def update_kyb_party_draft(
2265
+ session_id,
2266
+ draft_id,
2267
+ entity_type: OMIT,
2268
+ full_name: OMIT,
2269
+ first_name: OMIT,
2270
+ last_name: OMIT,
2271
+ role: OMIT,
2272
+ roles: OMIT,
2273
+ position: OMIT,
2274
+ date_of_birth: OMIT,
2275
+ company_name: OMIT,
2276
+ registration_number: OMIT,
2277
+ email: OMIT,
2278
+ ownership_percent: OMIT,
2279
+ nationality: OMIT,
2280
+ phone_number: OMIT,
2281
+ custom_fields: OMIT,
2282
+ skip_verification: OMIT,
2283
+ node_id: OMIT,
2284
+ request_options: nil
2285
+ )
2286
+ @client.request(
2287
+ :patch,
2288
+ "/v3/session/{sessionId}/kyb/parties/drafts/{draftId}/",
2289
+ path_params: { "sessionId" => session_id, "draftId" => draft_id },
2290
+ query: {
2291
+ "node_id" => node_id
2292
+ },
2293
+ body: {
2294
+ "entity_type" => entity_type,
2295
+ "full_name" => full_name,
2296
+ "first_name" => first_name,
2297
+ "last_name" => last_name,
2298
+ "role" => role,
2299
+ "roles" => roles,
2300
+ "position" => position,
2301
+ "date_of_birth" => date_of_birth,
2302
+ "company_name" => company_name,
2303
+ "registration_number" => registration_number,
2304
+ "email" => email,
2305
+ "ownership_percent" => ownership_percent,
2306
+ "nationality" => nationality,
2307
+ "phone_number" => phone_number,
2308
+ "custom_fields" => custom_fields,
2309
+ "skip_verification" => skip_verification
2310
+ },
2311
+ response: Types::SessionsUpdateKybPartyDraftResponse,
2312
+ request_options: request_options
2313
+ )
2314
+ end
2315
+
1945
2316
  # Update Proof of Address data extracted from the POA document on a verification session
1946
2317
  #
1947
2318
  # Correct the fields extracted from the user's Proof of Address document - utility bill, bank statement, or
@@ -2151,6 +2522,59 @@ module Didit
2151
2522
  )
2152
2523
  end
2153
2524
 
2525
+ # Upload KYB documents to a session
2526
+ #
2527
+ # Upload one or more corporate documents (articles of incorporation, shareholder register, certificate of
2528
+ # incorporation, ...) to the KYB Documents step of a Business Verification session, from your own server instead
2529
+ # of the hosted page. Didit runs the hosted pipeline: compression, OCR, tampering and cross-document checks,
2530
+ # document grouping, and advances the session when the required document groups are satisfied. The step costs
2531
+ # one flat fee however many files you send. The session must be open and on the KYB Documents step, and the
2532
+ # company chosen at the registry step must exist. Read the people the documents name with `GET
2533
+ # /v3/session/{sessionId}/kyb/extracted-parties/`. Requires `write:businesses`.
2534
+ #
2535
+ # +POST /v3/session/{sessionId}/kyb/documents/+
2536
+ #
2537
+ # @param session_id [String] UUID of the Business Verification (KYB) session. It must belong to the application
2538
+ # of the API key.
2539
+ # @param documents [Array<Pathname, IO, String, Didit::FilePart>] Files to upload: JPG, JPEG, PNG, TIFF, WEBP,
2540
+ # PDF or ZIP archives of them. PDFs up to 50 MB, photos up to 6 MB before compression.
2541
+ # @param document_passwords [Array<String>] One entry per file in `documents`, in the same order: the password
2542
+ # of a protected PDF, empty for any other file.
2543
+ # @param document_group [String] Required document group this upload answers.
2544
+ # @param locale [String] Locale used to translate the response of the next step.
2545
+ # @param node_id [String] Workflow node of the KYB step. Only needed when the workflow has more than one KYB
2546
+ # node; by default Didit uses the session's own node.
2547
+ # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
2548
+ # @return [Didit::Types::SessionsUploadKybDocumentsResponse]
2549
+ def upload_kyb_documents(
2550
+ session_id,
2551
+ documents:,
2552
+ document_passwords: OMIT,
2553
+ document_group: OMIT,
2554
+ locale: OMIT,
2555
+ node_id: OMIT,
2556
+ request_options: nil
2557
+ )
2558
+ @client.request(
2559
+ :post,
2560
+ "/v3/session/{sessionId}/kyb/documents/",
2561
+ path_params: { "sessionId" => session_id },
2562
+ query: {
2563
+ "node_id" => node_id
2564
+ },
2565
+ body: {
2566
+ "documents" => documents,
2567
+ "document_passwords" => document_passwords,
2568
+ "document_group" => document_group,
2569
+ "locale" => locale
2570
+ },
2571
+ encoding: :multipart,
2572
+ file_fields: %w[documents],
2573
+ response: Types::SessionsUploadKybDocumentsResponse,
2574
+ request_options: request_options
2575
+ )
2576
+ end
2577
+
2154
2578
  # The +sessions.imports+ resource.
2155
2579
  class Imports < Didit::Resource
2156
2580
  # Cancel an import job
@@ -2209,7 +2633,11 @@ module Didit
2209
2633
  # another provider: Didit reads Sumsub, Onfido, Persona and ComplyCube with your read-only key, reads Veriff,
2210
2634
  # iDenfy and MetaMap records by the IDs you upload in `file`, and imports an export file in Didit's format for
2211
2635
  # the other providers. Record IDs are namespaced by provider (`sumsub:<id>`) so a re-run skips everything
2212
- # already in Didit. Imports are disabled by default and must be enabled per organization by Didit.
2636
+ # already in Didit, and a record imported through a file with the provider's bare ID is recognised too, in
2637
+ # both directions, so moving between a file import and a provider migration never imports a record twice. An
2638
+ # application can run up to 4 import jobs at once; a job interrupted by a deploy or a worker restart continues
2639
+ # from its last imported row by itself. Imports are disabled by default and must be enabled per organization
2640
+ # by Didit.
2213
2641
  #
2214
2642
  # +POST /v3/session/imports/+
2215
2643
  #
@@ -2610,19 +3038,20 @@ module Didit
2610
3038
  class Signatures < Didit::Resource
2611
3039
  # Download a signed document
2612
3040
  #
2613
- # Download the signed PDF of one document of an Electronic Signature step. Use the `signed_file` path of
3041
+ # Download the signed PDF of one document of an E-signature step. Use the `signed_file` path of
2614
3042
  # `signatures[].documents[]` in the decision. The PDF holds the document the signer was shown with their field
2615
- # values stamped, the evidence page (unless `signature_evidence_page` is off) and the PAdES signature with its
2616
- # timestamp. Didit checks the file against `sha256_signed` before returning it.
3043
+ # values stamped and the evidence page (unless `signature_evidence_page` is off). An Advanced (AES) PDF also
3044
+ # carries the PAdES signature with its timestamp; a Simple PDF has no digital signature, seal or timestamp.
3045
+ # Didit checks the file against `sha256_signed` before returning it.
2617
3046
  #
2618
3047
  # Works for User Verification (KYC) and Business Verification (KYB) sessions. Needs `read:sessions`; your API
2619
- # key works. See the [Electronic Signature
3048
+ # key works. See the [E-signature
2620
3049
  # report](/core-technology/electronic-signature/report-electronic-signature#download-the-signed-documents).
2621
3050
  #
2622
3051
  # +GET /v3/session/{sessionId}/signatures/{nodeId}/documents/{documentId}/file/+
2623
3052
  #
2624
3053
  # @param session_id [String] The User Verification (KYC) or Business Verification (KYB) session.
2625
- # @param node_id [String] The Electronic Signature step: `node_id` of the item in `signatures[]`.
3054
+ # @param node_id [String] The E-signature step: `node_id` of the item in `signatures[]`.
2626
3055
  # @param document_id [String] `id` of the document in `signatures[].documents[]`.
2627
3056
  # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
2628
3057
  # @return [String, nil] the body bytes, or nil when a block receives the chunks
@@ -2639,10 +3068,10 @@ module Didit
2639
3068
 
2640
3069
  # Download the signature evidence
2641
3070
  #
2642
- # Download a signer's evidence PDF: the level and format, the signer and their verified identity session, the
2643
- # code confirmation, the IP address, each document with its original SHA-256 and field values, the
2644
- # certificate, the timestamp and the SHA-256 of every signed file. Use the `evidence_file` path of the
2645
- # signer's item in `signatures[]`.
3071
+ # Download a signer's evidence PDF: the level and format, the signer, the IP address, each document with its
3072
+ # original SHA-256 and field values and the SHA-256 of every signed file, plus, for an Advanced (AES)
3073
+ # signature, the verified identity session, the code confirmation, the certificate and the timestamp. Use the
3074
+ # `evidence_file` path of the signer's item in `signatures[]`.
2646
3075
  #
2647
3076
  # Always pass `signature_id` when a Business Verification step has several signers: without it, the route
2648
3077
  # picks one of the step's signers. Needs `read:sessions`; your API key works.
@@ -2650,7 +3079,7 @@ module Didit
2650
3079
  # +GET /v3/session/{sessionId}/signatures/{nodeId}/evidence/+
2651
3080
  #
2652
3081
  # @param session_id [String] The User Verification (KYC) or Business Verification (KYB) session.
2653
- # @param node_id [String] The Electronic Signature step: `node_id` of the item in `signatures[]`.
3082
+ # @param node_id [String] The E-signature step: `node_id` of the item in `signatures[]`.
2654
3083
  # @param signature_id [String] `id` of the signer's item in `signatures[]`.
2655
3084
  # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
2656
3085
  # @return [String, nil] the body bytes, or nil when a block receives the chunks
@@ -2676,7 +3105,7 @@ module Didit
2676
3105
  # +GET /v3/session/{sessionId}/signatures/{nodeId}/fields/{fieldId}/image/+
2677
3106
  #
2678
3107
  # @param session_id [String] The User Verification (KYC) or Business Verification (KYB) session.
2679
- # @param node_id [String] The Electronic Signature step: `node_id` of the item in `signatures[]`.
3108
+ # @param node_id [String] The E-signature step: `node_id` of the item in `signatures[]`.
2680
3109
  # @param field_id [String] The field on this signer's copy, as in the field's `image_url`.
2681
3110
  # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
2682
3111
  # @return [String, nil] the body bytes, or nil when a block receives the chunks
@@ -2693,8 +3122,9 @@ module Didit
2693
3122
 
2694
3123
  # Validate signatures again
2695
3124
  #
2696
- # Re-check the signed documents of an Electronic Signature step. Didit re-reads every signed PDF, checks its
2697
- # SHA-256 and validates the PAdES signature, the certificate, the revocation data and the timestamp, then
3125
+ # Re-check the signed documents of an E-signature step. Didit re-reads every signed PDF, checks its SHA-256
3126
+ # and, for an Advanced (AES) signature, validates the PAdES signature, the certificate, the revocation data
3127
+ # and the timestamp (a Simple signature has no digital signature, so only the file integrity is checked), then
2698
3128
  # saves the result in each signer's `validation` and returns the updated items. Nothing is signed again. Send
2699
3129
  # `signature_id` to check one signer; without it, every signer of the step is checked, and the call fails if
2700
3130
  # any of them hasn't signed.
@@ -2704,7 +3134,7 @@ module Didit
2704
3134
  # +POST /v3/session/{sessionId}/signatures/{nodeId}/validate/+
2705
3135
  #
2706
3136
  # @param session_id [String] The User Verification (KYC) or Business Verification (KYB) session.
2707
- # @param node_id [String] The Electronic Signature step: `node_id` of the item in `signatures[]`.
3137
+ # @param node_id [String] The E-signature step: `node_id` of the item in `signatures[]`.
2708
3138
  # @param signature_id [String] `id` of one signer's item in `signatures[]`.
2709
3139
  # @param request_options [Hash, nil] :timeout, :max_retries, :extra_headers, :extra_query, :extra_body
2710
3140
  # @return [Didit::Types::SessionsSignaturesValidateResponse]