# Get Users With Space Access

GET https://services.leadconnectorhq.com/projects/spaces/{spaceId}/users

Lists users with access as one unified `users` page (`source`: `direct` | `inherited`). `skip` / `limit` / `total` apply to the combined list (direct first). No name/email/photo and no `query` filter. Revoke a direct grant with `DELETE /projects/spaces/{spaceId}/users/{userId}`. PATCH `userIds` only adds grants.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `projects/workspace.readonly`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `spaceId` | string | Yes | Space id |

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `skip` | number | No | Number of users to skip in the unified `users` page (direct grants first, then inherited). Defaults to 0. |
| `limit` | number | No | Page size for the unified `users` list. Defaults to 50; capped server-side at 50. |
| `locationId` | string | No | Location id. **Required for `channel: APP`.** Ignored for OAuth/PIT — those use the location on the auth token. Do not send in path, body, or headers. |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/projects/spaces/{spaceId}/users": {
      "get": {
        "summary": "Get Users With Space Access",
        "operationId": "getUsersWithSpaceAccess",
        "description": "Lists users with access as one unified `users` page (`source`: `direct` | `inherited`). `skip` / `limit` / `total` apply to the combined list (direct first). No name/email/photo and no `query` filter. Revoke a direct grant with `DELETE /projects/spaces/{spaceId}/users/{userId}`. PATCH `userIds` only adds grants.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string",
              "example": "6a102435124ecfb348bd5506",
              "description": "Space id"
            },
            "description": "Space id"
          },
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "description": "Number of users to skip in the unified `users` page (direct grants first, then inherited). Defaults to 0.",
            "schema": {
              "minimum": 0,
              "default": 0,
              "example": 0,
              "type": "number",
              "description": "Skip"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Page size for the unified `users` list. Defaults to 50; capped server-side at 50.",
            "schema": {
              "minimum": 1,
              "maximum": 50,
              "default": 50,
              "example": 50,
              "type": "number",
              "description": "Page size"
            }
          },
          {
            "name": "locationId",
            "required": false,
            "in": "query",
            "description": "Location id. **Required for `channel: APP`.** Ignored for OAuth/PIT — those use the location on the auth token. Do not send in path, body, or headers.",
            "schema": {
              "example": "ve9EPM428h8b87FE9C12Kg",
              "type": "string",
              "description": "Location id. Required for APP channel (`?locationId=`). Ignored for OAuth/PIT (token location is used). Do not send in path, body, or headers."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsUsersResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsErrorResponseDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsErrorResponseDto"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — missing scope or no access to this space, folder, list, or task",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsErrorResponseDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found — space, folder, list, task, comment, or recurring task missing",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsErrorResponseDto"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsErrorResponseDto"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectsErrorResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "projects/workspace.readonly"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "ProjectsUsersResponseDto": {
        "type": "object",
        "description": "Users with access as one unified `users` page. Direct grants are listed first, then inherited. `skip` / `limit` / `total` apply to the combined list. No PII (name/email/photo). There is no `query` filter.",
        "required": [
          "users",
          "skip",
          "limit",
          "total"
        ],
        "properties": {
          "users": {
            "type": "array",
            "description": "One page of grants (direct first, then inherited)",
            "items": {
              "type": "object",
              "description": "A user grant on this space, folder, or list. Same shape for direct and inherited access. No name/email/profilePhoto — resolve `userId` via the Users API if needed. `inheritedFrom` is set only when `source` is `inherited`.",
              "required": [
                "userId",
                "principalType",
                "mode",
                "source"
              ],
              "properties": {
                "userId": {
                  "type": "string",
                  "description": "Granted user id",
                  "example": "user_1"
                },
                "principalType": {
                  "type": "string",
                  "enum": [
                    "user"
                  ],
                  "description": "Who the grant applies to. Public users responses only return `user` grants. Allowed: `user`.",
                  "example": "user"
                },
                "mode": {
                  "type": "string",
                  "enum": [
                    "allow"
                  ],
                  "description": "Access mode. This endpoint returns allow grants — it is not an effective ACL (deny grants are not listed). Allowed: `allow`.",
                  "example": "allow"
                },
                "source": {
                  "type": "string",
                  "enum": [
                    "direct",
                    "inherited"
                  ],
                  "description": "Whether the grant is on this resource (`direct`) or conferred by a private ancestor (`inherited`). Allowed: `direct`, `inherited`.",
                  "example": "direct"
                },
                "inheritedFrom": {
                  "type": "object",
                  "nullable": true,
                  "description": "Closest private ancestor that conferred access. `null` when `source` is `direct`.",
                  "required": [
                    "id",
                    "type"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Ancestor id",
                      "example": "6a102435124ecfb348bd5506"
                    },
                    "name": {
                      "type": "string",
                      "description": "Ancestor display name",
                      "example": "Marketing"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "space",
                        "folder",
                        "list"
                      ],
                      "description": "Ancestor type. Allowed: `space`, `folder`, `list`.",
                      "example": "space"
                    }
                  },
                  "example": {
                    "id": "6a102435124ecfb348bd5506",
                    "name": "Marketing",
                    "type": "space"
                  }
                }
              },
              "example": {
                "userId": "user_1",
                "principalType": "user",
                "mode": "allow",
                "source": "direct",
                "inheritedFrom": null
              },
              "title": "ProjectsMemberDto"
            },
            "example": [
              {
                "userId": "user_1",
                "principalType": "user",
                "mode": "allow",
                "source": "direct",
                "inheritedFrom": null
              },
              {
                "userId": "user_2",
                "principalType": "user",
                "mode": "allow",
                "source": "inherited",
                "inheritedFrom": {
                  "id": "6a102435124ecfb348bd5506",
                  "name": "Marketing",
                  "type": "space"
                }
              }
            ]
          },
          "skip": {
            "type": "number",
            "description": "Echoed page offset into the unified users list",
            "example": 0
          },
          "limit": {
            "type": "number",
            "description": "Echoed page size (max 50)",
            "example": 50
          },
          "total": {
            "type": "number",
            "description": "Total users after merge (direct + inherited), before pagination",
            "example": 2
          }
        },
        "title": "ProjectsUsersResponseDto"
      },
      "ProjectsErrorResponseDto": {
        "type": "object",
        "description": "Error payload for non-2xx responses. Same shape on every Projects operation.\n\n`message` is a string, or a string array for validation failures.\n\n`error` is usually the HTTP reason phrase (`Bad Request`, `Unprocessable Entity`, …). Known domain values include `graph_scope_invalid` (Search list-scope failures).\n\nWhen `error` is `graph_scope_invalid`, `reason` discriminates the failure: `too_many_ids` | `non_list_type` | `duplicate_graph_scope`.",
        "required": [
          "statusCode",
          "message"
        ],
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code",
            "example": 422
          },
          "message": {
            "description": "Human-readable message, or a list of validation messages",
            "oneOf": [
              {
                "type": "string",
                "example": "Task is already in the destination list"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "example": [
                  "dueDate must be a string"
                ]
              }
            ],
            "example": null
          },
          "error": {
            "type": "string",
            "description": "HTTP reason phrase or domain code when present. Domain codes seen today: `graph_scope_invalid`. Otherwise Nest’s reason phrase.",
            "example": "graph_scope_invalid"
          },
          "reason": {
            "type": "string",
            "description": "Present when `error` is `graph_scope_invalid`. Discriminates Search list-scope failures. Allowed: `too_many_ids`, `non_list_type`, `duplicate_graph_scope`.",
            "enum": [
              "too_many_ids",
              "non_list_type",
              "duplicate_graph_scope"
            ],
            "example": "too_many_ids"
          }
        },
        "example": {
          "statusCode": 422,
          "message": "graph.id scope may not exceed 10 list IDs",
          "error": "graph_scope_invalid",
          "reason": "too_many_ids"
        },
        "title": "ProjectsErrorResponseDto"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/projects/spaces/<spaceId>/users' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/projects/spaces/<spaceId>/users', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/projects/spaces/{spaceId}/users"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

response = requests.get(url, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/projects/spaces/<spaceId>/users',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/projects/spaces/<spaceId>/users")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
)

func main() {
  url := "https://services.leadconnectorhq.com/projects/spaces/<spaceId>/users"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/projects/spaces/<spaceId>/users")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/projects/spaces/<spaceId>/users' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
