> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pingintel.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Permission for User

> Create a new user membership. Supply exactly one of company_uuid, division_uuid, or team_uuid, along with the desired membership_type (defaults to 'member').

**Identifying the user** — supply exactly one of:
- `user_id`: integer PK of an existing user who already shares a team with the caller. Used when the caller has already discovered the user via the membership list endpoint.
- `user_email`: email of the user to add. The view does a case-insensitive lookup; if no match,   a new inactive user is created. Optionally include `first_name` and `last_name` to populate   the new user record (ignored if the user already exists).

Note: `user_email`, `first_name`, and `last_name` are consumed by the view before reaching the serializer. They do not appear as serializer input fields.



## OpenAPI

````yaml https://vision.staging.pingintel.com/api/schema/?format=json post /api/v1/memberships
openapi: 3.0.3
info:
  title: Ping.Vision API
  version: v1.0
  description: >
    ### Ping.Vision API


    This API provides convenient, efficient access to Ping Intel's data and
    services. It is designed to be used by developers and data scientists to
    integrate Ping Intel's capabilities into their applications.


    Once SSO is set up with your organization, you can create an Organization or
    Personal API key at https://auth.pingintel.com/org.


    Please see the Python client library
    [pingintel-api](https://pypi.org/project/pingintel-api/) for commandline
    tools and programmatic access, and you

    can refer to the following documentation for details on interacting with the
    system via the HTTP API.
  contact:
    email: support@pingintel.com
    name: Ping Intel
    url: https://www.pingintel.com
servers:
  - url: https://vision.pingintel.com
    description: Ping.Vision API
  - url: https://vision.staging.pingintel.com
    description: Ping.Vision API (staging)
security: []
tags:
  - name: Create Submission
    description: The Create Submission API allows you to add new data into the system.
  - name: Update Submission
    description: >-
      The Update Submission API provides various endpoints to update, modify, or
      act upon existing submissions.
  - name: Get Submission Data
    description: ''
  - name: User Memberships
    description: >-
      The User Memberships API allows you to add, remove, and change the role of
      users in different teams, divisions, or companies.
  - name: Miscellaneous
    description: ''
paths:
  /api/v1/memberships:
    post:
      tags:
        - User Memberships
      summary: Add Permission for User
      description: >-
        Create a new user membership. Supply exactly one of company_uuid,
        division_uuid, or team_uuid, along with the desired membership_type
        (defaults to 'member').


        **Identifying the user** — supply exactly one of:

        - `user_id`: integer PK of an existing user who already shares a team
        with the caller. Used when the caller has already discovered the user
        via the membership list endpoint.

        - `user_email`: email of the user to add. The view does a
        case-insensitive lookup; if no match,   a new inactive user is created.
        Optionally include `first_name` and `last_name` to populate   the new
        user record (ignored if the user already exists).


        Note: `user_email`, `first_name`, and `last_name` are consumed by the
        view before reaching the serializer. They do not appear as serializer
        input fields.
      operationId: api_v1_memberships_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserMembership'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/UserMembership'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UserMembership'
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserMembership'
          description: ''
      security:
        - authorization_header: []
components:
  schemas:
    UserMembership:
      type: object
      properties:
        temporary_override:
          type: boolean
          readOnly: true
          description: >-
            True if this membership is a temporary override. While temporary
            memberships are active, the user's normal memberships are ignored.
        user_email:
          type: string
          readOnly: true
          description: >-
            Email address of the member. On create, supply user_email instead of
            user_id to add a user by email; if no account exists, one will be
            created. Optionally include first_name and last_name to populate the
            new account.
        user_first_name:
          type: string
          readOnly: true
          description: First name of the member.
        user_last_name:
          type: string
          readOnly: true
          description: Last name of the member.
        uuid:
          type: string
          format: uuid
          readOnly: true
          description: UUID of this membership record.
        company_uuid:
          type: string
          format: uuid
          nullable: true
          description: UUID of the company the user belongs to.
        division_uuid:
          type: string
          format: uuid
          nullable: true
          description: UUID of the division the user belongs to.
        membership_type:
          enum:
            - member
            - admin
            - owner
          type: string
          x-spec-enum-id: 6e79212160cb0401
          default: member
          description: >-
            Role of the user within the team, division, or company. Defaults to
            'member'.


            * `member` - Member

            * `admin` - Admin

            * `owner` - Owner
        team_uuid:
          type: string
          format: uuid
          nullable: true
          description: UUID of the team the user belongs to.
        user_id:
          type: integer
          description: >-
            ID of the user. On create, supply either user_id (for an existing
            user) or user_email.
      required:
        - temporary_override
        - user_email
        - user_first_name
        - user_last_name
        - uuid
  securitySchemes:
    authorization_header:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Supports `Token `-prefixed API keys and `Bearer `-prefixed JWT-based
        authentication.

````