Create an Organization Child Account

Create child accounts you manage who can send and receive payments

Overview

Wingspan offers a framework called “Organization User Accounts” that allows an account to create and manage child accounts.

This quick start guide provides an overview of how to create a new child account within an organization.

Step-By-Step

1. Create a New Organization User Account

User the Organization User Account Create endpoint:

curl -X POST --data '{"email":"[email protected]"}' \
<API URL>/users/organization/user \
-H "Content-Type: application/json" -H "Authorization: $AUTH" | json_pp

{
   "createdAt" : "2022-09-03T19:46:40.748Z",
   "email" : "[email protected]",
   "emailVerificationState" : {},
   "id" : "<New Org User>",
   "isPasswordSet" : false,
   "labels" : {
      "createdBy" : "<Creating User>"
   },
   "notificationSettings" : {
      "newsletters" : false,
      "reviewNotifications" : false
   },
   "phone" : {},
   "profile" : {},
   "settings" : {},
   "status" : "Pending",
   "updatedAt" : "2022-09-03T19:46:40.748Z",
   "userId" : "<New Org User>",
   "userRoles" : {
      "ownerIds" : [
         "<Creating User>"
      ],
      "viewerIds" : []
   }
}

2. Associate the new Account to your Organization

curl -X POST --data '{"parentUserId":"<Parent User>"}' \
<API URL>/users/organization/user/<New Org User>/associate \
-H "Content-Type: application/json" -H "Authorization: $AUTH" | json_pp

{
   "childUserId" : "<New Org User>",
   "createdAt" : "2022-09-03T19:46:40.748Z",
   "id" : "<ID of the association>",
   "labels" : {},
   "organizationAccountId" : "<ID of the association>",
   "organizationId" : "<ID of the organization user main ID (root)>",
   "parentUserId" : "<ID of the parent user of this account>",
   "updatedAt" : "2022-09-03T19:46:40.748Z",
   "userId" : "<ID of the parent user>",
   "userRoles" : {
      "ownerIds" : [
         "<ID of the parent user>"
      ],
      "viewerIds" : [
         "<ID of the parent user>"
      ]
   }
}

3. Create a new Session to Act On Behalf of the User

curl <API URL>/users/organization/user/<New Org User>/session \ 
-H "Authorization: $AUTH" | json_pp

{
   "expiration" : "2022-09-03T20:46:40.748Z",
   "sessionType" : "User",
   "token" : "<Authorization Bearer Token>",
   "userId" : "<New Org User>"
}