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

# Create Membership

> Create a new membership linking a person to a workspace with a specific role



## OpenAPI

````yaml POST /v1/memberships
openapi: 3.1.0
info:
  title: Well Document API
  version: 1.0.0
  description: API for uploading and managing financial documents in the Well platform
servers:
  - url: https://api.wellapp.ai
security: []
paths:
  /v1/memberships:
    post:
      summary: Create a new membership
      description: >-
        Create a new membership linking a person to a workspace with a specific
        role
      parameters:
        - $ref: '#/components/parameters/AuthorizationHeader'
      requestBody:
        required: true
        content:
          application/json:
            example:
              type: membership
              attributes:
                role: member
              relationships:
                workspace:
                  data:
                    type: workspace
                    id: 550e8400-e29b-41d4-a716-446655440003
                person:
                  data:
                    type: people
                    id: 550e8400-e29b-41d4-a716-446655440000
            schema:
              $ref: '#/components/schemas/MembershipCreateRequest'
      responses:
        '201':
          description: Membership created successfully
          content:
            application/json:
              example:
                data:
                  type: memberships
                  id: 550e8400-e29b-41d4-a716-446655440007
                  attributes:
                    role: member
                    created_at: '2024-01-20T10:30:00Z'
                    updated_at: '2024-01-20T10:30:00Z'
                  relationships:
                    workspace:
                      data:
                        type: workspace
                        id: 550e8400-e29b-41d4-a716-446655440003
                    person:
                      data:
                        type: people
                        id: 550e8400-e29b-41d4-a716-446655440000
                included:
                  - type: workspace
                    id: 550e8400-e29b-41d4-a716-446655440003
                    attributes:
                      name: Marketing Team Workspace
                      description: >-
                        Collaborative workspace for the marketing team to manage
                        campaigns and content
                      avatar_color: '#FF5733'
                      external_workspace_id: mkt-workspace-001
                      auto_extract_enabled: false
                      created_at: '2024-01-05T08:00:00Z'
                      updated_at: '2024-01-18T12:15:00Z'
                  - type: people
                    id: 550e8400-e29b-41d4-a716-446655440000
                    attributes:
                      first_name: Sarah
                      last_name: Johnson
                      full_name: Sarah Johnson
                      created_at: '2024-01-10T09:00:00Z'
                      updated_at: '2024-01-10T09:00:00Z'
              schema:
                $ref: '#/components/schemas/MembershipGetResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '404':
          $ref: '#/components/responses/CompanyOrPersonNotFound'
components:
  parameters:
    AuthorizationHeader:
      name: Authorization
      in: header
      required: true
      schema:
        type: string
      description: Bearer token for authentication
  schemas:
    MembershipCreateRequest:
      type: object
      properties:
        data:
          type: object
          properties:
            type:
              type: string
              const: membership
            attributes:
              $ref: '#/components/schemas/MembershipCreateAttributes'
            relationships:
              $ref: '#/components/schemas/MembershipRelationships'
          required:
            - type
            - attributes
            - relationships
      required:
        - data
    MembershipGetResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/MembershipResource'
    BadRequestError:
      type: object
      properties:
        code:
          type: string
          example: SCHEMA_VALIDATION_ERROR
          description: Error code identifier
        status:
          type: integer
          example: 400
          description: HTTP status code
        title:
          type: string
          example: Validation Error
          description: Error title
        message:
          type: string
          example: The request is invalid
          description: Detailed error message
        details:
          type: array
          items:
            type: object
            properties:
              instancePath:
                type: string
                description: Path to the invalid field in the request
              schemaPath:
                type: string
                description: Path to the validation rule in the schema
              keyword:
                type: string
                description: Validation keyword that failed
              params:
                type: object
                description: Parameters related to the validation failure
              message:
                type: string
                description: Human-readable validation error message
          description: Array of detailed validation errors
        meta:
          type: object
          properties:
            log_id:
              type: string
              format: uuid
              example: 65c669d4-679c-4a8b-b8c0-fbe37699bb5b
              description: Unique identifier for tracking this error in logs
          required:
            - log_id
      required:
        - code
        - status
        - title
        - message
        - meta
    UnauthorizedError:
      type: object
      properties:
        code:
          type: string
          example: UNAUTHORIZED
          description: Error code identifier
        status:
          type: integer
          example: 401
          description: HTTP status code
        title:
          type: string
          example: Unauthorized
          description: Error title
        message:
          type: string
          example: You are not authorized to access this resource
          description: Detailed error message
        meta:
          type: object
          properties:
            log_id:
              type: string
              format: uuid
              example: 65c669d4-679c-4a8b-b8c0-fbe37699bb5b
              description: Unique identifier for tracking this error in logs
          required:
            - log_id
      required:
        - code
        - status
        - title
        - message
        - meta
    MembershipCreateAttributes:
      type: object
      properties:
        firebase_id:
          type: string
        role:
          type: string
          enum:
            - admin
            - member
            - owner
            - ...
          description: >-
            User role in the workspace. See [all available roles](/enums/role)
            for complete list.
      required:
        - role
    MembershipRelationships:
      type: object
      properties:
        workspace:
          type: object
          properties:
            data:
              type: object
              properties:
                type:
                  type: string
                id:
                  type: string
        person:
          type: object
          properties:
            data:
              type: object
              properties:
                type:
                  type: string
                id:
                  type: string
    MembershipResource:
      type: object
      properties:
        type:
          type: string
          const: membership
        id:
          type: string
          format: uuid
        attributes:
          $ref: '#/components/schemas/MembershipAttributes'
        relationships:
          $ref: '#/components/schemas/MembershipRelationships'
    MembershipAttributes:
      type: object
      properties:
        role:
          type: string
        firebase_id:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
  responses:
    CompanyOrPersonNotFound:
      description: Company or person not found
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: COMPANY_OR_PERSON_NOT_FOUND
                description: Error code identifier
              status:
                type: integer
                example: 404
                description: HTTP status code
              title:
                type: string
                example: Company or Person Not Found
                description: Error title
              message:
                type: string
                example: >-
                  The requested company or one of the specified people could not
                  be found
                description: Detailed error message
              meta:
                type: object
                properties:
                  log_id:
                    type: string
                    format: uuid
                    example: 65c669d4-679c-4a8b-b8c0-fbe37699bb5b
                    description: Unique identifier for tracking this error in logs
                required:
                  - log_id
            required:
              - code
              - status
              - title
              - message
              - meta

````