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

# Create Tenant Membership

> Add users to a tenant; every user must belong to the organization that owns the tenant. The role of each user is `viewer` or `editor` when `is_readonly` is sent, otherwise `role`, otherwise `viewer`; on demo tenants it is forced to `admin` for organization admins and `viewer` for everyone else. The response body is empty. Requires write permission on the members of the tenant.

&#x20;Required API key permission: **Write Tenant Admin**


## OpenAPI

````yaml firework-v2-openapi post /firework/v2/tenants/{tenant_id}/users
openapi: 3.0.1
info:
  description: >

    Manage and access Firework resources.


    Requests are authenticated with API tokens, which are obtained using an API
    key:


    1. Generate an API key from the [Profile
    page](https://app.flare.io/#/profile).

    2. Send a `POST` request to `https://api.flare.io/tokens/generate` with the
    `Authorization: <api-key>` header to get an API token. API tokens expire
    after 1 hour.

    3. Call the API endpoints with the `Authorization: Bearer <api-token>`
    header.


    See [Authentication](https://api.docs.flare.io/concepts/authentication) for
    details.
  title: Firework API
  version: v2
servers:
  - url: https://api.flare.io/
security:
  - BearerAuth: []
tags:
  - description: >-
      The authenticated user, its API keys, organizations, tenants, onboarding
      and usage.
    name: Account
  - description: >-
      Events collected by Flare: global search, tenant and identifier feeds,
      event details, actions and saved feed views.
    name: Events
  - description: >-
      Identifiers are the assets a tenant monitors, such as domains, keywords
      and email addresses. Includes recommendations and authorization of
      sensitive identifiers.
    name: Identifiers
  - description: Report groups, reports, their sections, schedules and delivery channels.
    name: Reports
paths:
  /firework/v2/tenants/{tenant_id}/users:
    post:
      tags:
        - Account
      summary: Add users to a tenant
      description: >-
        Add users to a tenant; every user must belong to the organization that
        owns the tenant. The role of each user is `viewer` or `editor` when
        `is_readonly` is sent, otherwise `role`, otherwise `viewer`; on demo
        tenants it is forced to `admin` for organization admins and `viewer` for
        everyone else. The response body is empty. Requires write permission on
        the members of the tenant.
      operationId: post_tenant_users_api
      parameters:
        - description: ID of the tenant.
          in: path
          name: tenant_id
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserTenantAccessRequest'
        required: true
      responses:
        '200':
          content: {}
          description: Users were successfully added to tenant.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpError'
          description: >-
            The request body is invalid, or a user does not exist or belongs to
            another organization (code `INVALID_USER_ID`).
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpError'
          description: >-
            The caller cannot manage the members of this tenant (code
            `FORBIDDEN`).
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpError'
          description: >-
            The tenant does not exist or its members are not visible to the
            caller (code `NOT_FOUND`).
components:
  schemas:
    UserTenantAccessRequest:
      properties:
        users:
          description: Users to add to the tenant, with the role of each.
          items:
            allOf:
              - $ref: '#/components/schemas/UserTenantAccess'
            description: User given access to a tenant.
            type: object
          type: array
      type: object
    HttpError:
      properties:
        message:
          description: Human-readable description of the error.
          type: string
        code:
          description: Machine-readable error code.
          type: string
      type: object
    UserTenantAccess:
      properties:
        user_id:
          description: The ID of the user to add to the tenant
          type: integer
        is_readonly:
          description: Access given to the user for the tenant
          type: boolean
        role:
          description: Role given to the user for the tenant
          enum:
            - viewer
            - editor
            - admin
          example: viewer
          type: string
      required:
        - user_id
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.