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

# Invite Member

> ⚠️ SECURITY: Only organization OWNERS and ADMINS can invite new members. Members cannot invite others.

Invites a new member to the organization via email.

## Permissions

User must be **owner** or **admin** to invite members.

## Invitation Flow

1. Creates a pending invitation
2. Publishes `MemberInvitedEvent`
3. Event handler sends invitation email
4. User receives email with invitation link
5. User accepts invitation to join

## Invitation Expiry

Invitations expire after **7 days**. After expiration, a new invitation must be sent.

## Example

```bash theme={null}
curl -X POST http://localhost:3001/api/organizations/550e8400-e29b-41d4-a716-446655440000/members/invite \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "role": "member"
  }'
```

## Events Published

* `MemberInvitedEvent` - Triggers invitation email


## OpenAPI

````yaml POST /organizations/{id}/members/invite
openapi: 3.1.0
info:
  title: Timbrix API
  description: >-
    REST API with OAuth2 server for managing organizations, members, and
    webhooks
  version: '1.0'
  contact: {}
servers:
  - url: http://sandbox.mintlify.com
    description: Sandbox environment
  - url: http://localhost:3001/api
    description: Local development
security: []
tags:
  - name: organizations
    description: Organization management endpoints
  - name: oauth
    description: OAuth2 authentication and authorization
  - name: webhooks
    description: Webhook configuration and delivery
  - name: users
    description: User information endpoints
  - name: api-keys
    description: API Keys management and validation
paths:
  /organizations/{id}/members/invite:
    post:
      tags:
        - organizations
      summary: Invite a member (owner/admin only)
      description: >-
        ⚠️ SECURITY: Only organization OWNERS and ADMINS can invite new members.
        Members cannot invite others.
      operationId: OrganizationsController_invite
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InviteMemberDto'
      responses:
        '201':
          description: Invitation created successfully. Email sent to the invitee.
        '400':
          description: Invalid input data. Check email format and role value.
        '401':
          description: Authentication required. Provide a valid bearer token.
        '403':
          description: Access denied. Only owners and admins can invite members.
        '404':
          description: Organization not found with the provided ID.
        '409':
          description: User is already a member or has a pending invitation.
      security:
        - bearer: []
components:
  schemas:
    InviteMemberDto:
      type: object
      properties:
        email:
          type: string
          description: Email address of the user to invite
          example: user@example.com
        role:
          type: string
          description: Role to assign to the invited member
          enum:
            - admin
            - member
          example: member
      required:
        - email
        - role
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````