|
| 1 | +# Account Service |
| 2 | + |
| 3 | +## Get Account |
| 4 | + |
| 5 | +```http request |
| 6 | +GET https://appwrite.io/v1/account |
| 7 | +``` |
| 8 | + |
| 9 | +** Get currently logged in user data as JSON object. ** |
| 10 | + |
| 11 | +## Delete Account |
| 12 | + |
| 13 | +```http request |
| 14 | +DELETE https://appwrite.io/v1/account |
| 15 | +``` |
| 16 | + |
| 17 | +** Delete a currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. This is done to avoid deleted accounts being overtaken by new users with the same email address. Any user-related resources like documents or storage files should be deleted separately. ** |
| 18 | + |
| 19 | +## Update Account Email |
| 20 | + |
| 21 | +```http request |
| 22 | +PATCH https://appwrite.io/v1/account/email |
| 23 | +``` |
| 24 | + |
| 25 | +** Update currently logged in user account email address. After changing user address, user confirmation status is being reset and a new confirmation mail is sent. For security measures, user password is required to complete this request. |
| 26 | +This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. ** |
| 27 | + |
| 28 | +### Parameters |
| 29 | + |
| 30 | +| Field Name | Type | Description | Default | |
| 31 | +| --- | --- | --- | --- | |
| 32 | +| email | string | User email. | | |
| 33 | +| password | string | User password. Must be between 6 to 32 chars. | | |
| 34 | + |
| 35 | +## Get Account Logs |
| 36 | + |
| 37 | +```http request |
| 38 | +GET https://appwrite.io/v1/account/logs |
| 39 | +``` |
| 40 | + |
| 41 | +** Get currently logged in user list of latest security activity logs. Each log returns user IP address, location and date and time of log. ** |
| 42 | + |
| 43 | +## Update Account Name |
| 44 | + |
| 45 | +```http request |
| 46 | +PATCH https://appwrite.io/v1/account/name |
| 47 | +``` |
| 48 | + |
| 49 | +** Update currently logged in user account name. ** |
| 50 | + |
| 51 | +### Parameters |
| 52 | + |
| 53 | +| Field Name | Type | Description | Default | |
| 54 | +| --- | --- | --- | --- | |
| 55 | +| name | string | User name. Max length: 128 chars. | | |
| 56 | + |
| 57 | +## Update Account Password |
| 58 | + |
| 59 | +```http request |
| 60 | +PATCH https://appwrite.io/v1/account/password |
| 61 | +``` |
| 62 | + |
| 63 | +** Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth and Team Invites, oldPassword is optional. ** |
| 64 | + |
| 65 | +### Parameters |
| 66 | + |
| 67 | +| Field Name | Type | Description | Default | |
| 68 | +| --- | --- | --- | --- | |
| 69 | +| password | string | New user password. Must be between 6 to 32 chars. | | |
| 70 | +| oldPassword | string | Old user password. Must be between 6 to 32 chars. | | |
| 71 | + |
| 72 | +## Get Account Preferences |
| 73 | + |
| 74 | +```http request |
| 75 | +GET https://appwrite.io/v1/account/prefs |
| 76 | +``` |
| 77 | + |
| 78 | +** Get currently logged in user preferences as a key-value object. ** |
| 79 | + |
| 80 | +## Update Account Preferences |
| 81 | + |
| 82 | +```http request |
| 83 | +PATCH https://appwrite.io/v1/account/prefs |
| 84 | +``` |
| 85 | + |
| 86 | +** Update currently logged in user account preferences. You can pass only the specific settings you wish to update. ** |
| 87 | + |
| 88 | +### Parameters |
| 89 | + |
| 90 | +| Field Name | Type | Description | Default | |
| 91 | +| --- | --- | --- | --- | |
| 92 | +| prefs | object | Prefs key-value JSON object. | | |
| 93 | + |
| 94 | +## Create Password Recovery |
| 95 | + |
| 96 | +```http request |
| 97 | +POST https://appwrite.io/v1/account/recovery |
| 98 | +``` |
| 99 | + |
| 100 | +** Sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](/docs/client/account#accountUpdateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour. ** |
| 101 | + |
| 102 | +### Parameters |
| 103 | + |
| 104 | +| Field Name | Type | Description | Default | |
| 105 | +| --- | --- | --- | --- | |
| 106 | +| email | string | User email. | | |
| 107 | +| url | string | URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | |
| 108 | + |
| 109 | +## Complete Password Recovery |
| 110 | + |
| 111 | +```http request |
| 112 | +PUT https://appwrite.io/v1/account/recovery |
| 113 | +``` |
| 114 | + |
| 115 | +** Use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](/docs/client/account#accountCreateRecovery) endpoint. |
| 116 | + |
| 117 | +Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. ** |
| 118 | + |
| 119 | +### Parameters |
| 120 | + |
| 121 | +| Field Name | Type | Description | Default | |
| 122 | +| --- | --- | --- | --- | |
| 123 | +| userId | string | User account UID address. | | |
| 124 | +| secret | string | Valid reset token. | | |
| 125 | +| password | string | New password. Must be between 6 to 32 chars. | | |
| 126 | +| passwordAgain | string | New password again. Must be between 6 to 32 chars. | | |
| 127 | + |
| 128 | +## Get Account Sessions |
| 129 | + |
| 130 | +```http request |
| 131 | +GET https://appwrite.io/v1/account/sessions |
| 132 | +``` |
| 133 | + |
| 134 | +** Get currently logged in user list of active sessions across different devices. ** |
| 135 | + |
| 136 | +## Delete All Account Sessions |
| 137 | + |
| 138 | +```http request |
| 139 | +DELETE https://appwrite.io/v1/account/sessions |
| 140 | +``` |
| 141 | + |
| 142 | +** Delete all sessions from the user account and remove any sessions cookies from the end client. ** |
| 143 | + |
| 144 | +## Delete Account Session |
| 145 | + |
| 146 | +```http request |
| 147 | +DELETE https://appwrite.io/v1/account/sessions/{sessionId} |
| 148 | +``` |
| 149 | + |
| 150 | +** Use this endpoint to log out the currently logged in user from all their account sessions across all of their different devices. When using the option id argument, only the session unique ID provider will be deleted. ** |
| 151 | + |
| 152 | +### Parameters |
| 153 | + |
| 154 | +| Field Name | Type | Description | Default | |
| 155 | +| --- | --- | --- | --- | |
| 156 | +| sessionId | string | **Required** Session unique ID. Use the string 'current' to delete the current device session. | | |
| 157 | + |
| 158 | +## Create Email Verification |
| 159 | + |
| 160 | +```http request |
| 161 | +POST https://appwrite.io/v1/account/verification |
| 162 | +``` |
| 163 | + |
| 164 | +** Use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](/docs/client/account#accountUpdateVerification). The verification link sent to the user's email address is valid for 7 days. |
| 165 | + |
| 166 | +Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface. |
| 167 | + ** |
| 168 | + |
| 169 | +### Parameters |
| 170 | + |
| 171 | +| Field Name | Type | Description | Default | |
| 172 | +| --- | --- | --- | --- | |
| 173 | +| url | string | URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API. | | |
| 174 | + |
| 175 | +## Complete Email Verification |
| 176 | + |
| 177 | +```http request |
| 178 | +PUT https://appwrite.io/v1/account/verification |
| 179 | +``` |
| 180 | + |
| 181 | +** Use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code. ** |
| 182 | + |
| 183 | +### Parameters |
| 184 | + |
| 185 | +| Field Name | Type | Description | Default | |
| 186 | +| --- | --- | --- | --- | |
| 187 | +| userId | string | User unique ID. | | |
| 188 | +| secret | string | Valid verification token. | | |
| 189 | + |
0 commit comments