@@ -581,8 +581,8 @@ A maximum of 2000 identities can be created in a single request. If you need to
581581multiple requests.
582582
583583The endpoint accepts a JSON array of identities, each of which must have a `create` property that holds the identity that should
584- be created. Optionally, you can specify a `patch_id` property which will be returned in the response. This can be used to
585- correlate the response with the patch.
584+ be created. Optionally, you can specify a `patch_id` property ( which must be a UUID) which will be returned in the response. This
585+ can be used to correlate the response with the patch.
586586
587587The following example shows how to import two identities. It will create two identities with the email addresses `foo@example.com`
588588and `bar@example.com` and the passwords `foopassword` and `barpassword` respectively.
@@ -594,6 +594,8 @@ curl --location --request PATCH 'https://${YOUR_PROJECT_SLUG}.projects.oryapis.c
594594--data-raw '{
595595 "identities": [
596596 {
597+ # highlight-next-line
598+ "patch_id": "6086b0a8-d851-5431-91b4-b6e5e39dc88b",
597599 "create": {
598600 "credentials": {
599601 "password": {
@@ -609,7 +611,9 @@ curl --location --request PATCH 'https://${YOUR_PROJECT_SLUG}.projects.oryapis.c
609611 "schema_id": "preset://email"
610612 }
611613 },
612- {
614+ {
615+ # highlight-next-line
616+ "patch_id": "d554dc00-49ce-5381-9bdc-79637dec85a2",
613617 "create": {
614618 "credentials": {
615619 "password": {
@@ -629,19 +633,73 @@ curl --location --request PATCH 'https://${YOUR_PROJECT_SLUG}.projects.oryapis.c
629633}'
630634` ` `
631635
632- The service will respond with the two identity IDs created :
636+ The service will respond with the two identity IDs created. Note that the `patch_id` is returned in the response to correlate the
637+ response with the request.
633638
634639` ` ` json
635640{
636641 "identities": [
637642 {
638643 "action": "create",
644+ // highlight-next-line
645+ "patch_id": "6086b0a8-d851-5431-91b4-b6e5e39dc88b",
639646 "identity": "55f93ea4-09ff-4273-8b88-082cc70d6d44"
640647 },
641648 {
642649 "action": "create",
650+ // highlight-next-line
651+ "patch_id": "d554dc00-49ce-5381-9bdc-79637dec85a2",
643652 "identity": "f70c9b29-4790-4330-90dc-920db16a4b85"
644653 }
645654 ]
646655}
647656` ` `
657+
658+ # ## Errors during bulk import
659+
660+ Failure to import an identity will not fail the whole bulk import. In the response, `"action" : " error" ` indicates that the
661+ identity with the corresponding ` patch_id` (which can be set on each identity passed to `PATCH /admin/identities`) could not be
662+ imported. The `error` object contains more details about why the import failed.
663+
664+ This is an example response where two identities were created and two imports failed :
665+
666+ ` ` ` json
667+ {
668+ "identities": [
669+ {
670+ "action": "create",
671+ "identity": "0d0ed560-43ce-42a9-bd40-aafe921c3af1",
672+ "patch_id": "6086b0a8-d851-5431-91b4-b6e5e39dc88b"
673+ },
674+ {
675+ // highlight-start
676+ "action": "error",
677+ "patch_id": "d554dc00-49ce-5381-9bdc-79637dec85a2",
678+ "error": {
679+ "code": 400,
680+ "status": "Bad Request",
681+ "reason": "The request was malformed or contained invalid parameters",
682+ "message": "The request was malformed or contained invalid parameters"
683+ }
684+ // highlight-end
685+ },
686+ {
687+ // highlight-start
688+ "action": "error",
689+ "patch_id": "1634f1e9-8419-5a54-8191-2260c8aaea31",
690+ "error": {
691+ "code": 409,
692+ "status": "Conflict",
693+ "reason": "This identity conflicts with another identity that already exists.",
694+ "message": "The resource could not be created due to a conflict"
695+ }
696+ // highlight-end
697+ },
698+ {
699+ "action": "create",
700+ "identity": "b8651770-be8d-460b-b86f-679c4ba50264",
701+ "patch_id": "eade6651-9311-5624-8afd-e4a3e05e0c4a"
702+ }
703+ ]
704+ }
705+ ` ` `
0 commit comments