Invite a new user to join the organization. #### Path Parameters **`organization_id`** string required Organization ID #### Request Body **`email`** string required Email address of the user to invite. **`role_id`** string required Role ID to assign to the invited user. **`send_invitation`** boolean optional ยท Defaults to `true` Whether to send invitation email. ## Returns Returns the created invitation object. ## Notes - Creates a unique invitation link - Email is sent if `send_invitation` is true - Invitation expires after a set period - Cannot invite existing organization members ## Authorization Requires Admin or Owner role. ```bash curl -X POST https://api.aitronos.com/v1/organizations/org_abc123/invite-user \ -H "X-API-Key: $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "email": "newuser@example.com", "role_id": "role_abc123", "send_invitation": true }' ``` ```python import requests import os api_key = os.environ["FREDDY_API_KEY"] org_id = "org_abc123" response = requests.post( f"https://api.aitronos.com/v1/organizations/{org_id}/invite-user", headers={ "X-API-Key": api_key, "Content-Type": "application/json" }, json={ "email": "newuser@example.com", "role_id": "role_abc123", "send_invitation": True } ) invitation = response.json() ``` ```javascript const response = await fetch('https://api.aitronos.com/v1/organizations/org_abc123/invite-user', { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.FREDDY_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ email: 'newuser@example.com', role_id: 'role_abc123', send_invitation: true }) }); const invitation = await response.json(); ``` **Response:** 201 Created ```json { "invitation_id": "inv_abc123", "email": "newuser@example.com", "role_id": "role_abc123", "user_id": "usr_xyz789", "invitation_link": "https://chat.aitronos.com/user/register?invite=abc123..." } ``` | Field | Type | Description | | --- | --- | --- | | `invitation_id` | string | Unique invitation ID | | `email` | string | Invited email address | | `role_id` | string | Assigned role ID | | `user_id` | string | Created/existing user ID | | `invitation_link` | string | Full URL to share with the invitee | 409 Conflict ```json { "success": false, "error": { "code": "USER_ALREADY_EXISTS", "message": "User already exists in organization", "status": 409 } } ```