Skip to main content

Getting Started

Follow these simple steps to start using the Search API:

1. Get Your API Key

First, you’ll need to obtain an API key from the platform:
  1. Log into your account
  2. Navigate to the API Keys section in the dashboard
  3. Click “Generate New API Key”
  4. Copy and securely store your API key
Your API key will be used to authenticate all requests to the Search API.

2. Ingest Your Data

Before you can search, you need to ingest some data. The API supports two types of ingestion: file uploads and web scraping. Use the /sources/ingest endpoint with multipart form data:

File Upload Example:

curl -X POST "https://api.clarm.com/v1/sources/ingest" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "[email protected]" \
  -F "[email protected]" \
  -F 'sources_json={
    "sources": [
      {
        "type": "file",
        "name": "My Documents"
      }
    ]
  }'

Web Scraping Example:

curl -X POST "https://api.clarm.com/v1/sources/ingest" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F 'sources_json={
    "sources": [
      {
        "type": "web",
        "name": "Company Documentation",
        "web_config": {
          "url": "https://docs.company.com",
          "web_connector_type": "recursive",
          "mintlify_cleanup": true
        }
      }
    ]
  }'
Response:
{
  "success": true,
  "message": "Successfully ingested and indexed 1 sources. Created collection with ID 123",
  "results": [
    {
      "source_name": "My Documents",
      "source_type": "file",
      "connector_id": 456,
      "documents_indexed": 2,
      "chunks_indexed": 15,
      "success": true,
      "error_message": null
    }
  ],
  "total_documents_indexed": 2,
  "total_chunks_indexed": 15,
  "collection_id": 123,
  "knowledge_source_ids": [456]
}

3. Search Your Data

Once you’ve ingested documents, you can search through them using the /search endpoint:
curl -X POST "https://api.clarm.com/v1/search" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "search API guide"
  }'
Response:
{
  "query": "search API guide",
  "answer": "This is a comprehensive guide to using our search API effectively. The search API allows you to perform semantic search across your document collections with various filtering and ranking options.",
  "citations": [
    {
      "document_id": "doc1",
      "chunk_ind": 0,
      "semantic_identifier": "Getting Started with Search",
      "link": "https://docs.example.com/getting-started",
      "blurb": "This is a comprehensive guide to using our search API effectively.",
      "source_type": "web",
      "boost": 0,
      "hidden": false,
      "metadata": {
        "category": "documentation",
        "tags": ["api", "search", "guide"]
      },
      "score": 0.95,
      "is_relevant": null,
      "relevance_explanation": null,
      "match_highlights": [
        "This is a comprehensive guide to using our <hi>search API</hi> effectively."
      ],
      "updated_at": "2024-01-15T10:30:00Z",
      "primary_owners": null,
      "secondary_owners": null,
      "is_internet": false
    }
  ]
}

Next Steps

Now that you’ve successfully ingested and searched data:

Need Help?

If you encounter any issues or have questions, please: