---
descriptions:
  create_organization_membership:
    role_slug: >-
      A single role identifier. Defaults to `member` or the explicit default
      role. Mutually exclusive with `role_slugs`.
    role_slugs: >-
      An array of role identifiers. Mutually exclusive with `role_slug`. Limited
      to one role when Multiple Roles is disabled.
reference:
  curl:
    - key: create_organization_membership
      id: create_organization_membership
      url: /reference/authkit/organization-membership/create
      title: /user_management/organization_memberships
      type: POST
      parameters:
        - key: user_id
          type: string
          description: (organization_membership.user_id)
        - key: organization_id
          type: string
          description: (organization_membership.organization_id)
        - key: role_slug
          type: string
          description: (create_organization_membership.role_slug)
          optional: true
        - key: role_slugs
          type: array
          description: (create_organization_membership.role_slugs)
          optional: true
      returns:
        - (organization_membership)
  js:
    - key: createOrganizationMembership
      id: create_organization_membership
      url: /reference/authkit/organization-membership/create
      title: userManagement.createOrganizationMembership()
      parameters:
        - key: options
          type: object
          unwrap: true
          properties:
            - (OrganizationMembership.userId)
            - (OrganizationMembership.organizationId)
            - key: roleSlug
              type: string
              optional: true
              description: (create_organization_membership.role_slug)
            - key: roleSlugs
              type: array
              optional: true
              description: (create_organization_membership.role_slugs)
      returns:
        - (OrganizationMembership)
  go:
    - key: CreateOrganizationMembership
      id: create_organization_membership
      url: /reference/authkit/organization-membership/create
      title: usermanagement.CreateOrganizationMembership()
      parameters:
        - (ctx)
        - key: opts
          type: usermanagement.CreateOrganizationMembershipOpts
          unwrap: true
          properties:
            - key: UserId
              type: string
              description: (organization_membership.user_id)
            - key: OrganizationID
              type: string
              description: (organization_membership.organization_id)
            - key: RoleSlug
              type: string
              description: (create_organization_membership.role_slug)
              optional: true
      returns:
        - key: organizationMembership
          type: usermanagement.OrganizationMembership
          description: (organization_membership.self)
        - (err)
  php:
    - key: createOrganizationMembership
      id: create_organization_membership
      url: /reference/authkit/organization-membership/create
      title: $userManagement->createOrganizationMembership()
      parameters:
        - key: userId
          type: string
          description: (organization_membership.user_id)
        - key: organizationId
          type: string
          description: (organization_membership.organization_id)
        - key: roleSlug
          type: string
          optional: true
          description: (create_organization_membership.role_slug)
  python:
    - key: create_organization_membership
      id: create_organization_membership
      url: /reference/authkit/organization-membership/create
      title: user_management.create_organization_membership()
      parameters:
        - key: user_id
          type: str
          description: (organization_membership.user_id)
        - key: organization_id
          type: str
          description: (organization_membership.organization_id)
        - key: role_slug
          type: str
          optional: true
          description: (create_organization_membership.role_slug)
        - key: role_slugs
          type: 'List[str]'
          optional: true
          description: (create_organization_membership.role_slugs)
      returns:
        - (OrganizationMembership)
  ruby:
    - key: create_organization_membership
      id: create_organization_membership
      url: /reference/authkit/organization-membership/create
      title: UserManagement.create_organization_membership()
      parameters:
        - (OrganizationMembership.user_id)
        - (OrganizationMembership.organization_id)
        - key: role_slug
          type: String
          optional: true
          description: (create_organization_membership.role_slug)
      returns:
        - (OrganizationMembership)
  java:
    - key: createOrganizationMembership
      id: create_organization_membership
      url: /reference/authkit/organization-membership/create
      title: userManagement.createOrganizationMembership()
      parameters:
        - key: options
          type: CreateOrganizationMembershipOptions
          unwrap: true
          properties:
            - key: userId
              type: String
              description: (organization_membership.user_id)
            - key: organizationId
              type: String
              description: (organization_membership.organization_id)
            - key: roleSlug
              type: String
              optional: true
              description: (organization_membership.role.slug)
      returns:
        - (OrganizationMembership)
originalPath: >-
  .tmp-workos-clone/packages/docs/content/reference/authkit/organization-membership/create.mdx
---

## Create an organization membership

Creates a new `active` organization membership for the given organization and user.

Calling this API with an organization and user that match an `inactive` organization membership will activate the membership with the specified role(s).

<CodeBlock referenceId="create_organization_membership">
  <CodeBlockTab title="Request" file="create-organization-membership-request" />
  <CodeBlockTab
    title="Response"
    file="create-organization-membership-response"
  />
</CodeBlock>
