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

# Get User By Id

> Retrieve a single user by their publicId

## Get User By Id

Retrieve a single user by their publicId.

### Headers

```
Authorization: Bearer <your-api-key>
```

### Path Parameters

* `publicId` (required): User public identifier

### Success Response (200)

```json theme={null}
{
  "publicId": "usr_1234567890_abc123def",
  "firstName": "John",
  "lastName": "Doe",
  "sex": "MALE",
  "caregiverId": null,
  "role": "PATIENT",
  "birthDate": "1990-01-15",
  "addressLine1": "123 Main St",
  "addressLine2": "Apt 4B",
  "city": "New York",
  "state": "NY",
  "postalCode": "10001"
}
```

### Error Responses

#### 400 - Validation Error

```json theme={null}
{
  "error": "Validation error",
  "details": [
    {
      "code": "invalid_string",
      "message": "Invalid publicId format",
      "path": ["publicId"]
    }
  ]
}
```

#### 401 - Unauthorized

```json theme={null}
{
  "error": "API key required"
}
```

#### 403 - Forbidden

```json theme={null}
{
  "error": "Access denied"
}
```

#### 404 - Not Found

```json theme={null}
{
  "error": "Resource not found"
}
```

## Examples

### cURL Example

```bash theme={null}
# Get user by publicId
curl -X GET "https://app.hipp.health/api/v1/users/usr_1234567890_abc123def" \
  -H "Authorization: Bearer your-api-key"
```

### JavaScript Example

```javascript theme={null}
const getUserById = async (publicId) => {
  const response = await fetch(`/api/v1/users/${publicId}`, {
    method: "GET",
    headers: {
      Authorization: "Bearer your-api-key",
    },
  });

  if (!response.ok) {
    const error = await response.json();
    throw new Error(error.error || "Failed to fetch user");
  }

  return response.json();
};

// Usage
try {
  const user = await getUserById("usr_1234567890_abc123def");
  console.log("User:", user);
} catch (error) {
  console.error("Error fetching user:", error.message);
}
```


## OpenAPI

````yaml GET /v1/users/{publicId}
openapi: 3.0.0
info:
  title: Hipp Health API
  version: 1.0.0
  description: API for managing users and resources within your Hipp Health organization
servers:
  - url: https://app.hipp.health/api
    description: Production Server
security: []
paths:
  /v1/users/{publicId}:
    get:
      tags:
        - users
      summary: Get user by publicId
      description: Retrieve a single user by their publicId
      operationId: getUserByPublicId
      parameters:
        - name: publicId
          in: path
          description: User public identifier
          required: true
          schema:
            type: string
            minLength: 1
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
      security:
        - BearerAuth: []
components:
  schemas:
    User:
      type: object
      properties:
        publicId:
          type: string
          description: User public identifier
        firstName:
          type: string
          nullable: true
          description: User's first name
        lastName:
          type: string
          nullable: true
          description: User's last name
        sex:
          type: string
          nullable: true
          description: User's sex
          enum:
            - MALE
            - FEMALE
            - OTHER
        caregiverId:
          type: string
          nullable: true
          description: Caregiver public identifier (if user is a patient)
        role:
          $ref: '#/components/schemas/UserRole'
        birthDate:
          type: string
          format: date
          nullable: true
          description: User's birth date in YYYY-MM-DD format
        addressLine1:
          type: string
          nullable: true
          description: First line of address
        addressLine2:
          type: string
          nullable: true
          description: Second line of address
        city:
          type: string
          nullable: true
          description: City
        state:
          type: string
          nullable: true
          description: State
        postalCode:
          type: string
          nullable: true
          description: Postal code
      required:
        - publicId
        - role
    UserRole:
      type: string
      enum:
        - ADMIN
        - BILLING_MANAGER
        - SCHEDULING_MANAGER
        - CLINICIAN
        - TECHNICIAN
        - PATIENT
        - CAREGIVER
        - HIPP_ADMIN
        - HIPP_BILLING_MANAGER
        - CLINICAL_ADMIN
        - PAYROLL_ADMIN
        - CLINICAL_SUPERADMIN
      description: >-
        User role. All values may be returned by the API; a smaller subset may
        be assigned when creating a user (see the create user endpoint). Note
        that HIPP_ADMIN users are never returned by the list users endpoint.
    ValidationError:
      type: object
      properties:
        error:
          type: string
          example: Validation error
        details:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                example: invalid_string
              message:
                type: string
                example: Valid email is required
              path:
                type: array
                items:
                  type: string
                example:
                  - email
  responses:
    '400':
      description: Bad Request - Validation Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    '401':
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: API key required
    '403':
      description: Forbidden
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Access denied
    '404':
      description: Not Found
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Resource not found
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        API key authentication. Include your API key in the Authorization header
        as 'Bearer <your-api-key>'

````