Skip to main content

List Datasources

List all datasources in the current project.

Response

datasources
array
Array of datasource objects
curl --location --request GET 'https://api.plaisolutions.com/datasources' \
--header 'Authorization: Bearer YOUR_TOKEN'

Create Datasource

Create a new datasource to store and organize your knowledge base.

Request Body

name
string
required
Datasource name (1-50 characters)
type
string
required
Datasource type:
  • STRUCTURED - For structured data like databases, APIs, or CSV files
  • UNSTRUCTURED - For documents, text files, web pages, and other unstructured content
description
string
required
Detailed description of the datasource
summary
string
required
Brief summary of what this datasource contains
metadata_schema
object
Schema definition for metadata fields that resources in this datasource can have

Response

Returns the created datasource object.
curl --location --request POST 'https://api.plaisolutions.com/datasources' \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
  "name": "Product Documentation",
  "type": "UNSTRUCTURED",
  "description": "Complete product documentation including user guides, API docs, and tutorials",
  "summary": "Comprehensive documentation for all product features and APIs",
  "metadata_schema": {
    "entries": [
      {
        "name": "category",
        "type": "str",
        "optional": false
      },
      {
        "name": "version",
        "type": "str",
        "optional": true
      },
      {
        "name": "priority",
        "type": "int",
        "optional": true
      }
    ]
  }
}'

Get Datasource

Get detailed information about a specific datasource.

Path Parameters

id
string
required
The unique identifier of the datasource

Response

Returns the datasource object with all details.
curl --location --request GET 'https://api.plaisolutions.com/datasources/ds_123' \
--header 'Authorization: Bearer YOUR_TOKEN'

Update Datasource

Update an existing datasource’s properties.

Path Parameters

id
string
required
The unique identifier of the datasource

Request Body

All fields are optional and only provided fields will be updated.
name
string
Updated datasource name
description
string
Updated description
summary
string
Updated summary
metadata_schema
object
Updated metadata schema (this will replace the existing schema)

Response

Returns the updated datasource object.
Updating the metadata schema may affect existing resources in the datasource. Ensure compatibility before making changes.
curl --location --request PATCH 'https://api.plaisolutions.com/datasources/ds_123' \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
  "name": "Updated Product Documentation",
  "description": "Enhanced product documentation with new tutorials and examples"
}'

Delete Datasource

Delete a datasource and all its associated resources.

Path Parameters

id
string
required
The unique identifier of the datasource to delete

Response

Returns a 200 status code on successful deletion.
Deleting a datasource will permanently remove:
  • All resources and documents in the datasource
  • All folders and folder structures
  • All vector embeddings and search indexes
  • Any agent associations with this datasource
This action cannot be undone.
curl --location --request DELETE 'https://api.plaisolutions.com/datasources/ds_123' \
--header 'Authorization: Bearer YOUR_TOKEN'

Datasource Types

Understanding the difference between datasource types helps you choose the right approach for your use case:
Best for: Documents, web pages, text files, PDFs, imagesFeatures:
  • Automatic text extraction and processing
  • Vector embeddings for semantic search
  • Support for various file formats
  • Flexible metadata schema
Use Cases:
  • Documentation websites
  • Knowledge bases
  • Support articles
  • Research papers
  • Company policies
Example Content:
  • PDF documents
  • Web pages
  • Markdown files
  • Text documents
  • Images with text

Metadata Schema Design

The metadata schema defines additional fields that can be attached to resources in your datasource:

Field Types

  • Use for: Categories, tags, names, descriptions
  • Example: category: "user-guide", author: "John Doe"
  • Searchable: Yes, supports exact and partial matching
  • Use for: Priorities, counts, ratings, years
  • Example: priority: 1, rating: 5, year: 2024
  • Searchable: Yes, supports range queries
  • Use for: Scores, percentages, measurements
  • Example: confidence: 0.95, price: 29.99
  • Searchable: Yes, supports range queries
  • Use for: Flags, status indicators
  • Example: published: true, featured: false
  • Searchable: Yes, supports exact matching

Best Practices

1

Plan Your Schema

Define metadata fields that will help with filtering and organization
2

Keep It Simple

Start with essential fields and add more as needed
3

Use Consistent Naming

Use lowercase with underscores (e.g., content_type, last_updated)
4

Consider Searchability

Think about how agents and users will filter and search your content
Metadata schemas can be updated after creation, but changes may affect existing resources and search functionality.
Use the metadata schema to create powerful filtering capabilities for your agents. For example, an agent could be configured to only use resources with category: "public" and priority >= 3.