> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.neetoinvoice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting the User ID

> Understand how to retrieve user IDs for use in your API calls.

## What is a User ID?

A user ID is a unique identifier assigned to each team member in your workspace. It's required for making API requests that interact with specific users, such as adding users to projects or managing user permissions.

### Step-by-Step Instructions

<Steps>
  <Step title="Make the API request">
    Send a `GET` request to the [List all team members](/api-reference/team-members/list) API endpoint, including your API key in the request header.
  </Step>

  <Step title="Parse the response">
    The response will contain a `team_members` array with team member objects, each containing an `id` field.

    Example:

    ```json theme={"system"}
    {
      "team_members": [
        {
          "id": "5a2de667-243b-4da3-b090-b698a03d98da",
          "email": "john.doe@example.com",
          "first_name": "John",
          "last_name": "Doe",
          "time_zone": "UTC",
          "profile_image_url": null,
          "active": true,
          "organization_role": "admin"
        },
        {
          "id": "7b3ef778-354c-5eb4-c1a1-c8a9b14e09eb",
          "email": "jane.smith@example.com",
          "first_name": "Jane",
          "last_name": "Smith",
          "time_zone": "America/New_York",
          "profile_image_url": "https://example.com/profile.jpg",
          "active": true,
          "organization_role": "editor"
        }
      ],

      // ... rest of the details
    }
    ```
  </Step>

  <Step title="Extract the user ID">
    Here the user ID for `John Doe` is: **5a2de667-243b-4da3-b090-b698a03d98da**.

    You can access the user ID in your code from the response using:

    <CodeGroup>
      ```javascript JavaScript theme={"system"}
      // Get the first user's ID
      const userId = response.team_members[0].id;

      // Or iterate through all users to find a specific one
      const johnUser = response.team_members.find(user => user.first_name === "John" && user.last_name === "Doe");
      const johnUserId = johnUser.id;
      ```

      ```python Python theme={"system"}
      # Get the first user's ID
      user_id = response['team_members'][0]['id']

      # Or iterate through all users to find a specific one
      john_user = next(user for user in response['team_members'] if user['first_name'] == "John" and user['last_name'] == "Doe")
      john_user_id = john_user['id']
      ```

      ```bash Bash theme={"system"}
      # Extract user ID using jq
      user_id=$(echo "$response" | jq -r '.team_members[0].id')

      # Or find a specific user by name
      john_user_id=$(echo "$response" | jq -r '.team_members[] | select(.first_name == "John" and .last_name == "Doe") | .id')
      ```
    </CodeGroup>
  </Step>
</Steps>
