> For the complete documentation index, see [llms.txt](https://docs.zenlytic.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zenlytic.com/developers-beta/api-reference/org-admin/workspaces.md).

# Workspaces

## List Workspaces For Organization

> List the workspaces in your organization.\
> \
> Archived workspaces are excluded unless \`\`include\_archived\`\` is true.

```json
{"openapi":"3.1.0","info":{"title":"FastAPI","version":"2.0.0"},"tags":[{"name":"Workspaces"}],"servers":[{"url":"https://api-external.zenlytic.com/api/v2","description":"US"},{"url":"https://euapi-external.zenlytic.com/api/v2","description":"EU"}],"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","description":"A Personal Access Token (PAT).","scheme":"bearer"}},"schemas":{"ApiV2CollectionResponse_WorkspaceSchema_":{"properties":{"data":{"items":{"$ref":"#/components/schemas/WorkspaceSchema"},"type":"array","title":"Data"},"meta":{"$ref":"#/components/schemas/MetaSchema"}},"type":"object","required":["data","meta"],"title":"ApiV2CollectionResponse[WorkspaceSchema]"},"WorkspaceSchema":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"provision_by_default":{"type":"boolean","title":"Provision By Default","description":"When true, new users signing in via SSO are automatically granted access to this workspace; when false, they need an explicit invite."},"archived_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Archived At","description":"When this workspace was archived; null while active."}},"type":"object","required":["id","name","provision_by_default"],"title":"WorkspaceSchema"},"MetaSchema":{"properties":{"status":{"$ref":"#/components/schemas/ResponseStatus"},"errors":{"items":{"$ref":"#/components/schemas/ErrorSchema"},"type":"array","title":"Errors","description":"Non-empty exactly when `status` is \"error\"."},"warnings":{"items":{"$ref":"#/components/schemas/WarningSchema"},"type":"array","title":"Warnings","description":"Can be non-empty even when `status` is \"success\" - a non-fatal issue with an otherwise-successful request."},"request_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Source","description":"Which auth mechanism served this request (e.g. \"api_key\", \"pat\"); null when not tracked for this endpoint."}},"type":"object","required":["status"],"title":"MetaSchema"},"ResponseStatus":{"type":"string","enum":["success","error"],"title":"ResponseStatus"},"ErrorSchema":{"properties":{"message":{"type":"string","title":"Message"},"status_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Status Code","description":"Matches this response's actual HTTP status code."},"occurred_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Occurred At","description":"ISO 8601 UTC timestamp."},"error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code","description":"Machine-readable code for errors that need special handling (e.g. \"SSO_REQUIRED\") rather than being shown generically; null for most errors."},"error_metadata":{"anyOf":[{"$ref":"#/components/schemas/BaseErrorMetadata"},{"type":"null"}],"description":"Additional structured detail for specific error conditions; usually null."}},"type":"object","required":["message"],"title":"ErrorSchema"},"BaseErrorMetadata":{"properties":{},"type":"object","title":"BaseErrorMetadata"},"WarningSchema":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"WarningSchema"},"ApiV2ErrorResponse":{"properties":{"meta":{"$ref":"#/components/schemas/MetaSchema"}},"type":"object","required":["meta"],"title":"ApiV2ErrorResponse"}}},"paths":{"/workspaces":{"get":{"tags":["Workspaces"],"summary":"List Workspaces For Organization","description":"List the workspaces in your organization.\n\nArchived workspaces are excluded unless ``include_archived`` is true.","operationId":"list_workspaces_for_organization_workspaces_get","parameters":[{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean","description":"Include archived workspaces in the results.","default":false,"title":"Include Archived"},"description":"Include archived workspaces in the results."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiV2CollectionResponse_WorkspaceSchema_"}}}},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiV2ErrorResponse"}}},"description":"Client Error"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiV2ErrorResponse"}}},"description":"Server Error"}}}}}}
```

## Create Workspace In Organization

> Create a new workspace in your organization.\
> \
> Requires workspace\_management permission on every workspace you belong to in the\
> organization.

```json
{"openapi":"3.1.0","info":{"title":"FastAPI","version":"2.0.0"},"tags":[{"name":"Workspaces"}],"servers":[{"url":"https://api-external.zenlytic.com/api/v2","description":"US"},{"url":"https://euapi-external.zenlytic.com/api/v2","description":"EU"}],"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","description":"A Personal Access Token (PAT).","scheme":"bearer"}},"schemas":{"CreateWorkspaceSchema":{"properties":{"name":{"type":"string","title":"Name"},"provision_by_default":{"type":"boolean","title":"Provision By Default","description":"When true, new users signing in via SSO are automatically granted access to this workspace; when false, they need an explicit invite.","default":false}},"type":"object","required":["name"],"title":"CreateWorkspaceSchema"},"ApiV2Response_CreateWorkspaceResponseSchema_":{"properties":{"data":{"$ref":"#/components/schemas/CreateWorkspaceResponseSchema"},"meta":{"$ref":"#/components/schemas/MetaSchema"}},"type":"object","required":["data","meta"],"title":"ApiV2Response[CreateWorkspaceResponseSchema]"},"CreateWorkspaceResponseSchema":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"provision_by_default":{"type":"boolean","title":"Provision By Default","description":"When true, new users signing in via SSO are automatically granted access to this workspace; when false, they need an explicit invite."}},"type":"object","required":["id","name","provision_by_default"],"title":"CreateWorkspaceResponseSchema"},"MetaSchema":{"properties":{"status":{"$ref":"#/components/schemas/ResponseStatus"},"errors":{"items":{"$ref":"#/components/schemas/ErrorSchema"},"type":"array","title":"Errors","description":"Non-empty exactly when `status` is \"error\"."},"warnings":{"items":{"$ref":"#/components/schemas/WarningSchema"},"type":"array","title":"Warnings","description":"Can be non-empty even when `status` is \"success\" - a non-fatal issue with an otherwise-successful request."},"request_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Source","description":"Which auth mechanism served this request (e.g. \"api_key\", \"pat\"); null when not tracked for this endpoint."}},"type":"object","required":["status"],"title":"MetaSchema"},"ResponseStatus":{"type":"string","enum":["success","error"],"title":"ResponseStatus"},"ErrorSchema":{"properties":{"message":{"type":"string","title":"Message"},"status_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Status Code","description":"Matches this response's actual HTTP status code."},"occurred_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Occurred At","description":"ISO 8601 UTC timestamp."},"error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code","description":"Machine-readable code for errors that need special handling (e.g. \"SSO_REQUIRED\") rather than being shown generically; null for most errors."},"error_metadata":{"anyOf":[{"$ref":"#/components/schemas/BaseErrorMetadata"},{"type":"null"}],"description":"Additional structured detail for specific error conditions; usually null."}},"type":"object","required":["message"],"title":"ErrorSchema"},"BaseErrorMetadata":{"properties":{},"type":"object","title":"BaseErrorMetadata"},"WarningSchema":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"WarningSchema"},"ApiV2ErrorResponse":{"properties":{"meta":{"$ref":"#/components/schemas/MetaSchema"}},"type":"object","required":["meta"],"title":"ApiV2ErrorResponse"}}},"paths":{"/workspaces":{"post":{"tags":["Workspaces"],"summary":"Create Workspace In Organization","description":"Create a new workspace in your organization.\n\nRequires workspace_management permission on every workspace you belong to in the\norganization.","operationId":"create_workspace_in_organization_workspaces_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkspaceSchema"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiV2Response_CreateWorkspaceResponseSchema_"}}}},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiV2ErrorResponse"}}},"description":"Client Error"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiV2ErrorResponse"}}},"description":"Server Error"}}}}}}
```

## Archive Workspace For Organization

> Archive a workspace in your organization.\
> \
> {% hint style="danger" %}\
> There is no confirmation step. Double-check \`workspace\_id\` before calling — this is a soft delete, but the workspace's users are reassigned to another workspace in the organization immediately.\
> {% endhint %}

```json
{"openapi":"3.1.0","info":{"title":"FastAPI","version":"2.0.0"},"tags":[{"name":"Workspaces"}],"servers":[{"url":"https://api-external.zenlytic.com/api/v2","description":"US"},{"url":"https://euapi-external.zenlytic.com/api/v2","description":"EU"}],"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","description":"A Personal Access Token (PAT).","scheme":"bearer"}},"schemas":{"ApiV2ErrorResponse":{"properties":{"meta":{"$ref":"#/components/schemas/MetaSchema"}},"type":"object","required":["meta"],"title":"ApiV2ErrorResponse"},"MetaSchema":{"properties":{"status":{"$ref":"#/components/schemas/ResponseStatus"},"errors":{"items":{"$ref":"#/components/schemas/ErrorSchema"},"type":"array","title":"Errors","description":"Non-empty exactly when `status` is \"error\"."},"warnings":{"items":{"$ref":"#/components/schemas/WarningSchema"},"type":"array","title":"Warnings","description":"Can be non-empty even when `status` is \"success\" - a non-fatal issue with an otherwise-successful request."},"request_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Source","description":"Which auth mechanism served this request (e.g. \"api_key\", \"pat\"); null when not tracked for this endpoint."}},"type":"object","required":["status"],"title":"MetaSchema"},"ResponseStatus":{"type":"string","enum":["success","error"],"title":"ResponseStatus"},"ErrorSchema":{"properties":{"message":{"type":"string","title":"Message"},"status_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Status Code","description":"Matches this response's actual HTTP status code."},"occurred_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Occurred At","description":"ISO 8601 UTC timestamp."},"error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code","description":"Machine-readable code for errors that need special handling (e.g. \"SSO_REQUIRED\") rather than being shown generically; null for most errors."},"error_metadata":{"anyOf":[{"$ref":"#/components/schemas/BaseErrorMetadata"},{"type":"null"}],"description":"Additional structured detail for specific error conditions; usually null."}},"type":"object","required":["message"],"title":"ErrorSchema"},"BaseErrorMetadata":{"properties":{},"type":"object","title":"BaseErrorMetadata"},"WarningSchema":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"WarningSchema"}}},"paths":{"/workspaces/{workspace_id}":{"delete":{"tags":["Workspaces"],"summary":"Archive Workspace For Organization","description":"Archive a workspace in your organization.\n\n{% hint style=\"danger\" %}\nThere is no confirmation step. Double-check `workspace_id` before calling — this is a soft delete, but the workspace's users are reassigned to another workspace in the organization immediately.\n{% endhint %}","operationId":"archive_workspace_for_organization_workspaces__workspace_id__delete","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"204":{"description":"Successful Response"},"4XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiV2ErrorResponse"}}},"description":"Client Error"},"5XX":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiV2ErrorResponse"}}},"description":"Server Error"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.zenlytic.com/developers-beta/api-reference/org-admin/workspaces.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
