---
title: "Create a new agent source."
method: POST
path: "/api/v1/projects/{projectId}/sources"
tags: ["Sources"]
---

# Create a new agent source.

`POST /api/v1/projects/{projectId}/sources`

Create a new data source for a given agent (formerly known as project), allowing you to add additional context by specifying a sitemap URL or uploading a file. This endpoint enables you to enrich the agent's information by incorporating relevant data sources.
Here is an example to add a new source to agent: [API](https://github.com/Poll-The-People/customgpt-cookbook/blob/main/examples/Add_a_sitemap_to_an_existing_project.ipynb) [SDK](https://github.com/Poll-The-People/customgpt-cookbook/blob/main/examples/SDK_Add_a_Sitemap_to_project.ipynb).

## Path parameters

- `projectId` integer, required

## Response `201`

Successfully created a new agent source.

- object
  - `status` 'error' | 'success' — The status of the response
  - `data` ProjectSource
    - `id` integer — The agent source ID
    - `created_at` string, date-time — The agent source creation date
    - `updated_at` string, date-time — The agent source update date
    - `type` 'sitemap' | 'upload' — The agent source type
    - `settings` object — The agent source settings
      - `executive_js` boolean — Whether the agent source should execute JavaScript
      - `data_refresh_frequency` string — The agent source data refresh frequency
      - `create_new_pages` boolean — Add new pages to agent automatically during refresh agent source
      - `remove_unexist_pages` boolean — Remove pages from agent automatically during refresh agent source
      - `refresh_existing_pages` string — Refresh existing page during refresh agent source
      - `sitemap_path` string — The agent source sitemap path
    - `pages` Page[], nullable — The agent source pages
      - `id` integer — Page ID
      - `page_url` string — URL of the document
      - `page_url_hash` string, md5 — Hash of the URL of the document
      - `project_id` integer — Agent ID
      - `s3_path` string, nullable — This is the path where the document is stored in S3.\nNote: This is omitted in the response if the document is not a file
      - `crawl_status` 'ok' | 'queued' | 'failed' | 'n/a' | 'limited' — Is the document successfully added
      - `index_status` 'ok' | 'queued' | 'failed' | 'n/a' | 'limited' — Is the document available to agent
      - `is_file` boolean — Whether the document is a file or not
      - `is_refreshable` boolean — Whether the document can be refreshed or not
      - `is_file_kept` boolean — Whether the file is kept after processing or not.\nNote: This is omitted in the response if the document is not a file
      - `filename` string, nullable — Filename of the document.\nNote: This is omitted in the response if the document is not a file
      - `filesize` integer, nullable — Filesize of the document.\nNote: This is omitted in the response if the document is not a file
      - `created_at` string, date-time — Date and time when the document was created
      - `updated_at` string, date-time — Date and time when the document was updated
      - `deleted_at` string, date-time — Date and time when the document was deleted

## Other responses

- `400` — Service unavailable
- `401` — API Token is either missing or invalid
- `404` — Agent not found
- `500` — Internal Server Error

---

[API](https://skmtc.net/poll-the-people/apis/customgpt-ai.md) · [All operations](https://skmtc.net/poll-the-people/apis/customgpt-ai/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/poll-the-people/customgpt-ai/revisions/b80e6dfcf78d/schema)
