API Reference

Complete reference for the TaylorType REST API. All endpoints require authentication via API key.

Base URL

All API requests should be made to:

https://api.taylortype.com/v1

Authentication

TaylorType uses API keys for authentication. Include your API key in the Authorization header of all requests:

Authorization: Bearer YOUR_API_KEY

You can create and manage API keys in your dashboard. Keep your API keys secure and never expose them in client-side code.

Search API

The Search API allows you to query your indices and retrieve relevant results.

POST /indices/{index_id}/search

Execute a search query against an index.

Path Parameters

Parameter Description
index_id string required The unique identifier of the index to search

Request Body

Parameter Description
query string required The search query string. Supports natural language queries.
limit integer Maximum number of results to return. Default: 10, Max: 100.
offset integer Number of results to skip for pagination. Default: 0.
semantic boolean Enable semantic search for natural language understanding. Default: true.
filters object Filter results by field values. See filtering documentation.
facets array Fields to compute facet counts for. Returns aggregations.
sort array Sort order for results. Default: relevance score descending.

Example Request

curl -X POST https://api.taylortype.com/v1/indices/products/search \
  -H "Authorization: Bearer tt_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "query": "wireless noise canceling headphones",
    "limit": 5,
    "semantic": true,
    "filters": {
      "category": "Electronics",
      "price": { "lte": 300 }
    },
    "facets": ["brand", "category"]
  }'

Example Response

{
  "hits": [
    {
      "id": "prod_001",
      "score": 0.97,
      "document": {
        "title": "Sony WH-1000XM5 Wireless Headphones",
        "description": "Industry-leading noise canceling...",
        "price": 299.99,
        "category": "Electronics",
        "brand": "Sony"
      },
      "_highlights": {
        "title": "Sony WH-1000XM5 <em>Wireless</em> <em>Headphones</em>"
      }
    }
  ],
  "total": 42,
  "facets": {
    "brand": [
      { "value": "Sony", "count": 12 },
      { "value": "Bose", "count": 8 }
    ]
  },
  "processingTime": 32
}

Index API

The Index API allows you to manage indices and documents.

POST /indices

Create a new search index.

Request Body

Parameter Description
name string required Unique name for the index. Alphanumeric and underscores only.
settings object Index configuration including language, semantic settings, etc.

Example Request

curl -X POST https://api.taylortype.com/v1/indices \
  -H "Authorization: Bearer tt_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "products",
    "settings": {
      "semantic": true,
      "language": "en",
      "typoTolerance": true
    }
  }'
POST /indices/{index_id}/documents

Add or update documents in an index. Documents with existing IDs will be updated.

Request Body

Parameter Description
documents array required Array of document objects. Each must have a unique id field.

Example Request

curl -X POST https://api.taylortype.com/v1/indices/products/documents \
  -H "Authorization: Bearer tt_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "documents": [
      {
        "id": "prod_001",
        "title": "Wireless Headphones",
        "description": "Premium noise-canceling headphones",
        "price": 299.99,
        "category": "Electronics",
        "tags": ["audio", "wireless", "noise-canceling"]
      },
      {
        "id": "prod_002",
        "title": "Bluetooth Speaker",
        "description": "Portable waterproof speaker",
        "price": 79.99,
        "category": "Electronics",
        "tags": ["audio", "portable", "waterproof"]
      }
    ]
  }'
DELETE /indices/{index_id}/documents/{document_id}

Delete a document from an index.

Path Parameters

Parameter Description
index_id string required The index containing the document
document_id string required The ID of the document to delete

Error Handling

TaylorType uses standard HTTP status codes. Errors return a JSON object with details:

{
  "error": {
    "code": "invalid_query",
    "message": "The query parameter is required",
    "details": {}
  }
}
Status Code Description
200 Success
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid or missing API key
403 Forbidden - Insufficient permissions
404 Not Found - Resource doesn't exist
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error

Rate Limits

API rate limits depend on your plan:

Plan Requests/second Searches/month
Free 10 10,000
Pro 100 100,000
Business 500 1,000,000
Enterprise Custom Unlimited