Terraform
- Terraform Enterprise
- 1.0.x (latest)
- v202507-1
- v202506-1
- v202505-1
- v202504-1
- v202503-1
- v202502-2
- v202502-1
- v202501-1
- v202411-2
- v202411-1
- v202410-1
- v202409-3
- v202409-2
- v202409-1
- No versions of this document exist before v202408-1. Click below to redirect to the version homepage.
- v202408-1
- v202407-1
- v202406-1
- v202405-1
- v202404-2
- v202402-2
- v202402-1
- v202401-2
- v202401-1
- v202312-1
- v202311-1
- v202310-1
- v202309-1
- v202308-1
- v202307-1
- v202306-1
- v202305-2
- v202305-1
- v202304-1
- v202303-1
- v202302-1
- v202301-2
- v202301-1
- v202212-2
- v202212-1
- v202211-1
- v202210-1
- v202209-2
- v202209-1
- v202208-3
- v202208-2
- v202208-1
- v202207-2
- v202207-1
- v202206-1
Users API
HCP Terraform's user objects do not contain any identifying information about a user, other than their HCP Terraform username and avatar image; they are intended for displaying names and avatars in contexts that refer to a user by ID, like lists of team members or the details of a run. Most of these contexts can already include user objects via an ?include parameter, so you shouldn't usually need to make a separate call to this endpoint.
Show a User
Shows details for a given user.
GET /users/:user_id
| Parameter | Description | 
|---|---|
| :user_id | The ID of the desired user. | 
To find the ID that corresponds to a given username, you can request a team object for a team that user belongs to, specify ?include=users in the request, and look for the user's name in the included list of user objects.
| Status | Response | Reason | 
|---|---|---|
| 200 | JSON API document ( type: "users") | The request was successful | 
| 401 | JSON API error object | Unauthorized | 
| 404 | JSON API error object | User not found, or unauthorized to view the user | 
Sample Request
curl \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/vnd.api+json" \
  --request GET \
  https://app.terraform.io/api/v2/users/user-MA4GL63FmYRpSFxa
Sample Response
{
  "data": {
    "id": "user-MA4GL63FmYRpSFxa",
    "type": "users",
    "attributes": {
      "username": "admin",
      "is-service-account": false,
      "avatar-url": "https://www.gravatar.com/avatar/fa1f0c9364253d351bf1c7f5c534cd40?s=100&d=mm",
      "v2-only": true,
      "permissions": {
        "can-create-organizations": false,
        "can-change-email": true,
        "can-change-username": true
      }
    },
    "relationships": {
      "authentication-tokens": {
        "links": {
          "related": "/api/v2/users/user-MA4GL63FmYRpSFxa/authentication-tokens"
        }
      }
    },
    "links": {
      "self": "/api/v2/users/user-MA4GL63FmYRpSFxa"
    }
  }
}