# Choose whether agents connect to the organisation

> Page: https://docs.plotwork.dev/api/put-orgs-org-sso-agents. Index of every page: https://docs.plotwork.dev/llms.txt

When orgOnly is true, a member whose address is on one of the organisation's verified domains connects agents only to the organisation, never to their own account.

`PUT /orgs/{org}/sso/agents`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Choose whether agents connect to the organisation. |
| What does it take? | A JSON body of type [`AgentPolicy`](https://docs.plotwork.dev/api/schemas.md#agentpolicy). |
| What does it return? | Status 200 with a body of type [`AgentPolicy`](https://docs.plotwork.dev/api/schemas.md#agentpolicy). |
| What can go wrong? | `400` the body is not valid, or no domain is verified yet (sso.invalid); `401` not signed in; `403` a member or a reader (orgs.forbidden), a plan without single sign-on (plan.sso_not_included), or the request came from an origin that may not make changes; `404` no such organisation, or the caller is not a member of it; `429` too many requests; `503` organisations are not set up on this server. Every failure uses the one error envelope. |

## What it does

When orgOnly is true, a member whose address is on one of the organisation's verified domains connects agents only to the organisation, never to their own account. Turning it on needs single sign-on in the plan and a verified domain; turning it off works on any plan.

## Path parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `org` | `string` | yes | The organisation's id or its slug. |

## Request body

The body has the type [`AgentPolicy`](https://docs.plotwork.dev/api/schemas.md#agentpolicy).

| Field | Type | Required | Description |
|---|---|---|---|
| `orgOnly` | `boolean` | yes | When true, a member whose address is on one of the organisation's verified domains can connect an agent only to the organisation, not to their own account. |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 200 | The setting as stored. | [`AgentPolicy`](https://docs.plotwork.dev/api/schemas.md#agentpolicy) |
| 400 | The body is not valid, or no domain is verified yet (sso.invalid). | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 401 | Not signed in. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 403 | A member or a reader (orgs.forbidden), a plan without single sign-on (plan.sso_not_included), or the request came from an origin that may not make changes. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 404 | No such organisation, or the caller is not a member of it. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 429 | Too many requests. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 503 | Organisations are not set up on this server. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |

## Response body

A 200 answer has the type [`AgentPolicy`](https://docs.plotwork.dev/api/schemas.md#agentpolicy).

| Field | Type | Required | Description |
|---|---|---|---|
| `orgOnly` | `boolean` | yes | When true, a member whose address is on one of the organisation's verified domains can connect an agent only to the organisation, not to their own account. |

## See also

| Doc | Why |
|---|---|
| [API reference](https://docs.plotwork.dev/api/reference.md) | Every endpoint, and the error envelope |
| [Schemas](https://docs.plotwork.dev/api/schemas.md) | Every request and response type |
| [Tool reference](https://docs.plotwork.dev/mcp/tools.md) | The operations as callable tools |
