Add Index
POST /api/v1/developer/add-index
Add a new index with a source URL for indexing SDK, CLI, or API documentation. This endpoint creates a new index and starts the indexing process automatically. Once indexed, you can use the get-context endpoint to retrieve relevant documentation.
Request
API-Key: your-api-key
Content-Type: application/json
Body Parameters
Name or title of the index to create. This should be a descriptive name for the service you’re indexing (e.g., “Stripe API”, “AWS CLI”, “Python Requests Library”).
Source URL to index. This should be the main documentation page or starting point for the service. The system will crawl and index related pages automatically.
Optional notes about the index. Use this to add context about what this index contains or any special considerations.
Example Request
curl -X POST \
"https://www.goharvest.ai/api/v1/developer/add-index" \
-H "API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"index_name": "Stripe API Documentation",
"url": "https://stripe.com/docs/api",
"notes": "Official Stripe API documentation for payment processing"
}'
Response
Success Response (200)
{
"ok" : true ,
"error" : null ,
"data" : {
"index_id" : "scrape_abc123" ,
"index_name" : "Stripe API Documentation" ,
"url" : "https://stripe.com/docs/api" ,
"status" : "PENDING" ,
"message" : "Index created successfully and indexing has started"
}
}
Indicates if the request was successful
Error message if the request failed, null otherwise
Contains the response data Unique identifier for the newly created index. Use this ID with the get-context endpoint to query documentation. The name of the created index (as provided in the request)
The source URL that will be indexed
Current status of the index. Typically PENDING when first created, will change to INDEXED when complete. Possible values: PENDING, IN_PROGRESS, INDEXED, FAILED
A descriptive message about the index creation
Index Status
After creating an index, it goes through several states:
The index has been created and is queued for processing. Indexing will begin shortly.
The system is actively crawling and indexing the documentation from the provided URL.
The indexing process encountered an error. Check that the URL is valid and accessible.
Error Responses
{
"detail" : "Invalid URL provided" ,
"status_code" : 400
}
The URL format is invalid or the URL is not accessible.
403 - Subscription Required
{
"detail" : "Active subscription required to create indexes" ,
"status_code" : 403
}
You need an active subscription to create new indexes. Visit your account settings to manage subscriptions.
409 - URL Already Indexed
{
"detail" : "This URL is already indexed" ,
"status_code" : 409
}
An index already exists for this URL and is ready to use with the get-context endpoint.
409 - Indexing In Progress
{
"detail" : "Indexing is already in progress for this URL" ,
"status_code" : 409
}
This URL is currently being indexed. Wait for the process to complete before attempting to add it again.
{
"detail" : "API key missing" ,
"status_code" : 401
}
The API key is missing from request.
{
"detail" : "Invalid API key" ,
"status_code" : 401
}
The API key provided is invalid.
404 - User account missing
{
"detail" : "User account not found for user_account_id <user_account_id>" ,
"status_code" : 404
}
The user account associated with the API key doesn’t exist.
Best Practices
Choose the Right Starting URL : Select a documentation home page or API reference as your starting URL. The system will automatically discover and index related pages.
Descriptive Names : Use clear, descriptive names for your indexes to make them easy to identify.
Indexing Time : The indexing process can take several minutes to hours depending on the size of the documentation. Once complete, the index will be automatically available for searching with get-context.
Subscription Limits : The number of indexes you can create depends on your subscription plan. Check your account settings for details.
Common Use Cases
Internal Documentation Index your company’s internal API documentation and developer guides
Third-Party APIs Add frequently-used third-party service documentation for quick reference
Open Source Libraries Index open source library documentation for your development stack
CLI Tools Create indexes for command-line tools and their documentation
Workflow Example
Here’s a typical workflow for adding and using a new index:
Add Index : Call add-index with your documentation URL
Wait for Completion : Indexing begins automatically and can take several minutes to hours
Query : Once indexed, your documentation is automatically available via get-context
import requests
api_key = "your-api-key"
base_url = "https://www.goharvest.ai/api/v1/developer"
# Step 1: Add the index
add_response = requests.post(
f " { base_url } /add-index" ,
headers = { "API-Key" : api_key, "Content-Type" : "application/json" },
json = {
"index_name" : "FastAPI Docs" ,
"url" : "https://fastapi.tiangolo.com"
}
)
result = add_response.json()
print ( f "Created index: { result[ 'data' ][ 'index_name' ] } " )
print ( f "Status: { result[ 'data' ][ 'status' ] } " )
print ( f "Message: { result[ 'data' ][ 'message' ] } " )
# Step 2: Query your documentation (once indexing completes)
# The get-context endpoint automatically searches all your available indexes
context_response = requests.post(
f " { base_url } /get-context" ,
headers = { "API-Key" : api_key, "Content-Type" : "application/json" },
json = {
"query" : "FastAPI path parameters tutorial"
}
)
chunks = context_response.json()[ 'data' ][ 'context' ]
print ( f " \n Found { len (chunks) } relevant chunks:" )
for chunk in chunks[: 3 ]: # Show top 3 results
print ( f "Score: { chunk[ 'score' ] :.2f} " )
print ( f "Content: { chunk[ 'content' ][: 200 ] } ... \n " )
Next Steps