Creating a profile

Accounts created on a site are either users or profiles (Read more about Accounts, roles and subscriptions). We are interested here in the different use cases under which an profile is created.

There are two ways to create a profile, either directly or as a side-effect of inviting a user to the site. The following APIs are available to create a profile:

Registers a user

The easiest way to create a profile is to do so alongside the initial registration of a user to the site (API Reference). By specifying type as either personal or organization, the site will registers a new user, create a profile and connect the profile manager role for the newly created profile to the registered user.

When the type is set to organization, an organization_name must be specified alongside the user registration fields.

example
curl -X POST -H 'Content-Type: application/json; charset=UTF-8' -d '{"username": "joe1", "password": "yoyo", "email": "joe+1@example.com", "full_name": "Joe Card1", "type": "personal"}' /api/auth/register

Creates a connected profile

Often you will have a user that becomes familiar with the site because they were invited to contribute to an organization. These users might wish to create their own organization profile for personal use and/or as part of a new project.

Your onboarding flow might be separated in multiple steps where information about the organization is filled after the initial registration.

In those cases, a user already exist. You want to create a new profile and connect the profile manager role for the newly created profile to the user. (API Reference)

example
JWT_TOKEN=`curl -X POST -H 'Content-Type: application/json; charset=UTF-8' -d '{"username": "xia", "password": "yoyo"}' /api/auth | jq -r .token`
curl -H "Authorization: Bearer ${JWT_TOKEN}" -X POST -H 'Content-Type: application/json; charset=UTF-8' -d '{"slug": "myproject", "full_name": "My Project"}' /api/users/xia/profiles

Grants a subscription

In cases where registration is disabled, or the business workflow requires providers to invite subscribers, a profile might be created as part of subscribing an otherwise unknown e-mail address. (API Reference)

example
JWT_TOKEN=`curl -X POST -H 'Content-Type: application/json; charset=UTF-8' -d '{"username": "donny", "password": "yoyo"}' /api/auth  | jq -r .token`
curl -H "Authorization: Bearer ${JWT_TOKEN}" -X POST -H 'Content-Type: application/json; charset=UTF-8' -d '{"organization": {"slug": "xia"}}' /api/profile/cowork/plans/premium/subscriptions

Creates a shadow profile

In the use cases where you store data and metrics information into your application database, wish to keep personally identifiable information into the djaoapp database and re-associate both in the client application as necessary, you might create shadow profiles; profiles that solely exist to de-anymize datasets but otherwise have no connected profile manager. (API Reference)

Note that until a profile manager is connected to a shadow profile, updates to the profile requires a broker role, or a provider role on an active subscriptions of that shadow profile.

example
JWT_TOKEN=`curl -X POST -H 'Content-Type: application/json; charset=UTF-8' -d '{"username": "xia", "password": "yoyo"}' /api/auth | jq -r .token`
curl -H "Authorization: Bearer ${JWT_TOKEN}" -X POST -H 'Content-Type: application/json; charset=UTF-8' -d '{"email": "xia@locahost.localdomain", "full_name": "Joey Black"}' /api/accounts/profiles