A new platform for documentation and tutorials is launching soon.
We are migrating Terraform documentation into HashiCorp Developer, our new developer experience.
Search Terraform documentation » Account APIAccount 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.
» Get your account detailsGET /account/details
» Sample Requestcurl \
--header "Authorization: Bearer $TOKEN " \
--header "Content-Type: application/vnd.api+json" \
--request GET \
https://app.terraform.io/api/v2/account/details
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 ,
"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"
}
}
}
{
"data" : {
"id" : "user-V3R563qtJNcExAkN" ,
"type" : "users" ,
"attributes" : {
"username" : "admin" ,
"is-service-account" : false ,
"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"
}
}
}
» Update your account infoYour username and email address can be updated with this endpoint.
PATCH /account/update
» Request BodyThis 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{
"data" : {
"type" : "users" ,
"attributes" : {
"email" : "admin@example.com" ,
"username" : "admin"
}
}
}
{
"data" : {
"type" : "users" ,
"attributes" : {
"email" : "admin@example.com" ,
"username" : "admin"
}
}
}
» Sample Requestcurl \
--header "Authorization: Bearer $TOKEN " \
--header "Content-Type: application/vnd.api+json" \
--request PATCH \
--data @payload.json \
https://app.terraform.io/api/v2/account/update
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 ,
"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"
}
}
}
{
"data" : {
"id" : "user-V3R563qtJNcExAkN" ,
"type" : "users" ,
"attributes" : {
"username" : "admin" ,
"is-service-account" : false ,
"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 passwordPATCH /account/password
» Request BodyThis 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 data.attributes.password_confirmation
string New 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"
}
}
}
{
"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 Requestcurl \
--header "Authorization: Bearer $TOKEN " \
--header "Content-Type: application/vnd.api+json" \
--request PATCH \
--data @payload.json \
https://app.terraform.io/api/v2/account/password
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 ,
"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"
}
}
}
{
"data" : {
"id" : "user-V3R563qtJNcExAkN" ,
"type" : "users" ,
"attributes" : {
"username" : "admin" ,
"is-service-account" : false ,
"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"
}
}
}