> For the complete documentation index, see [llms.txt](https://docs.ai.neevcloud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ai.neevcloud.com/api-reference/tenant/authentication.md).

# Authentication

User authentication and authorization endpoints

## User login

> Authenticate user with email and password

```json
{"openapi":"3.0.3","info":{"title":"Tenant API","version":"0.1.0"},"tags":[{"name":"Authentication","description":"User authentication and authorization endpoints"}],"servers":[{"url":"https://api.ai.neevcloud.com/tenant","description":"Consolidated public API gateway"}],"security":[],"paths":{"/api/v1/auth/login":{"post":{"operationId":"loginUser","summary":"User login","description":"Authenticate user with email and password","tags":["Authentication"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}}},"responses":{"200":{"description":"User authenticated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"400":{"description":"Invalid login data format or missing required fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid email or password.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"User not found with the provided email.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error occurred while authenticating user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"LoginRequest":{"type":"object","description":"Request payload for user login","required":["email","password"],"properties":{"email":{"type":"string","description":"User's email address","format":"email"},"password":{"type":"string","format":"password","description":"User's password","writeOnly":true}}},"LoginResponse":{"type":"object","description":"Response payload for successful user login","required":["user","access_token","token_type","expires_in"],"properties":{"user":{"$ref":"#/components/schemas/UserResponse"},"access_token":{"type":"string","description":"Access token for authenticated API requests (use in Authorize for this and other NeevAI APIs)."},"token_type":{"type":"string","description":"Type of access token","enum":["Bearer"]},"expires_in":{"type":"integer","description":"Access token expiration time in seconds"},"refresh_token":{"type":"string","description":"Optional refresh token for obtaining new access tokens"}}},"UserResponse":{"type":"object","description":"Response payload containing user details","required":["id","email","first_name","last_name","status","email_verified","phone_verified","created_at","updated_at"],"properties":{"id":{"type":"string","description":"Unique identifier for the user","format":"uuid","readOnly":true},"email":{"type":"string","description":"User's email address","format":"email"},"first_name":{"type":"string","description":"User's first name","minLength":1,"maxLength":50},"middle_name":{"type":"string","description":"User's middle name","minLength":1,"maxLength":50},"last_name":{"type":"string","description":"User's last name","minLength":1,"maxLength":50},"phone_number":{"type":"string","description":"User's phone number in E.164 format","pattern":"^\\+?[1-9]\\d{1,14}$"},"status":{"$ref":"#/components/schemas/ResourceState"},"email_verified":{"type":"boolean","description":"Whether the user's email address has been verified"},"phone_verified":{"type":"boolean","description":"Whether the user's phone number has been verified"},"oauth_provider":{"type":"string","description":"OAuth provider used for authentication","enum":["google","github"]},"oauth_provider_id":{"type":"string","description":"OAuth provider user ID"},"email_verified_at":{"type":"string","description":"Timestamp when the email was verified","format":"date-time","nullable":true,"readOnly":true},"phone_verified_at":{"type":"string","description":"Timestamp when the phone was verified","format":"date-time","nullable":true,"readOnly":true},"created_at":{"type":"string","description":"Timestamp when the user was created","format":"date-time","readOnly":true},"updated_at":{"type":"string","description":"Timestamp when the user was last updated","format":"date-time","readOnly":true},"roles":{"type":"object","description":"User's organization and project roles","nullable":true,"properties":{"organizations":{"type":"array","description":"List of organization memberships with roles","items":{"$ref":"#/components/schemas/UserOrganizationRole"}},"projects":{"type":"array","description":"List of project memberships with roles","items":{"$ref":"#/components/schemas/UserProjectRole"}}}}}},"ResourceState":{"type":"string","description":"The lifecycle state of a resource (user/organization/project)","enum":["active","suspended","archived","inactive"],"default":"active"},"UserOrganizationRole":{"type":"object","description":"Organization membership with role","required":["org_id","role"],"properties":{"org_id":{"type":"string","description":"Organization ID"},"role":{"type":"string","description":"User's role in the organization","enum":["owner","admin","member"]}}},"UserProjectRole":{"type":"object","description":"Project membership with role","required":["org_id","project_id","role"],"properties":{"org_id":{"type":"string","description":"Organization ID (e.g., \"org-xxx\")"},"project_id":{"type":"string","description":"Project ID (e.g., \"prj-xxx\")"},"role":{"type":"string","description":"User's role in the project","enum":["admin","member"]}}},"ErrorResponse":{"type":"object","description":"Standard error response containing an error message","required":["code","message"],"properties":{"code":{"type":"string","description":"A short, machine-readable error code."},"message":{"type":"string","description":"A descriptive error message."}}}}}}
```

## User logout

> Logout user and invalidate authentication tokens

```json
{"openapi":"3.0.3","info":{"title":"Tenant API","version":"0.1.0"},"tags":[{"name":"Authentication","description":"User authentication and authorization endpoints"}],"servers":[{"url":"https://api.ai.neevcloud.com/tenant","description":"Consolidated public API gateway"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"Use the **`access_token`** from `POST /api/v1/auth/login` (same credentials as the console). In **Authorize**, paste **only that token** — do not prepend `Bearer`, and do not use inference keys (`sk-nc-*`) here. The same token authenticates this API and AI Models / AI Runtime.\n"}},"schemas":{"LogoutResponse":{"type":"object","description":"Response payload for successful user logout","required":["message"],"properties":{"message":{"type":"string","description":"Logout confirmation message"}}},"ErrorResponse":{"type":"object","description":"Standard error response containing an error message","required":["code","message"],"properties":{"code":{"type":"string","description":"A short, machine-readable error code."},"message":{"type":"string","description":"A descriptive error message."}}}}},"paths":{"/api/v1/auth/logout":{"post":{"operationId":"logoutUser","summary":"User logout","description":"Logout user and invalidate authentication tokens","tags":["Authentication"],"responses":{"200":{"description":"User logged out successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogoutResponse"}}}},"401":{"description":"Missing or invalid authentication token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error occurred while logging out user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Refresh access token

> Generate a new access token using a valid refresh token

```json
{"openapi":"3.0.3","info":{"title":"Tenant API","version":"0.1.0"},"tags":[{"name":"Authentication","description":"User authentication and authorization endpoints"}],"servers":[{"url":"https://api.ai.neevcloud.com/tenant","description":"Consolidated public API gateway"}],"security":[],"paths":{"/api/v1/auth/refresh":{"post":{"operationId":"refreshToken","summary":"Refresh access token","description":"Generate a new access token using a valid refresh token","tags":["Authentication"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshTokenRequest"}}}},"responses":{"200":{"description":"Access token refreshed successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshTokenResponse"}}}},"400":{"description":"Invalid refresh token format or missing required fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid or expired refresh token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error occurred while refreshing token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"RefreshTokenRequest":{"type":"object","description":"Request payload for refreshing access token","required":["refresh_token"],"properties":{"refresh_token":{"type":"string","description":"Valid refresh token"}}},"RefreshTokenResponse":{"type":"object","description":"Response payload for successful token refresh","required":["access_token","token_type","expires_in"],"properties":{"access_token":{"type":"string","description":"New access token for authenticated API requests"},"token_type":{"type":"string","description":"Type of access token","enum":["Bearer"]},"expires_in":{"type":"integer","description":"Access token expiration time in seconds"},"refresh_token":{"type":"string","description":"New refresh token for subsequent token refreshes"}}},"ErrorResponse":{"type":"object","description":"Standard error response containing an error message","required":["code","message"],"properties":{"code":{"type":"string","description":"A short, machine-readable error code."},"message":{"type":"string","description":"A descriptive error message."}}}}}}
```

## Forgot password

> Send password reset email

```json
{"openapi":"3.0.3","info":{"title":"Tenant API","version":"0.1.0"},"tags":[{"name":"Authentication","description":"User authentication and authorization endpoints"}],"servers":[{"url":"https://api.ai.neevcloud.com/tenant","description":"Consolidated public API gateway"}],"security":[],"paths":{"/api/v1/auth/forgot-password":{"post":{"operationId":"forgotPassword","summary":"Forgot password","description":"Send password reset email","tags":["Authentication"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForgotPasswordRequest"}}}},"responses":{"200":{"description":"Password reset email sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForgotPasswordResponse"}}}},"400":{"description":"Invalid email format or missing required fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"User not found with the provided email.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error occurred while sending reset email.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"ForgotPasswordRequest":{"type":"object","description":"Request payload for initiating password reset","required":["email"],"properties":{"email":{"type":"string","format":"email","description":"Email address of the account to reset password for"}}},"ForgotPasswordResponse":{"type":"object","description":"Response indicating password reset email was sent","required":["message"],"properties":{"message":{"type":"string","description":"Confirmation message about password reset email"}}},"ErrorResponse":{"type":"object","description":"Standard error response containing an error message","required":["code","message"],"properties":{"code":{"type":"string","description":"A short, machine-readable error code."},"message":{"type":"string","description":"A descriptive error message."}}}}}}
```

## Reset password

> Reset user password using the reset token received via email

```json
{"openapi":"3.0.3","info":{"title":"Tenant API","version":"0.1.0"},"tags":[{"name":"Authentication","description":"User authentication and authorization endpoints"}],"servers":[{"url":"https://api.ai.neevcloud.com/tenant","description":"Consolidated public API gateway"}],"security":[],"paths":{"/api/v1/auth/reset-password":{"post":{"operationId":"resetPassword","summary":"Reset password","description":"Reset user password using the reset token received via email","tags":["Authentication"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPasswordRequest"}}}},"responses":{"200":{"description":"Password reset successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPasswordResponse"}}}},"400":{"description":"Invalid reset token, password format, or missing required fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid or expired reset token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"User not found with the provided reset token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error occurred while resetting password.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"ResetPasswordRequest":{"type":"object","description":"Request payload for resetting user password","required":["reset_token","new_password"],"properties":{"reset_token":{"type":"string","description":"Password reset token received via email"},"new_password":{"type":"string","format":"password","description":"New password for the user account. Must be at least 8 characters long, and contain at least one uppercase letter, one lowercase letter, one digit, and one special character.\n","minLength":8,"maxLength":50,"writeOnly":true}}},"ResetPasswordResponse":{"type":"object","description":"Response payload for successful password reset","required":["message"],"properties":{"message":{"type":"string","description":"Password reset confirmation message"}}},"ErrorResponse":{"type":"object","description":"Standard error response containing an error message","required":["code","message"],"properties":{"code":{"type":"string","description":"A short, machine-readable error code."},"message":{"type":"string","description":"A descriptive error message."}}}}}}
```

## User signup

> Create a new user account with email, password, and personal details

```json
{"openapi":"3.0.3","info":{"title":"Tenant API","version":"0.1.0"},"tags":[{"name":"Authentication","description":"User authentication and authorization endpoints"}],"servers":[{"url":"https://api.ai.neevcloud.com/tenant","description":"Consolidated public API gateway"}],"security":[],"paths":{"/api/v1/auth/signup":{"post":{"operationId":"userSignup","summary":"User signup","description":"Create a new user account with email, password, and personal details","tags":["Authentication"],"parameters":[{"name":"invite_token","in":"query","required":false,"description":"Optional invitation token for joining an organization","schema":{"type":"string"}},{"name":"referral_code","in":"query","required":false,"description":"Optional referral code for refer-and-earn attribution","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserRequest"}}}},"responses":{"201":{"description":"User registered successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"400":{"description":"Invalid user data format or missing required fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Email already exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error occurred while registering user.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"UserRequest":{"type":"object","description":"Request payload for creating or updating a user","required":["email","phone_number","password","first_name","last_name"],"properties":{"email":{"type":"string","description":"Valid email address for the user account","format":"email"},"phone_number":{"type":"string","description":"Valid phone number for the user account","pattern":"^\\+[1-9][0-9]{7,14}$"},"password":{"type":"string","format":"password","description":"Secure password for the user account. Must be at least 8 characters long, and contain at least one uppercase letter, one lowercase letter, one digit, and one special character.\n","minLength":8,"maxLength":50,"writeOnly":true},"first_name":{"type":"string","description":"User's first name","minLength":1,"maxLength":50,"pattern":"^[A-Za-z\\-']+$"},"middle_name":{"type":"string","description":"User's middle name (optional)","minLength":1,"maxLength":50,"pattern":"^[A-Za-z\\-']+$"},"last_name":{"type":"string","description":"User's last name","minLength":1,"maxLength":50,"pattern":"^[A-Za-z\\-']+$"}}},"LoginResponse":{"type":"object","description":"Response payload for successful user login","required":["user","access_token","token_type","expires_in"],"properties":{"user":{"$ref":"#/components/schemas/UserResponse"},"access_token":{"type":"string","description":"Access token for authenticated API requests (use in Authorize for this and other NeevAI APIs)."},"token_type":{"type":"string","description":"Type of access token","enum":["Bearer"]},"expires_in":{"type":"integer","description":"Access token expiration time in seconds"},"refresh_token":{"type":"string","description":"Optional refresh token for obtaining new access tokens"}}},"UserResponse":{"type":"object","description":"Response payload containing user details","required":["id","email","first_name","last_name","status","email_verified","phone_verified","created_at","updated_at"],"properties":{"id":{"type":"string","description":"Unique identifier for the user","format":"uuid","readOnly":true},"email":{"type":"string","description":"User's email address","format":"email"},"first_name":{"type":"string","description":"User's first name","minLength":1,"maxLength":50},"middle_name":{"type":"string","description":"User's middle name","minLength":1,"maxLength":50},"last_name":{"type":"string","description":"User's last name","minLength":1,"maxLength":50},"phone_number":{"type":"string","description":"User's phone number in E.164 format","pattern":"^\\+?[1-9]\\d{1,14}$"},"status":{"$ref":"#/components/schemas/ResourceState"},"email_verified":{"type":"boolean","description":"Whether the user's email address has been verified"},"phone_verified":{"type":"boolean","description":"Whether the user's phone number has been verified"},"oauth_provider":{"type":"string","description":"OAuth provider used for authentication","enum":["google","github"]},"oauth_provider_id":{"type":"string","description":"OAuth provider user ID"},"email_verified_at":{"type":"string","description":"Timestamp when the email was verified","format":"date-time","nullable":true,"readOnly":true},"phone_verified_at":{"type":"string","description":"Timestamp when the phone was verified","format":"date-time","nullable":true,"readOnly":true},"created_at":{"type":"string","description":"Timestamp when the user was created","format":"date-time","readOnly":true},"updated_at":{"type":"string","description":"Timestamp when the user was last updated","format":"date-time","readOnly":true},"roles":{"type":"object","description":"User's organization and project roles","nullable":true,"properties":{"organizations":{"type":"array","description":"List of organization memberships with roles","items":{"$ref":"#/components/schemas/UserOrganizationRole"}},"projects":{"type":"array","description":"List of project memberships with roles","items":{"$ref":"#/components/schemas/UserProjectRole"}}}}}},"ResourceState":{"type":"string","description":"The lifecycle state of a resource (user/organization/project)","enum":["active","suspended","archived","inactive"],"default":"active"},"UserOrganizationRole":{"type":"object","description":"Organization membership with role","required":["org_id","role"],"properties":{"org_id":{"type":"string","description":"Organization ID"},"role":{"type":"string","description":"User's role in the organization","enum":["owner","admin","member"]}}},"UserProjectRole":{"type":"object","description":"Project membership with role","required":["org_id","project_id","role"],"properties":{"org_id":{"type":"string","description":"Organization ID (e.g., \"org-xxx\")"},"project_id":{"type":"string","description":"Project ID (e.g., \"prj-xxx\")"},"role":{"type":"string","description":"User's role in the project","enum":["admin","member"]}}},"ErrorResponse":{"type":"object","description":"Standard error response containing an error message","required":["code","message"],"properties":{"code":{"type":"string","description":"A short, machine-readable error code."},"message":{"type":"string","description":"A descriptive error message."}}}}}}
```

## Verify email address

> Verify email address using OTP code

```json
{"openapi":"3.0.3","info":{"title":"Tenant API","version":"0.1.0"},"tags":[{"name":"Authentication","description":"User authentication and authorization endpoints"}],"servers":[{"url":"https://api.ai.neevcloud.com/tenant","description":"Consolidated public API gateway"}],"security":[],"paths":{"/api/v1/auth/verify-email":{"post":{"operationId":"verifyEmail","summary":"Verify email address","description":"Verify email address using OTP code","tags":["Authentication"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailVerificationRequest"}}}},"responses":{"200":{"description":"Email verified successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"400":{"description":"Invalid verification code or missing required fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid or expired verification code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"User not found or email already verified.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error occurred while verifying email.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"EmailVerificationRequest":{"type":"object","description":"Request payload for email verification","required":["email","verification_code"],"properties":{"email":{"type":"string","description":"Email address of the user to verify","format":"email"},"verification_code":{"type":"string","description":"OTP verification code sent to email","pattern":"^[0-9]{6}$"}}},"LoginResponse":{"type":"object","description":"Response payload for successful user login","required":["user","access_token","token_type","expires_in"],"properties":{"user":{"$ref":"#/components/schemas/UserResponse"},"access_token":{"type":"string","description":"Access token for authenticated API requests (use in Authorize for this and other NeevAI APIs)."},"token_type":{"type":"string","description":"Type of access token","enum":["Bearer"]},"expires_in":{"type":"integer","description":"Access token expiration time in seconds"},"refresh_token":{"type":"string","description":"Optional refresh token for obtaining new access tokens"}}},"UserResponse":{"type":"object","description":"Response payload containing user details","required":["id","email","first_name","last_name","status","email_verified","phone_verified","created_at","updated_at"],"properties":{"id":{"type":"string","description":"Unique identifier for the user","format":"uuid","readOnly":true},"email":{"type":"string","description":"User's email address","format":"email"},"first_name":{"type":"string","description":"User's first name","minLength":1,"maxLength":50},"middle_name":{"type":"string","description":"User's middle name","minLength":1,"maxLength":50},"last_name":{"type":"string","description":"User's last name","minLength":1,"maxLength":50},"phone_number":{"type":"string","description":"User's phone number in E.164 format","pattern":"^\\+?[1-9]\\d{1,14}$"},"status":{"$ref":"#/components/schemas/ResourceState"},"email_verified":{"type":"boolean","description":"Whether the user's email address has been verified"},"phone_verified":{"type":"boolean","description":"Whether the user's phone number has been verified"},"oauth_provider":{"type":"string","description":"OAuth provider used for authentication","enum":["google","github"]},"oauth_provider_id":{"type":"string","description":"OAuth provider user ID"},"email_verified_at":{"type":"string","description":"Timestamp when the email was verified","format":"date-time","nullable":true,"readOnly":true},"phone_verified_at":{"type":"string","description":"Timestamp when the phone was verified","format":"date-time","nullable":true,"readOnly":true},"created_at":{"type":"string","description":"Timestamp when the user was created","format":"date-time","readOnly":true},"updated_at":{"type":"string","description":"Timestamp when the user was last updated","format":"date-time","readOnly":true},"roles":{"type":"object","description":"User's organization and project roles","nullable":true,"properties":{"organizations":{"type":"array","description":"List of organization memberships with roles","items":{"$ref":"#/components/schemas/UserOrganizationRole"}},"projects":{"type":"array","description":"List of project memberships with roles","items":{"$ref":"#/components/schemas/UserProjectRole"}}}}}},"ResourceState":{"type":"string","description":"The lifecycle state of a resource (user/organization/project)","enum":["active","suspended","archived","inactive"],"default":"active"},"UserOrganizationRole":{"type":"object","description":"Organization membership with role","required":["org_id","role"],"properties":{"org_id":{"type":"string","description":"Organization ID"},"role":{"type":"string","description":"User's role in the organization","enum":["owner","admin","member"]}}},"UserProjectRole":{"type":"object","description":"Project membership with role","required":["org_id","project_id","role"],"properties":{"org_id":{"type":"string","description":"Organization ID (e.g., \"org-xxx\")"},"project_id":{"type":"string","description":"Project ID (e.g., \"prj-xxx\")"},"role":{"type":"string","description":"User's role in the project","enum":["admin","member"]}}},"ErrorResponse":{"type":"object","description":"Standard error response containing an error message","required":["code","message"],"properties":{"code":{"type":"string","description":"A short, machine-readable error code."},"message":{"type":"string","description":"A descriptive error message."}}}}}}
```

## Verify phone number

> Verify phone number using OTP code

```json
{"openapi":"3.0.3","info":{"title":"Tenant API","version":"0.1.0"},"tags":[{"name":"Authentication","description":"User authentication and authorization endpoints"}],"servers":[{"url":"https://api.ai.neevcloud.com/tenant","description":"Consolidated public API gateway"}],"security":[],"paths":{"/api/v1/auth/verify-phone":{"post":{"operationId":"verifyPhone","summary":"Verify phone number","description":"Verify phone number using OTP code","tags":["Authentication"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhoneVerificationRequest"}}}},"responses":{"200":{"description":"Phone number verified successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"400":{"description":"Invalid verification code or missing required fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid or expired verification code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"User not found or phone already verified.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error occurred while verifying phone.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"PhoneVerificationRequest":{"type":"object","description":"Request payload for phone verification","required":["email","verification_code"],"properties":{"email":{"type":"string","description":"Email address of the user to verify phone for","format":"email"},"verification_code":{"type":"string","description":"OTP verification code sent to phone","pattern":"^[0-9]{6}$"}}},"LoginResponse":{"type":"object","description":"Response payload for successful user login","required":["user","access_token","token_type","expires_in"],"properties":{"user":{"$ref":"#/components/schemas/UserResponse"},"access_token":{"type":"string","description":"Access token for authenticated API requests (use in Authorize for this and other NeevAI APIs)."},"token_type":{"type":"string","description":"Type of access token","enum":["Bearer"]},"expires_in":{"type":"integer","description":"Access token expiration time in seconds"},"refresh_token":{"type":"string","description":"Optional refresh token for obtaining new access tokens"}}},"UserResponse":{"type":"object","description":"Response payload containing user details","required":["id","email","first_name","last_name","status","email_verified","phone_verified","created_at","updated_at"],"properties":{"id":{"type":"string","description":"Unique identifier for the user","format":"uuid","readOnly":true},"email":{"type":"string","description":"User's email address","format":"email"},"first_name":{"type":"string","description":"User's first name","minLength":1,"maxLength":50},"middle_name":{"type":"string","description":"User's middle name","minLength":1,"maxLength":50},"last_name":{"type":"string","description":"User's last name","minLength":1,"maxLength":50},"phone_number":{"type":"string","description":"User's phone number in E.164 format","pattern":"^\\+?[1-9]\\d{1,14}$"},"status":{"$ref":"#/components/schemas/ResourceState"},"email_verified":{"type":"boolean","description":"Whether the user's email address has been verified"},"phone_verified":{"type":"boolean","description":"Whether the user's phone number has been verified"},"oauth_provider":{"type":"string","description":"OAuth provider used for authentication","enum":["google","github"]},"oauth_provider_id":{"type":"string","description":"OAuth provider user ID"},"email_verified_at":{"type":"string","description":"Timestamp when the email was verified","format":"date-time","nullable":true,"readOnly":true},"phone_verified_at":{"type":"string","description":"Timestamp when the phone was verified","format":"date-time","nullable":true,"readOnly":true},"created_at":{"type":"string","description":"Timestamp when the user was created","format":"date-time","readOnly":true},"updated_at":{"type":"string","description":"Timestamp when the user was last updated","format":"date-time","readOnly":true},"roles":{"type":"object","description":"User's organization and project roles","nullable":true,"properties":{"organizations":{"type":"array","description":"List of organization memberships with roles","items":{"$ref":"#/components/schemas/UserOrganizationRole"}},"projects":{"type":"array","description":"List of project memberships with roles","items":{"$ref":"#/components/schemas/UserProjectRole"}}}}}},"ResourceState":{"type":"string","description":"The lifecycle state of a resource (user/organization/project)","enum":["active","suspended","archived","inactive"],"default":"active"},"UserOrganizationRole":{"type":"object","description":"Organization membership with role","required":["org_id","role"],"properties":{"org_id":{"type":"string","description":"Organization ID"},"role":{"type":"string","description":"User's role in the organization","enum":["owner","admin","member"]}}},"UserProjectRole":{"type":"object","description":"Project membership with role","required":["org_id","project_id","role"],"properties":{"org_id":{"type":"string","description":"Organization ID (e.g., \"org-xxx\")"},"project_id":{"type":"string","description":"Project ID (e.g., \"prj-xxx\")"},"role":{"type":"string","description":"User's role in the project","enum":["admin","member"]}}},"ErrorResponse":{"type":"object","description":"Standard error response containing an error message","required":["code","message"],"properties":{"code":{"type":"string","description":"A short, machine-readable error code."},"message":{"type":"string","description":"A descriptive error message."}}}}}}
```

## Resend verification code

> Resend verification code for email or phone

```json
{"openapi":"3.0.3","info":{"title":"Tenant API","version":"0.1.0"},"tags":[{"name":"Authentication","description":"User authentication and authorization endpoints"}],"servers":[{"url":"https://api.ai.neevcloud.com/tenant","description":"Consolidated public API gateway"}],"security":[],"paths":{"/api/v1/auth/resend-verification":{"post":{"operationId":"resendVerification","summary":"Resend verification code","description":"Resend verification code for email or phone","tags":["Authentication"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendVerificationRequest"}}}},"responses":{"200":{"description":"Verification code sent successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Invalid request or missing required fields.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"User not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests. Please wait before requesting another code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error occurred while sending verification code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"ResendVerificationRequest":{"type":"object","description":"Request payload for resending verification code","required":["email","verification_type"],"properties":{"email":{"type":"string","description":"Email address of the user","format":"email"},"verification_type":{"$ref":"#/components/schemas/VerificationType"}}},"VerificationType":{"type":"string","description":"Type of verification to resend","enum":["email","phone","both"]},"SuccessResponse":{"type":"object","description":"Generic success response containing a message","required":["message"],"properties":{"message":{"type":"string","description":"A descriptive success message"}}},"ErrorResponse":{"type":"object","description":"Standard error response containing an error message","required":["code","message"],"properties":{"code":{"type":"string","description":"A short, machine-readable error code."},"message":{"type":"string","description":"A descriptive error message."}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ai.neevcloud.com/api-reference/tenant/authentication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
