Account API reference
Account represents the current user interacting with Terraform. It returns the same type of object as the Users API, but also includes an email address, which is hidden when viewing info about other users.
For internal reasons, HCP Terraform associates team and organization tokens with a synthetic user account called service user. HCP Terraform returns the associated service user for account requests authenticated by a team or organization token. Use the authenticated-resource
relationship to access the underlying team or organization associated with a token. For user tokens, you can use the user, itself.
Get your account details
GET /account/details
Status | Response | Reason |
---|---|---|
200 | JSON API document (type: "users" ) | The request was successful |
Sample Request
Sample Response
Update your account info
Your username and email address can be updated with this endpoint.
PATCH /account/update
Status | Response | Reason |
---|---|---|
200 | JSON API document (type: "users" ) | Your info was successfully updated |
401 | JSON API error object | Unauthorized |
422 | JSON API error object | Malformed request body (missing attributes, wrong types, etc.) |
Request Body
This PATCH endpoint requires a JSON object with the following properties as a request payload.
Key path | Type | Default | Description |
---|---|---|---|
data.type | string | Must be "users" | |
data.attributes.username | string | New username | |
data.attributes.email | string | New email address (must be confirmed afterwards to take effect) |
Sample Payload
Sample Request
Sample Response
Change your password
PATCH /account/password
Status | Response | Reason |
---|---|---|
200 | JSON API document (type: "users" ) | Your password was successfully changed |
401 | JSON API error object | Unauthorized |
422 | JSON API error object | Malformed request body (missing attributes, wrong types, etc.) |
Request Body
This PATCH endpoint requires a JSON object with the following properties as a request payload.
Key path | Type | Default | Description |
---|---|---|---|
data.type | string | Must be "users" | |
data.attributes.current_password | string | Current password | |
data.attributes.password | string | New password (must be at least 10 characters in length) | |
data.attributes.password_confirmation | string | New password (confirmation) |
Sample Payload
Sample Request
Sample Response