> ## 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.

# Refresh sources

> Re-fetch existing source IDs so Fini can detect upstream changes and update linked knowledge.

Use this route when the upstream content behind existing sources has changed and you want Fini to re-fetch those sources.

<Info>
  Refreshing sources is the first step in the knowledge-refresh workflow. After the refresh completes, use [List sources](/en/api-reference/list-sources) with `changed=true`, then call [Bulk generate knowledge](/en/api-reference/bulk-generate-knowledge) on those changed source IDs.
</Info>

## 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="documentIds" type="array" required>
  Existing source IDs to requeue for refresh.
</ParamField>

## Response

The response is a top-level array of source IDs accepted for refresh.

<ResponseField name="[]" type="array">
  Source IDs that were queued for refresh.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api-prod.usefini.com/v2/documents/public/refresh' \
    --header 'Authorization: Bearer fini_your_api_key' \
    --header 'Content-Type: application/json' \
    --data '{
      "documentIds": [
        "5d9f67a8-d853-4af4-b7ce-23ebba1245e5",
        "35b4838a-4136-4f6c-a530-8f17cb47566d"
      ]
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  [
    "5d9f67a8-d853-4af4-b7ce-23ebba1245e5",
    "35b4838a-4136-4f6c-a530-8f17cb47566d"
  ]
  ```
</ResponseExample>

<Note>
  Raw-file sources cannot be refreshed through this route. Delete and re-upload them instead.
</Note>

## Errors

<AccordionGroup>
  <Accordion title="400 Bad Request" icon="circle-exclamation">
    The request body is malformed, `documentIds` is missing or empty, one of the source IDs does not exist, or you tried to refresh a raw-file source.
  </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, or the source IDs belong to a different workspace.
  </Accordion>

  <Accordion title="500 Internal Server Error" icon="triangle-exclamation">
    Fini failed while queueing or processing the refresh. Retry once, then inspect the affected IDs in [List sources](/en/api-reference/list-sources).
  </Accordion>
</AccordionGroup>
