DocsAF Projects#

DocsAF project management

Check DocsAF OAuth token status#

GET/docsaf/repos/status

Checks if the current user has completed DocsAF OAuth flow. Optionally checks if a specific repo URL already has a project.

Authentication required: bearerAuth

Parameters#

NameTypeLocationRequiredDescription
repo_urlstringqueryNoOptional repository URL to check for existing project

Code Examples#

curl -X GET "https://searchaf.antfly.io/api/v1/docsaf/repos/status?repo_url=https://github.com/antflydb/colony" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "has_token": true,
  "existing_project": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "organization_id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "My Store",
    "slug": "my-store",
    "description": "E-commerce store for outdoor gear",
    "project_type": "woocommerce",
    "antfly_cluster_id": "string",
    "integration_config": {},
    "tables": [
      {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "project_id": "550e8400-e29b-41d4-a716-446655440000",
        "slug": "products",
        "is_default": true,
        "created_at": "2025-10-02T15:30:00Z",
        "updated_at": "2025-10-02T15:30:00Z"
      }
    ],
    "status": "active",
    "created_at": "2025-10-02T15:30:00Z",
    "updated_at": "2025-10-02T15:30:00Z",
    "settings": {}
  }
}

List accessible GitHub repositories#

GET/docsaf/repos

Returns list of repositories the user can access via their DocsAF OAuth token. Repositories are sorted by last updated (most recent first). Pagination is handled automatically by the backend.

Authentication required: bearerAuth

Code Examples#

curl -X GET "https://searchaf.antfly.io/api/v1/docsaf/repos" \\
    -H "Authorization: Bearer YOUR_API_KEY"

Responses#

{
  "repositories": [
    {
      "full_name": "antflydb/colony",
      "default_branch": "main",
      "private": false
    }
  ]
}

Validate website URL for crawling#

POST/docsaf/validate-website

Validates a website URL before creating a DocsAF project. Checks accessibility, robots.txt, sitemap, SSL, and provides warnings/estimates. Use this endpoint to provide user feedback before project creation.

Authentication required: bearerAuth

Request Body#

Example:

{
    "url": "https://docs.antfly.io"
}

Code Examples#

curl -X POST "https://searchaf.antfly.io/api/v1/docsaf/validate-website" \\
    -H "Authorization: Bearer YOUR_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
    "url": "https://docs.antfly.io"
}'

Responses#

{
  "valid": true,
  "url": "string",
  "warnings": [
    "string"
  ],
  "errors": [
    "string"
  ],
  "site_title": "string",
  "robots_allowed": true,
  "has_sitemap": true,
  "sitemap_urls": [
    "string"
  ],
  "estimated_size": 0,
  "response_time_ms": 0,
  "has_ssl": true,
  "ssl_valid": true
}

Create DocsAF project#

POST/docsaf/projects

Creates a new DocsAF project from a GitHub repository or website URL. Uses the OAuth token stored in user_docsaf_tokens from the OAuth flow.

For GitHub repos:

  • Verifies repo access
  • Creates project and docsaf_source
  • Registers GitHub webhook
  • Moves token to docsaf_access_tokens
  • Enqueues initial sync job

Authentication required: bearerAuth

Request Body#

Example:

{
    "organization_id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Colony Documentation",
    "repo_url": "https://github.com/antflydb/colony",
    "default_branch": "main",
    "docs_path": "docs",
    "website_url": "https://docs.antfly.io",
    "crawl_config": {
        "max_depth": 3,
        "max_pages": 1000,
        "requests_per_second": 1,
        "url_must_contain": [
            "/docs/",
            "/api/"
        ],
        "url_must_not_contain": [
            "/blog/",
            "/changelog/"
        ],
        "respect_robots_txt": true,
        "user_agent": "MyBot/1.0"
    }
}

Code Examples#

curl -X POST "https://searchaf.antfly.io/api/v1/docsaf/projects" \\
    -H "Authorization: Bearer YOUR_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
    "organization_id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Colony Documentation",
    "repo_url": "https://github.com/antflydb/colony",
    "default_branch": "main",
    "docs_path": "docs",
    "website_url": "https://docs.antfly.io",
    "crawl_config": {
        "max_depth": 3,
        "max_pages": 1000,
        "requests_per_second": 1,
        "url_must_contain": [
            "/docs/",
            "/api/"
        ],
        "url_must_not_contain": [
            "/blog/",
            "/changelog/"
        ],
        "respect_robots_txt": true,
        "user_agent": "MyBot/1.0"
    }
}'

Responses#

{
  "project": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "organization_id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "My Store",
    "slug": "my-store",
    "description": "E-commerce store for outdoor gear",
    "project_type": "woocommerce",
    "antfly_cluster_id": "string",
    "integration_config": {},
    "tables": [
      {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "project_id": "550e8400-e29b-41d4-a716-446655440000",
        "slug": "products",
        "is_default": true,
        "created_at": "2025-10-02T15:30:00Z",
        "updated_at": "2025-10-02T15:30:00Z"
      }
    ],
    "status": "active",
    "created_at": "2025-10-02T15:30:00Z",
    "updated_at": "2025-10-02T15:30:00Z",
    "settings": {}
  },
  "sync_job_id": "123e4567-e89b-12d3-a456-426614174000"
}

Update DocsAF project settings#

PATCH/docsaf/projects/{project_id}/settings

Updates the DocsAF project settings including default branch and documentation path. Note: Changes will take effect on the next sync. You must manually trigger a sync to apply the changes.

Authentication required: bearerAuth

Parameters#

NameTypeLocationRequiredDescription
project_idstringpathYesProject ID

Request Body#

Example:

{
    "default_branch": "main",
    "docs_path": "docs",
    "website_url": "https://docs.example.com",
    "include_patterns": [
        "**/*.md",
        "**/*.mdx"
    ],
    "exclude_patterns": [
        "**/draft/**",
        "**/internal/**"
    ]
}

Code Examples#

curl -X PATCH "https://searchaf.antfly.io/api/v1/docsaf/projects/{project_id}/settings" \\
    -H "Authorization: Bearer YOUR_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
    "default_branch": "main",
    "docs_path": "docs",
    "website_url": "https://docs.example.com",
    "include_patterns": [
        "**/*.md",
        "**/*.mdx"
    ],
    "exclude_patterns": [
        "**/draft/**",
        "**/internal/**"
    ]
}'

Responses#

{
  "default_branch": "main",
  "docs_path": "docs",
  "website_url": "https://docs.example.com",
  "include_patterns": [
    "string"
  ],
  "exclude_patterns": [
    "string"
  ]
}