v4

latestOpenAPI 3.1.1Apache 2.02026-07-31107278570.4 KB
Users

Add existing user to organization

Adds an existing user to an organization and assigns them specific roles and permissions. Use this endpoint when you want to grant an existing user access to a particular organization. You can specify roles, metadata, and other membership details during the invitation process.

post/api/v1/memberships/organizations/{organization_id}/users/{id}

Path parameters

organization_idstring required

Unique identifier of the target organization. Must start with 'org_' and be 1-32 characters long.

idstring required

System-generated user ID. Must start with 'usr_' (19-25 characters)

Query parameters

send_invitation_emailboolean

If true, sends an activation email to the user. Defaults to true.

Request body

inviter_emailstring

Email address of the user who invited this member. Must be a valid email address.

metadataobject

Custom key-value pairs for storing additional user context. Keys (3-25 chars), values (1-256 chars).

Example request

{
  "inviter_email": "john.doe@example.com",
  "metadata": {
    "department": "engineering",
    "location": "nyc-office"
  },
  "roles": [
    {
      "name": "admin"
    }
  ]
}

Response

User successfully added to the organization. Returns details of the updated membership details

Example response

{
  "user": {
    "email": "user@example.com",
    "external_id": "ext_12345a67b89c",
    "id": "usr_1234abcd5678efgh",
    "memberships": [
      {
        "display_name": "Acme Corporation",
        "metadata": {
          "department": "engineering",
          "location": "nyc-office"
        },
        "name": "AcmeCorp",
        "organization_id": "org_1234abcd5678efgh",
        "permissions": [
          "read_projects",
          "write_tasks",
          "manage_users"
        ],
        "roles": [
          {
            "display_name": "Dev Team",
            "id": "role_79643236410327240",
            "name": "team_dev"
          }
        ]
      }
    ],
    "metadata": {
      "department": "engineering",
      "location": "nyc-office"
    },
    "user_profile": {
      "custom_attributes": {
        "department": "engineering",
        "security_clearance": "level2"
      },
      "email_verified": true,
      "external_identities": [
        {
          "connection_id": "conn_1234abcd5678efgh",
          "connection_type": "OAUTH",
          "connection_user_id": "ext_user_12345",
          "is_social": true
        }
      ],
      "family_name": "Doe",
      "gender": "male",
      "given_name": "John",
      "groups": [
        "admin",
        "developer"
      ],
      "id": "usr_profile_1234abcd5678efgh",
      "locale": "en-US",
      "metadata": {
        "department": "engineering",
        "employee_type": "full-time",
        "idp_user_id": "12345"
      },
      "name": "John Michael Doe",
      "phone_number": "+14155552671",
      "phone_number_verified": true,
      "picture": "https://example.com/avatar.jpg",
      "preferred_username": "johndoe"
    }
  }
}