---
title: "Add source"
method: POST
path: "/api/v2/projects/{slug}/sources/"
tags: ["Sources"]
---

# Add source

`POST /api/v2/projects/{slug}/sources/`

## Request

- Base URL: `https://app.biel.ai`
- URL: `https://app.biel.ai/api/v2/projects/{slug}/sources/`
- Auth: API key in header `Authorization`

Add sources to a project. Supports files, URLs, sitemaps, hosted sites (ZIP), GitHub repositories, OpenAPI specifications, and Confluence spaces. All sources are indexed for search and chat.

Use `multipart/form-data` when uploading binary content (files or site ZIPs). Use `application/json` for everything else, including private GitHub repositories and private Confluence spaces that need credentials.

**Required permission:** `sources_create`

| Source type | Limits / notes |
|-------------|----------------|
| Files (PDF, MD, TXT, DOCX, PPTX, XLSX, CSV, YAML, JSON, RST, HTML, CSS, JS, XML) | 10 MB per file. `multipart/form-data` only |
| URLs | Must be publicly accessible |
| Sitemaps | Must end in `.xml` |
| Hosted sites (ZIP) | 250 MB per ZIP. `multipart/form-data` only. `site_name` is required |
| GitHub repositories | Public repos work via either content type. Private repos require a personal access token (JSON only) |
| OpenAPI specifications | JSON or YAML URL |
| Confluence spaces | Public spaces work via either content type. Private spaces require username + API token (JSON only) |

If a value is wrong, such as a sitemap URL that doesn't end in `.xml`, the request returns `400` with the errors listed by field name. If the values look right but the source still can't be added, such as an unsupported file type or a corrupt ZIP, the request returns `422` with a single `error` message explaining why.

## Path parameters

- `slug` string, required

## Request body

- AddSourceJson: JSON body for adding non-binary sources. Use `multipart/form-data` instead when uploading files or site ZIPs. At least one of `urls`, `sitemaps`, `repositories`, `openapis`, or `confluences` must be supplied.
  - `urls` string[]: URLs to crawl and index.
  - `sitemaps` string[]: Sitemap URLs to crawl.
  - `repositories` RepositoryInput[]: GitHub repositories to ingest.
    - `url` string, uri, required: GitHub repository URL.
    - `token` string: GitHub personal access token. Required for private repositories. Stored encrypted.
    - `include_patterns` string: Comma-separated patterns to include (for example, `*.py, src/`).
    - `exclude_patterns` string: Comma-separated patterns to exclude (for example, `*.log, temp/`).
    - `max_file_size` integer: Maximum file size in bytes. Defaults to 10485760 (10 MB).
  - `openapis` string[]: OpenAPI specification URLs (JSON or YAML).
  - `confluences` ConfluenceInput[]: Confluence spaces to ingest.
    - `confluence_url` string, uri, required: Confluence space URL (e.g. `https://yourcompany.atlassian.net/wiki/spaces/DOCS`). The base URL and space key are auto-extracted.
    - `username` string: Confluence username. Required for private spaces. Stored encrypted.
    - `api_token` string: Confluence API token. Required for private spaces. Stored encrypted.

## Response `201`

Sources created successfully

- object
  - `message` string
  - `sources` Source[]: Sources created by this request. Use the `uuid` to poll [`GET /api/v2/projects/{slug}/sources/{source_uuid}/`](/api/get-source) for ingestion status.
    - union: A single project source. The `type` field determines the concrete shape.
      - FileSource: Properties shared by every source type.
        - `uuid` string, uuid, required: Source UUID.
        - `type` 'file' | 'url' | 'sitemap' | 'site' | 'hosted_site' | 'repository' | 'openapi' | 'confluence', required: Source type.
        - `name` string, required: Display name (file name, URL, repository name, etc.).
        - `created_at` string, date-time: ISO-8601 timestamp of when the source was added.
      - UrlSource: Properties shared by every source type.
        - `uuid` string, uuid, required: Source UUID.
        - `type` 'file' | 'url' | 'sitemap' | 'site' | 'hosted_site' | 'repository' | 'openapi' | 'confluence', required: Source type.
        - `name` string, required: Display name (file name, URL, repository name, etc.).
        - `created_at` string, date-time: ISO-8601 timestamp of when the source was added.
        - `url` string, uri: The crawled URL.
      - SitemapSource: Properties shared by every source type.
        - `uuid` string, uuid, required: Source UUID.
        - `type` 'file' | 'url' | 'sitemap' | 'site' | 'hosted_site' | 'repository' | 'openapi' | 'confluence', required: Source type.
        - `name` string, required: Display name (file name, URL, repository name, etc.).
        - `created_at` string, date-time: ISO-8601 timestamp of when the source was added.
        - `url` string, uri: The sitemap URL.
      - SitePageSource: Properties shared by every source type.
        - `uuid` string, uuid, required: Source UUID.
        - `type` 'file' | 'url' | 'sitemap' | 'site' | 'hosted_site' | 'repository' | 'openapi' | 'confluence', required: Source type.
        - `name` string, required: Display name (file name, URL, repository name, etc.).
        - `created_at` string, date-time: ISO-8601 timestamp of when the source was added.
        - `url` string, uri: Original URL the page maps to.
      - HostedSiteSource: Properties shared by every source type.
        - `uuid` string, uuid, required: Source UUID.
        - `type` 'file' | 'url' | 'sitemap' | 'site' | 'hosted_site' | 'repository' | 'openapi' | 'confluence', required: Source type.
        - `name` string, required: Display name (file name, URL, repository name, etc.).
        - `created_at` string, date-time: ISO-8601 timestamp of when the source was added.
        - `base_url` string, uri: Original base URL of the site.
        - `hosted_url` string, uri: URL where Biel.ai serves the uploaded site.
        - `page_count` integer: Number of indexed pages.
      - RepositorySource: Properties shared by every source type.
        - `uuid` string, uuid, required: Source UUID.
        - `type` 'file' | 'url' | 'sitemap' | 'site' | 'hosted_site' | 'repository' | 'openapi' | 'confluence', required: Source type.
        - `name` string, required: Display name (file name, URL, repository name, etc.).
        - `created_at` string, date-time: ISO-8601 timestamp of when the source was added.
        - `url` string, uri: Repository URL.
      - OpenApiSource: Properties shared by every source type.
        - `uuid` string, uuid, required: Source UUID.
        - `type` 'file' | 'url' | 'sitemap' | 'site' | 'hosted_site' | 'repository' | 'openapi' | 'confluence', required: Source type.
        - `name` string, required: Display name (file name, URL, repository name, etc.).
        - `created_at` string, date-time: ISO-8601 timestamp of when the source was added.
        - `url` string, uri: Specification URL (JSON or YAML).
      - ConfluenceSource: Properties shared by every source type.
        - `uuid` string, uuid, required: Source UUID.
        - `type` 'file' | 'url' | 'sitemap' | 'site' | 'hosted_site' | 'repository' | 'openapi' | 'confluence', required: Source type.
        - `name` string, required: Display name (file name, URL, repository name, etc.).
        - `created_at` string, date-time: ISO-8601 timestamp of when the source was added.
        - `space_key` string: Confluence space key.
        - `base_url` string, uri: Confluence base URL.

## Other responses

- `400`: Validation error. Field-level errors keyed by field name.
- `403`: Forbidden. Missing permissions.
- `404`: Resource not found.
- `422`: Unprocessable. The request was valid, but it cannot be completed.

---

[API](https://skmtc.dev/biel/apis/biel-ai-api.md) · [All operations](https://skmtc.dev/biel/apis/biel-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/biel/apis/biel-ai-api/revisions/ac7034d82696?raw)
