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

# Assign knowledge to agents

> Assign or unassign folders to agents in bulk.

Use this route to control which folders, and therefore which knowledge, an agent can access.

## Headers

<ParamField header="Authorization" type="string" required>
  Bearer token containing your Fini workspace API key. Format: `Bearer fini_...` The key needs `write` scope.
</ParamField>

<ParamField header="Content-Type" type="string" required>
  `application/json`
</ParamField>

## Body parameters

<ParamField body="junctions" type="array" required>
  Batch of folder-agent changes.

  <Expandable title="junction object">
    <ParamField body="junctions[].folderId" type="string" required>
      Folder ID to assign or unassign.
    </ParamField>

    <ParamField body="junctions[].botId" type="string" required>
      Agent ID the folder should be changed on.
    </ParamField>

    <ParamField body="junctions[].action" type="string" required>
      Action to apply. Allowed values are `ADD` and `DELETE`.
    </ParamField>
  </Expandable>
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api-prod.usefini.com/v2/hc-bot-folder-junctions/public' \
    --header 'Authorization: Bearer fini_your_api_key' \
    --header 'Content-Type: application/json' \
    --data '{
      "junctions": [
        {
          "folderId": "0f4da4fe-b2ae-4787-8c3b-854f36d9eb1b",
          "botId": "4f5ef695-d03b-4d56-8fef-7f2bd5c17ef3",
          "action": "ADD"
        }
      ]
    }'
  ```
</RequestExample>

## Response

<ResponseField name="status" type="boolean">
  Always `true` when the batch succeeds.
</ResponseField>

## Errors

<AccordionGroup>
  <Accordion title="400 Bad Request" icon="circle-exclamation">
    The request body is malformed, or one of the enum values is invalid.
  </Accordion>

  <Accordion title="401 Unauthorized" icon="lock">
    The API key is missing, malformed, revoked, or invalid.
  </Accordion>

  <Accordion title="403 Forbidden" icon="shield-halved">
    The API key does not include the `write` scope.
  </Accordion>
</AccordionGroup>
