Skip to content

Commit

Permalink
docs: document batch create identities
Browse files Browse the repository at this point in the history
<!--
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.

This text will be included in the changelog. If applicable, include links to documentation or pieces of code.
If your change includes breaking changes please add a code block documenting the breaking change:

```
BREAKING CHANGES: This patch changes the behavior of configuration item `foo` to do bar. To keep the existing
behavior please do baz.
```
-->

## Related Issue or Design Document

<!--
If this pull request

1. is a fix for a known bug, link the issue where the bug was reported in the format of `#1234`;
2. is a fix for a previously unknown bug, explain the bug and how to reproduce it in this pull request;
3. implements a new feature, link the issue containing the design document in the format of `#1234`;
4. improves the documentation, no issue reference is required.

Pull requests introducing new features, which do not have a design document linked are more likely to be rejected and take on average 2-8 weeks longer to
get merged.

You can discuss changes with maintainers either in the Github Discussions in this repository or
join the [Ory Chat](https://www.ory.sh/chat).
-->

## Checklist

<!--
Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of
them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
-->

- [ ] I have read the [contributing guidelines](../blob/master/CONTRIBUTING.md) and signed the CLA.
- [ ] I have referenced an issue containing the design document if my change introduces a new feature.
- [ ] I have read the [security policy](../security/policy).
- [ ] I confirm that this pull request does not address a security vulnerability.
      If this pull request addresses a security vulnerability,
      I confirm that I got approval (please contact [[email protected]](mailto:[email protected])) from the maintainers to push the changes.
- [ ] I have added tests that prove my fix is effective or that my feature works.
- [ ] I have added the necessary documentation within the code base (if appropriate).

## Further comments

<!--
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution
you did and what alternatives you considered, etc...
-->
  • Loading branch information
hperl committed Aug 17, 2023
1 parent 768fc21 commit 3b344e0
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
80 changes: 80 additions & 0 deletions docs/migrate-to-ory/import-identities.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
id: import-identities
title: Bulk-import identities from other providers
sidebar_label: Bulk-import identities
slug: bulk-import-identities
---

# Bulk-import identities from other providers

To import multiple identities into Ory Identites, use the
[Identity Import API](https://www.ory.sh/docs/reference/api#tag/identity/operation/batchPatchIdentities).

A maximum of 2000 identities can be created in a single request. If you need to import more identities, you can split the import
into multiple requests.

The endpoint accepts a JSON array of identities, each of which must have a `create` propery which holds the identity that should
be created. Optionally, you can specify a `patch_id` property which will be returned in the response. This can be used to
correlate the response with the patch.

The following example shows how to import two identities. It will create two identities with the email addresses `[email protected]`
and `[email protected]` and the passwords `foopassword` and `barpassword` respectively.

```bash
curl --location --request PATCH 'https://${YOUR_PROJECT_SLUG}.projects.oryapis.com/admin/identities' \
--header 'Authorization: Bearer ${YOUR_ORY_ACCESS_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"identities": [
{
"create": {
"credentials": {
"password": {
"config": {
"password": "foopassword"
}
}
},
"state": "active",
"traits": {
"email": "[email protected]"
},
"schema_id": "preset://email"
}
},
{
"create": {
"credentials": {
"password": {
"config": {
"password": "barpassword"
}
}
},
"state": "active",
"traits": {
"email": "[email protected]"
},
"schema_id": "preset://email"
}
}
]
}'
```

The service will respond with the two identity IDs created:

```json
{
"identities": [
{
"action": "create",
"identity": "55f93ea4-09ff-4273-8b88-082cc70d6d44"
},
{
"action": "create",
"identity": "f70c9b29-4790-4330-90dc-920db16a4b85"
}
]
}
```
1 change: 1 addition & 0 deletions src/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ module.exports = {
items: [
"hydra/self-hosted/migrating-from-mitreid",
"migrate-to-ory/auth0",
"migrate-to-ory/import-identities",
],
},
{
Expand Down

0 comments on commit 3b344e0

Please sign in to comment.