---
title: "Create a source"
method: POST
path: "/v1/context-sources"
tags: ["Context Sources"]
---

# Create a source

`POST /v1/context-sources`

## Request

- Base URL: `https://api.jasper.ai`
- URL: `https://api.jasper.ai/v1/context-sources`
- Auth: one of:
  - API key in header `X-API-Key`
  - OAuth 2
    - Authorization code: `https://api.jasper.ai/oauth2/authorize`
    - Token URL: `https://api.jasper.ai/oauth2/token` scopes: `user`

Create a source that can be attached to a `CONTEXT_SOURCE_LIST` attribute on a Product (for example the universal `Images` attribute).

Submit as `multipart/form-data`. The `type` form field discriminates the payload carried on `value`: for FILE, send the file bytes as the `value` multipart part; for TEXT, URL, and KNOWLEDGE, send the payload as the `value` form field.

Take the `id` from the response and include it in the attribute value on a subsequent `POST /v1/products` or `PATCH /v1/products/{productId}` call. Attributes currently accept `FILE` sources only, and may narrow that further — the `Images` attribute takes PNG and JPEG — so a source created here is rejected at attach time if it does not qualify.

## Request body `multipart/form-data`

- CreateContextSourceDto
  - `type` 'FILE' | 'TEXT' | 'URL' | 'KNOWLEDGE', required: The kind of source being created. In every case the payload is carried on the `value` multipart part: FILE sends binary file bytes, the others send a string.
  - `value` union, required: The source payload. Its shape depends on `type`: for FILE, the binary file bytes (multipart file part; pick `binary` in the docs UI); for TEXT, a raw text string; for URL, a publicly reachable http(s) URL; for KNOWLEDGE, a Knowledge item ID (form field; pick `string`).
    - string, binary
    - string

## Response `201`

Source created successfully.

- CreateContextSourceResponseDto
  - `requestId` string, required
  - `resource` string, required
  - `data` ContextSourceResource, required
    - `id` string, required: The source ID. Reference this value when setting a `CONTEXT_SOURCE_LIST` attribute on a Product (e.g. `Images`) — note those attributes currently accept `FILE` sources only.
    - `name` string, required: The display name, derived at creation and not settable: the file name for an uploaded file, the URL for a URL, the first few words for text, or the item name for Knowledge.
    - `type` 'FILE' | 'TEXT' | 'URL' | 'KNOWLEDGE', required: The source type. On create this always matches the requested `type`.
    - `value` string: The source URL for `URL` sources, or the wrapped Knowledge item ID for `KNOWLEDGE` sources. Omitted for `FILE` and `TEXT`, which hold their content in storage.

## Other responses

- `400`: Bad request. Missing required fields or unsupported file type.
- `401`: Unauthorized access to the workspace.
- `403`: Product IQ is not enabled for this workspace.
- `500`: Internal server error. Unable to create source.

## Changes

- **2026-11-03** `3d5be7408661`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/jasper/apis/jasper-api/changes/v1/context-sources/post.md)

---

[API](https://skmtc.dev/jasper/apis/jasper-api.md) - [All operations](https://skmtc.dev/jasper/apis/jasper-api/llms.txt) - [OpenAPI document](https://skmtc.dev/jasper/apis/jasper-api/revisions/3d5be7408661?raw)
