> For the complete documentation index, see [llms.txt](https://docs.usepylon.com/pylon-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.usepylon.com/pylon-docs/developer/api/api-reference/training-data.md).

# Training Data

Endpoints for managing training data sources used by Pylon AI.

Use Training Data to connect external knowledge sources that power Pylon’s AI.

For UI setup and behavior, see [Training Data](/pylon-docs/platform/training-data.md).

{% hint style="info" %}
This API Reference section renders from our OpenAPI spec.

If you don’t see any endpoints below, they may not be published in the spec yet.
{% endhint %}

### Endpoints

## List all training data configurations

> Returns all training data configurations for the organization.\
> \
> \*\*Rate limit:\*\* 300 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"tags":[],"servers":[{"description":"US region","url":"https://api.usepylon.com"},{"description":"EU region","url":"https://api.eu.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"responses":{"ListTrainingDataResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListTrainingDataResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"UnauthorizedApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request could not be authenticated for this API."},"ForbiddenApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The authenticated caller or organization is not allowed to access this endpoint or operation."},"TooManyRequestsApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request exceeded the applicable rate limit.","headers":{"Retry-After":{"description":"Seconds until the next request to this endpoint is permitted.","schema":{"format":"int64","type":"integer"}},"X-Retry-After":{"description":"Seconds until the full per-minute allowance is restored. Capacity returns gradually before then.","schema":{"format":"int64","type":"integer"}}}},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}},"schemas":{"ListTrainingDataResponseBody":{"properties":{"data":{"items":{"$ref":"#/components/schemas/TrainingData"},"type":"array"},"request_id":{"type":"string"}},"required":["data","request_id"],"type":"object"},"TrainingData":{"properties":{"created_at":{"format":"date-time","type":"string"},"documents":{"items":{"$ref":"#/components/schemas/TrainingDataDocument"},"type":"array"},"exclude_from_kb_search":{"type":"boolean"},"id":{"type":"string"},"name":{"type":"string"},"scrape_status":{"$ref":"#/components/schemas/TrainingDataScrapeStatus"},"type":{"type":"string"},"updated_at":{"format":"date-time","type":"string"},"visibility":{"description":"Known values: `everyone`, `user_only`, `ai_agent_only`. This list is not exhaustive.","type":"string"}},"required":["created_at","exclude_from_kb_search","id","name","type","updated_at","visibility"],"type":"object"},"TrainingDataDocument":{"properties":{"external_id":{"type":"string"},"file_name":{"type":"string"},"file_size":{"format":"int64","type":"integer"},"file_type":{"type":"string"},"id":{"type":"string"},"s3_key":{"type":"string"}},"required":["file_name","file_size","file_type","id","s3_key"],"type":"object"},"TrainingDataScrapeStatus":{"properties":{"last_scraped_at":{"format":"date-time","type":"string"},"pages_scraped":{"format":"int64","type":"integer"},"status":{"type":"string"},"total_pages":{"format":"int64","type":"integer"}},"required":["pages_scraped","status","total_pages"],"type":"object"},"ErrorApiResponseBody":{"properties":{"code":{"description":"A stable machine-readable identifier for this failure, safe to branch on\ninstead of the message text. Omitted when the failure has no assigned code.\n\nKnown values: `recipients_suppressed`, `email_bounced`, `internal_issue_reply_not_allowed`, `duplicate_object`, `invalid_authorization_header`, `invalid_api_token`, `invalid_oauth_token`, `wrong_region_token`, `organization_deactivated`, `organization_suspended`, `permission_denied`, `oauth_not_permitted`, `rate_limited`, `not_found`, `method_not_allowed`, `payload_too_large`, `invalid_request_body`, `internal_error`, `invalid_webhook_credentials`, `organization_inactive`. This list is not exhaustive.","type":"string"},"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"required":["request_id"],"type":"object"}}},"paths":{"/training-data":{"get":{"description":"Returns all training data configurations for the organization.\n\n**Rate limit:** 300 requests per minute","operationId":"ListTrainingData","responses":{"200":{"$ref":"#/components/responses/ListTrainingDataResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"401":{"$ref":"#/components/responses/UnauthorizedApiResponse"},"403":{"$ref":"#/components/responses/ForbiddenApiResponse"},"429":{"$ref":"#/components/responses/TooManyRequestsApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"List all training data configurations","tags":["training-data"]}}}}
```

## Create a training data configuration

> Creates a new training data configuration for the organization.\
> \
> \*\*Rate limit:\*\* 30 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"tags":[],"servers":[{"description":"US region","url":"https://api.usepylon.com"},{"description":"EU region","url":"https://api.eu.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"CreateTrainingDataRequestBody":{"properties":{"training_data_name":{"description":"The name of the training data container.","type":"string"},"visibility":{"default":"everyone","description":"The visibility of the training data. Defaults to \"everyone\".\nValid values: \"everyone\", \"user_only\", \"ai_agent_only\"","enum":["everyone","user_only","ai_agent_only"],"type":"string"}},"type":"object"},"CreateTrainingDataResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/TrainingData"},"request_id":{"type":"string"}},"required":["data","request_id"],"type":"object"},"TrainingData":{"properties":{"created_at":{"format":"date-time","type":"string"},"documents":{"items":{"$ref":"#/components/schemas/TrainingDataDocument"},"type":"array"},"exclude_from_kb_search":{"type":"boolean"},"id":{"type":"string"},"name":{"type":"string"},"scrape_status":{"$ref":"#/components/schemas/TrainingDataScrapeStatus"},"type":{"type":"string"},"updated_at":{"format":"date-time","type":"string"},"visibility":{"description":"Known values: `everyone`, `user_only`, `ai_agent_only`. This list is not exhaustive.","type":"string"}},"required":["created_at","exclude_from_kb_search","id","name","type","updated_at","visibility"],"type":"object"},"TrainingDataDocument":{"properties":{"external_id":{"type":"string"},"file_name":{"type":"string"},"file_size":{"format":"int64","type":"integer"},"file_type":{"type":"string"},"id":{"type":"string"},"s3_key":{"type":"string"}},"required":["file_name","file_size","file_type","id","s3_key"],"type":"object"},"TrainingDataScrapeStatus":{"properties":{"last_scraped_at":{"format":"date-time","type":"string"},"pages_scraped":{"format":"int64","type":"integer"},"status":{"type":"string"},"total_pages":{"format":"int64","type":"integer"}},"required":["pages_scraped","status","total_pages"],"type":"object"},"ErrorApiResponseBody":{"properties":{"code":{"description":"A stable machine-readable identifier for this failure, safe to branch on\ninstead of the message text. Omitted when the failure has no assigned code.\n\nKnown values: `recipients_suppressed`, `email_bounced`, `internal_issue_reply_not_allowed`, `duplicate_object`, `invalid_authorization_header`, `invalid_api_token`, `invalid_oauth_token`, `wrong_region_token`, `organization_deactivated`, `organization_suspended`, `permission_denied`, `oauth_not_permitted`, `rate_limited`, `not_found`, `method_not_allowed`, `payload_too_large`, `invalid_request_body`, `internal_error`, `invalid_webhook_credentials`, `organization_inactive`. This list is not exhaustive.","type":"string"},"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"required":["request_id"],"type":"object"}},"responses":{"CreateTrainingDataResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTrainingDataResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"UnauthorizedApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request could not be authenticated for this API."},"ForbiddenApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The authenticated caller or organization is not allowed to access this endpoint or operation."},"TooManyRequestsApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request exceeded the applicable rate limit.","headers":{"Retry-After":{"description":"Seconds until the next request to this endpoint is permitted.","schema":{"format":"int64","type":"integer"}},"X-Retry-After":{"description":"Seconds until the full per-minute allowance is restored. Capacity returns gradually before then.","schema":{"format":"int64","type":"integer"}}}},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}}},"paths":{"/training-data":{"post":{"description":"Creates a new training data configuration for the organization.\n\n**Rate limit:** 30 requests per minute","operationId":"CreateTrainingData","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTrainingDataRequestBody"}}}},"responses":{"200":{"$ref":"#/components/responses/CreateTrainingDataResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"401":{"$ref":"#/components/responses/UnauthorizedApiResponse"},"403":{"$ref":"#/components/responses/ForbiddenApiResponse"},"429":{"$ref":"#/components/responses/TooManyRequestsApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Create a training data configuration","tags":["training-data"]}}}}
```

## Get a training data configuration by its ID

> Returns a single training data configuration by ID.\
> \
> \*\*Rate limit:\*\* 300 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"tags":[],"servers":[{"description":"US region","url":"https://api.usepylon.com"},{"description":"EU region","url":"https://api.eu.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"responses":{"GetTrainingDataResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetTrainingDataResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"UnauthorizedApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request could not be authenticated for this API."},"ForbiddenApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The authenticated caller or organization is not allowed to access this endpoint or operation."},"ErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"TooManyRequestsApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request exceeded the applicable rate limit.","headers":{"Retry-After":{"description":"Seconds until the next request to this endpoint is permitted.","schema":{"format":"int64","type":"integer"}},"X-Retry-After":{"description":"Seconds until the full per-minute allowance is restored. Capacity returns gradually before then.","schema":{"format":"int64","type":"integer"}}}},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}},"schemas":{"GetTrainingDataResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/TrainingData"},"request_id":{"type":"string"}},"required":["data","request_id"],"type":"object"},"TrainingData":{"properties":{"created_at":{"format":"date-time","type":"string"},"documents":{"items":{"$ref":"#/components/schemas/TrainingDataDocument"},"type":"array"},"exclude_from_kb_search":{"type":"boolean"},"id":{"type":"string"},"name":{"type":"string"},"scrape_status":{"$ref":"#/components/schemas/TrainingDataScrapeStatus"},"type":{"type":"string"},"updated_at":{"format":"date-time","type":"string"},"visibility":{"description":"Known values: `everyone`, `user_only`, `ai_agent_only`. This list is not exhaustive.","type":"string"}},"required":["created_at","exclude_from_kb_search","id","name","type","updated_at","visibility"],"type":"object"},"TrainingDataDocument":{"properties":{"external_id":{"type":"string"},"file_name":{"type":"string"},"file_size":{"format":"int64","type":"integer"},"file_type":{"type":"string"},"id":{"type":"string"},"s3_key":{"type":"string"}},"required":["file_name","file_size","file_type","id","s3_key"],"type":"object"},"TrainingDataScrapeStatus":{"properties":{"last_scraped_at":{"format":"date-time","type":"string"},"pages_scraped":{"format":"int64","type":"integer"},"status":{"type":"string"},"total_pages":{"format":"int64","type":"integer"}},"required":["pages_scraped","status","total_pages"],"type":"object"},"ErrorApiResponseBody":{"properties":{"code":{"description":"A stable machine-readable identifier for this failure, safe to branch on\ninstead of the message text. Omitted when the failure has no assigned code.\n\nKnown values: `recipients_suppressed`, `email_bounced`, `internal_issue_reply_not_allowed`, `duplicate_object`, `invalid_authorization_header`, `invalid_api_token`, `invalid_oauth_token`, `wrong_region_token`, `organization_deactivated`, `organization_suspended`, `permission_denied`, `oauth_not_permitted`, `rate_limited`, `not_found`, `method_not_allowed`, `payload_too_large`, `invalid_request_body`, `internal_error`, `invalid_webhook_credentials`, `organization_inactive`. This list is not exhaustive.","type":"string"},"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"required":["request_id"],"type":"object"}}},"paths":{"/training-data/{id}":{"get":{"description":"Returns a single training data configuration by ID.\n\n**Rate limit:** 300 requests per minute","operationId":"GetTrainingData","parameters":[{"description":"The ID of the training data.","in":"path","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"$ref":"#/components/responses/GetTrainingDataResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"401":{"$ref":"#/components/responses/UnauthorizedApiResponse"},"403":{"$ref":"#/components/responses/ForbiddenApiResponse"},"404":{"$ref":"#/components/responses/ErrorApiResponse"},"429":{"$ref":"#/components/responses/TooManyRequestsApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Get a training data configuration by its ID","tags":["training-data"]}}}}
```

## Upload files as training data

> Uploads one or more files to a training data configuration.\
> \
> \*\*Rate limit:\*\* 30 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"tags":[],"servers":[{"description":"US region","url":"https://api.usepylon.com"},{"description":"EU region","url":"https://api.eu.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"responses":{"TrainingDataUploadResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrainingDataUploadResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"UnauthorizedApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request could not be authenticated for this API."},"ForbiddenApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The authenticated caller or organization is not allowed to access this endpoint or operation."},"TooManyRequestsApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request exceeded the applicable rate limit.","headers":{"Retry-After":{"description":"Seconds until the next request to this endpoint is permitted.","schema":{"format":"int64","type":"integer"}},"X-Retry-After":{"description":"Seconds until the full per-minute allowance is restored. Capacity returns gradually before then.","schema":{"format":"int64","type":"integer"}}}},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}},"schemas":{"TrainingDataUploadResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/TrainingData"},"request_id":{"type":"string"}},"required":["data","request_id"],"type":"object"},"TrainingData":{"properties":{"created_at":{"format":"date-time","type":"string"},"documents":{"items":{"$ref":"#/components/schemas/TrainingDataDocument"},"type":"array"},"exclude_from_kb_search":{"type":"boolean"},"id":{"type":"string"},"name":{"type":"string"},"scrape_status":{"$ref":"#/components/schemas/TrainingDataScrapeStatus"},"type":{"type":"string"},"updated_at":{"format":"date-time","type":"string"},"visibility":{"description":"Known values: `everyone`, `user_only`, `ai_agent_only`. This list is not exhaustive.","type":"string"}},"required":["created_at","exclude_from_kb_search","id","name","type","updated_at","visibility"],"type":"object"},"TrainingDataDocument":{"properties":{"external_id":{"type":"string"},"file_name":{"type":"string"},"file_size":{"format":"int64","type":"integer"},"file_type":{"type":"string"},"id":{"type":"string"},"s3_key":{"type":"string"}},"required":["file_name","file_size","file_type","id","s3_key"],"type":"object"},"TrainingDataScrapeStatus":{"properties":{"last_scraped_at":{"format":"date-time","type":"string"},"pages_scraped":{"format":"int64","type":"integer"},"status":{"type":"string"},"total_pages":{"format":"int64","type":"integer"}},"required":["pages_scraped","status","total_pages"],"type":"object"},"ErrorApiResponseBody":{"properties":{"code":{"description":"A stable machine-readable identifier for this failure, safe to branch on\ninstead of the message text. Omitted when the failure has no assigned code.\n\nKnown values: `recipients_suppressed`, `email_bounced`, `internal_issue_reply_not_allowed`, `duplicate_object`, `invalid_authorization_header`, `invalid_api_token`, `invalid_oauth_token`, `wrong_region_token`, `organization_deactivated`, `organization_suspended`, `permission_denied`, `oauth_not_permitted`, `rate_limited`, `not_found`, `method_not_allowed`, `payload_too_large`, `invalid_request_body`, `internal_error`, `invalid_webhook_credentials`, `organization_inactive`. This list is not exhaustive.","type":"string"},"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"required":["request_id"],"type":"object"}}},"paths":{"/training-data/upload":{"post":{"description":"Uploads one or more files to a training data configuration.\n\n**Rate limit:** 30 requests per minute","operationId":"UploadTrainingDataFiles","requestBody":{"content":{"multipart/form-data":{"schema":{"properties":{"external_ids":{"description":"External IDs for idempotent operations. Must match the number of files if provided.\nUsed for duplicate detection and updates.","items":{"type":"string"},"type":"array"},"file_names":{"description":"Custom names for the uploaded files. Must match the number of files if provided.\nIf not provided, original filenames will be used.","items":{"type":"string"},"type":"array"},"files":{"description":"The files to upload (minimum 1, maximum 10).\nSupported types: PDF, plain text, markdown, CSV, JSON, and images (JPEG, PNG, GIF, WebP).\nMaximum size: 50MB per file, 100MB total.","items":{"type":"string"},"type":"array"},"training_data_id":{"description":"The ID of an existing training data container to upload files to.\nRequired if not creating new training data.","type":"string"},"training_data_name":{"description":"The name of a new training data container.\nRequired when creating new training data (if training_data_id is not provided).","type":"string"},"visibility":{"default":"everyone","description":"Visibility of the training data. Defaults to \"everyone\".\nValid values: \"everyone\", \"user_only\", \"ai_agent_only\"","enum":["everyone","user_only","ai_agent_only"],"type":"string"}},"required":["files"],"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/TrainingDataUploadResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"401":{"$ref":"#/components/responses/UnauthorizedApiResponse"},"403":{"$ref":"#/components/responses/ForbiddenApiResponse"},"429":{"$ref":"#/components/responses/TooManyRequestsApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Upload files as training data","tags":["training-data"]}}}}
```

## Upload text content as training data

> Uploads plain text content as a training data document.\
> \
> \*\*Rate limit:\*\* 30 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"tags":[],"servers":[{"description":"US region","url":"https://api.usepylon.com"},{"description":"EU region","url":"https://api.eu.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"schemas":{"UploadTrainingDataFileContentRequestBody":{"properties":{"content":{"description":"The text content to upload.","type":"string"},"external_id":{"description":"External ID for idempotent operations (optional).","type":"string"},"file_name":{"description":"The name for the uploaded file.","type":"string"},"training_data_id":{"description":"The ID of an existing training data container to upload to (optional).","type":"string"},"training_data_name":{"description":"The name of a new training data container (required if training_data_id not provided).","type":"string"},"visibility":{"default":"everyone","description":"Visibility of the training data. Defaults to \"everyone\".","enum":["everyone","user_only","ai_agent_only"],"type":"string"}},"type":"object"},"TrainingDataUploadResponseBody":{"properties":{"data":{"$ref":"#/components/schemas/TrainingData"},"request_id":{"type":"string"}},"required":["data","request_id"],"type":"object"},"TrainingData":{"properties":{"created_at":{"format":"date-time","type":"string"},"documents":{"items":{"$ref":"#/components/schemas/TrainingDataDocument"},"type":"array"},"exclude_from_kb_search":{"type":"boolean"},"id":{"type":"string"},"name":{"type":"string"},"scrape_status":{"$ref":"#/components/schemas/TrainingDataScrapeStatus"},"type":{"type":"string"},"updated_at":{"format":"date-time","type":"string"},"visibility":{"description":"Known values: `everyone`, `user_only`, `ai_agent_only`. This list is not exhaustive.","type":"string"}},"required":["created_at","exclude_from_kb_search","id","name","type","updated_at","visibility"],"type":"object"},"TrainingDataDocument":{"properties":{"external_id":{"type":"string"},"file_name":{"type":"string"},"file_size":{"format":"int64","type":"integer"},"file_type":{"type":"string"},"id":{"type":"string"},"s3_key":{"type":"string"}},"required":["file_name","file_size","file_type","id","s3_key"],"type":"object"},"TrainingDataScrapeStatus":{"properties":{"last_scraped_at":{"format":"date-time","type":"string"},"pages_scraped":{"format":"int64","type":"integer"},"status":{"type":"string"},"total_pages":{"format":"int64","type":"integer"}},"required":["pages_scraped","status","total_pages"],"type":"object"},"ErrorApiResponseBody":{"properties":{"code":{"description":"A stable machine-readable identifier for this failure, safe to branch on\ninstead of the message text. Omitted when the failure has no assigned code.\n\nKnown values: `recipients_suppressed`, `email_bounced`, `internal_issue_reply_not_allowed`, `duplicate_object`, `invalid_authorization_header`, `invalid_api_token`, `invalid_oauth_token`, `wrong_region_token`, `organization_deactivated`, `organization_suspended`, `permission_denied`, `oauth_not_permitted`, `rate_limited`, `not_found`, `method_not_allowed`, `payload_too_large`, `invalid_request_body`, `internal_error`, `invalid_webhook_credentials`, `organization_inactive`. This list is not exhaustive.","type":"string"},"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"required":["request_id"],"type":"object"}},"responses":{"UploadTrainingDataFileContentResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrainingDataUploadResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"UnauthorizedApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request could not be authenticated for this API."},"ForbiddenApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The authenticated caller or organization is not allowed to access this endpoint or operation."},"TooManyRequestsApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request exceeded the applicable rate limit.","headers":{"Retry-After":{"description":"Seconds until the next request to this endpoint is permitted.","schema":{"format":"int64","type":"integer"}},"X-Retry-After":{"description":"Seconds until the full per-minute allowance is restored. Capacity returns gradually before then.","schema":{"format":"int64","type":"integer"}}}},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}}},"paths":{"/training-data/upload-content":{"post":{"description":"Uploads plain text content as a training data document.\n\n**Rate limit:** 30 requests per minute","operationId":"UploadTrainingDataFileContent","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadTrainingDataFileContentRequestBody"}}}},"responses":{"200":{"$ref":"#/components/responses/UploadTrainingDataFileContentResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"401":{"$ref":"#/components/responses/UnauthorizedApiResponse"},"403":{"$ref":"#/components/responses/ForbiddenApiResponse"},"429":{"$ref":"#/components/responses/TooManyRequestsApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Upload text content as training data","tags":["training-data"]}}}}
```

## Delete training data documents

> Removes documents from a training data configuration by document ID or external ID.\
> \
> \*\*Rate limit:\*\* 30 requests per minute

```json
{"openapi":"3.0.3","info":{"title":"Pylon API.","version":"1.0.0"},"tags":[],"servers":[{"description":"US region","url":"https://api.usepylon.com"},{"description":"EU region","url":"https://api.eu.usepylon.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"description":"Authorization: Bearer <token>","scheme":"bearer","type":"http"}},"responses":{"DeleteTrainingDataDocumentsResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteTrainingDataDocumentsResponseBody"}}},"description":""},"BadRequestApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request was invalid or could not be completed."},"UnauthorizedApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request could not be authenticated for this API."},"ForbiddenApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The authenticated caller or organization is not allowed to access this endpoint or operation."},"ErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":""},"TooManyRequestsApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"The request exceeded the applicable rate limit.","headers":{"Retry-After":{"description":"Seconds until the next request to this endpoint is permitted.","schema":{"format":"int64","type":"integer"}},"X-Retry-After":{"description":"Seconds until the full per-minute allowance is restored. Capacity returns gradually before then.","schema":{"format":"int64","type":"integer"}}}},"InternalServerErrorApiResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorApiResponseBody"}}},"description":"An unexpected internal error occurred."}},"schemas":{"DeleteTrainingDataDocumentsResponseBody":{"properties":{"deleted_count":{"format":"int64","type":"integer"},"request_id":{"type":"string"}},"required":["deleted_count","request_id"],"type":"object"},"ErrorApiResponseBody":{"properties":{"code":{"description":"A stable machine-readable identifier for this failure, safe to branch on\ninstead of the message text. Omitted when the failure has no assigned code.\n\nKnown values: `recipients_suppressed`, `email_bounced`, `internal_issue_reply_not_allowed`, `duplicate_object`, `invalid_authorization_header`, `invalid_api_token`, `invalid_oauth_token`, `wrong_region_token`, `organization_deactivated`, `organization_suspended`, `permission_denied`, `oauth_not_permitted`, `rate_limited`, `not_found`, `method_not_allowed`, `payload_too_large`, `invalid_request_body`, `internal_error`, `invalid_webhook_credentials`, `organization_inactive`. This list is not exhaustive.","type":"string"},"errors":{"description":"The list of errors.","items":{"type":"string"},"type":"array"},"exists_id":{"description":"The ID of the object that already exists if this is a duplicate object error.","type":"string"},"request_id":{"description":"The request ID for tracking.","type":"string"}},"required":["request_id"],"type":"object"}}},"paths":{"/training-data/{id}/documents":{"delete":{"description":"Removes documents from a training data configuration by document ID or external ID.\n\n**Rate limit:** 30 requests per minute","operationId":"DeleteTrainingDataDocuments","parameters":[{"description":"The ID of the training data.","in":"path","name":"id","required":true,"schema":{"type":"string"}},{"description":"Document IDs to delete.","in":"query","name":"document_ids","schema":{"items":{"type":"string"},"type":"array"}},{"description":"External IDs to delete.","in":"query","name":"external_ids","schema":{"items":{"type":"string"},"type":"array"}}],"responses":{"200":{"$ref":"#/components/responses/DeleteTrainingDataDocumentsResponse"},"400":{"$ref":"#/components/responses/BadRequestApiResponse"},"401":{"$ref":"#/components/responses/UnauthorizedApiResponse"},"403":{"$ref":"#/components/responses/ForbiddenApiResponse"},"404":{"$ref":"#/components/responses/ErrorApiResponse"},"429":{"$ref":"#/components/responses/TooManyRequestsApiResponse"},"500":{"$ref":"#/components/responses/InternalServerErrorApiResponse"}},"summary":"Delete training data documents","tags":["training-data"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.usepylon.com/pylon-docs/developer/api/api-reference/training-data.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
