Complete the invitation by registering the user and returning authentication tokens. This is an atomic operation that validates the invitation, creates/updates the user account, activates organization membership, and returns JWT tokens for immediate login. #### Request Body **`email_key`** string required Invitation key from the URL (`invkey_` prefixed). **`full_name`** string required User's full name (1-255 characters). **`password`** string required User's password (minimum 8 characters). ## Returns Returns authentication tokens for immediate login. ## Notes - Public endpoint used during registration flow - Atomic operation: validates invitation, creates user, and returns tokens - User is immediately logged in after successful completion - Invitation is marked as used and cannot be reused ## Authorization None (Public endpoint) ```bash curl -X POST https://api.aitronos.com/v1/invitations/complete \ -H "Content-Type: application/json" \ -d '{ "email_key": "invkey_f87d706d08504aacb5fec46316ce5f23", "full_name": "John Doe", "password": "SecurePass123!" }' ``` ```python import requests response = requests.post( "https://api.aitronos.com/v1/invitations/complete", headers={"Content-Type": "application/json"}, json={ "email_key": "invkey_f87d706d08504aacb5fec46316ce5f23", "full_name": "John Doe", "password": "SecurePass123!" } ) auth_data = response.json() ``` ```javascript const response = await fetch('https://api.aitronos.com/v1/invitations/complete', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email_key: 'invkey_f87d706d08504aacb5fec46316ce5f23', full_name: 'John Doe', password: 'SecurePass123!' }) }); const authData = await response.json(); ``` **Response:** 200 OK ```json { "success": true, "user_id": "usr_abc123", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "refresh_token": { "token": "refresh_token_xyz789...", "expires_at": "2026-02-06T10:30:00Z" }, "device_id": null } ``` 400 Bad Request ```json { "success": false, "error": { "code": "VALIDATION_ERROR", "message": "Invalid request data", "status": 400 } } ``` 404 Not Found ```json { "success": false, "error": { "code": "INVITATION_NOT_FOUND", "message": "Invitation not found", "status": 404, "details": { "email_key": "invkey_f87d706d08504aacb5fec46316ce5f23" } } } ``` 422 Validation Error - Already Used ```json { "success": false, "error": { "code": "VALIDATION_ERROR", "message": "Invitation has already been used", "status": 422, "details": { "email_key": "invkey_f87d706d08504aacb5fec46316ce5f23", "used_at": "2026-01-05T20:30:00Z" } } } ``` 422 Validation Error - Invalid Password ```json { "success": false, "error": { "code": "INVALID_PASSWORD_FORMAT", "message": "Password must be at least 8 characters long", "status": 422 } } ```