Movatterモバイル変換


[0]ホーム

URL:


HashiConf 2025Don't miss the live stream of HashiConf Day 2 happening now View live stream

You are viewing documentation for version v202411-2.View latest version.

Account represents the current user interacting with Terraform. It returns the same type of object as theUsers 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 calledservice user. HCP Terraform returns the associated service user for account requests authenticated by a team or organization token. Use theauthenticated-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

StatusResponseReason
200JSON API document (type: "users")The request was successful

Sample Request

curl \  --header "Authorization: Bearer $TOKEN" \  --header "Content-Type: application/vnd.api+json" \  --request GET \  https://app.terraform.io/api/v2/account/details

Sample Response

{  "data": {    "id": "user-V3R563qtJNcExAkN",    "type": "users",    "attributes": {      "username": "admin",      "is-service-account": false,      "auth-method": "tfc",      "avatar-url": "https://www.gravatar.com/avatar/9babb00091b97b9ce9538c45807fd35f?s=100&d=mm",      "v2-only": false,      "is-site-admin": true,      "is-sso-login": false,      "email": "admin@hashicorp.com",      "unconfirmed-email": null,      "permissions": {        "can-create-organizations": true,        "can-change-email": true,        "can-change-username": true      }    },    "relationships": {      "authentication-tokens": {        "links": {          "related": "/api/v2/users/user-V3R563qtJNcExAkN/authentication-tokens"        }      },      "authenticated-resource": {        "data": {          "id": "user-V3R563qtJNcExAkN",          "type": "users"        },        "links": {          "related": "/api/v2/users/user-V3R563qtJNcExAkN"        }      }    },    "links": {      "self": "/api/v2/users/user-V3R563qtJNcExAkN"    }  }}

Update your account info

Your username and email address can be updated with this endpoint.

PATCH /account/update

StatusResponseReason
200JSON API document (type: "users")Your info was successfully updated
401JSON API error objectUnauthorized
422JSON API error objectMalformed 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 pathTypeDefaultDescription
data.typestringMust be"users"
data.attributes.usernamestringNew username
data.attributes.emailstringNew email address (must be confirmed afterwards to take effect)

Sample Payload

{  "data": {    "type": "users",    "attributes": {      "email": "admin@example.com",      "username": "admin"    }  }}

Sample Request

curl \  --header "Authorization: Bearer $TOKEN" \  --header "Content-Type: application/vnd.api+json" \  --request PATCH \  --data @payload.json \  https://app.terraform.io/api/v2/account/update

Sample Response

{  "data": {    "id": "user-V3R563qtJNcExAkN",    "type": "users",    "attributes": {      "username": "admin",      "is-service-account": false,      "auth-method": "hcp_username_password",      "avatar-url": "https://www.gravatar.com/avatar/9babb00091b97b9ce9538c45807fd35f?s=100&d=mm",      "v2-only": false,      "is-site-admin": true,      "is-sso-login": false,      "email": "admin@hashicorp.com",      "unconfirmed-email": null,      "permissions": {        "can-create-organizations": true,        "can-change-email": true,        "can-change-username": true      }    },    "relationships": {      "authentication-tokens": {        "links": {          "related": "/api/v2/users/user-V3R563qtJNcExAkN/authentication-tokens"        }      }    },    "links": {      "self": "/api/v2/users/user-V3R563qtJNcExAkN"    }  }}

Change your password

PATCH /account/password

StatusResponseReason
200JSON API document (type: "users")Your password was successfully changed
401JSON API error objectUnauthorized
422JSON API error objectMalformed 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 pathTypeDefaultDescription
data.typestringMust be"users"
data.attributes.current_passwordstringCurrent password
data.attributes.passwordstringNew password (must be at least 10 characters in length)
data.attributes.password_confirmationstringNew password (confirmation)

Sample Payload

{  "data": {    "type": "users",    "attributes": {      "current_password": "current password e.g. 2:C)e'G4{D\n06:[d1~y",      "password": "new password e.g. 34rk492+jgLL0@xhfyisj",      "password_confirmation": "new password e.g. 34rk492+jLL0@xhfyisj"    }  }}

Sample Request

curl \  --header "Authorization: Bearer $TOKEN" \  --header "Content-Type: application/vnd.api+json" \  --request PATCH \  --data @payload.json \  https://app.terraform.io/api/v2/account/password

Sample Response

{  "data": {    "id": "user-V3R563qtJNcExAkN",    "type": "users",    "attributes": {      "username": "admin",      "is-service-account": false,      "auth-method": "hcp_github",      "avatar-url": "https://www.gravatar.com/avatar/9babb00091b97b9ce9538c45807fd35f?s=100&d=mm",      "v2-only": false,      "is-site-admin": true,      "is-sso-login": false,      "email": "admin@hashicorp.com",      "unconfirmed-email": null,      "permissions": {        "can-create-organizations": true,        "can-change-email": true,        "can-change-username": true      }    },    "relationships": {      "authentication-tokens": {        "links": {          "related": "/api/v2/users/user-V3R563qtJNcExAkN/authentication-tokens"        }      }    },    "links": {      "self": "/api/v2/users/user-V3R563qtJNcExAkN"    }  }}
Edit this page on GitHub

[8]ページ先頭

©2009-2025 Movatter.jp