Public API

# Fetching pages

Gendocs has a public API to add documentation to your own site.

# Homepage

https://gendocs.io/api/v1/docs/TOKEN/pages

# Page by slug

https://gendocs.io/api/v1/docs/TOKEN/pages/SLUG

# Example response

json
{
    "page": {
        "category": "Introduction",
        "code_languages": "[\"elixir\"]",
        "html": "The HTML of your page ...",
        "order": 0,
        "slug": "introduction-getting-started",
        "title": "Getting started"
    },
    "pages_meta": [
        {
            "category": "Introduction",
            "order": 0,
            "slug": "introduction-getting-started",
            "title": "Getting started"
        },
        {
            "category": "Introduction",
            "order": 1,
            "slug": "introduction-keep-going",
            "title": "Keep going"
        }
    ]
}

# Searching

We also expose our search functionality to be used on your own site.

# Endpoint

https://gendocs.io/api/v1/docs/TOKEN/pages/search/QUERY

# Example response

json
{
    "data": {
        "hits": [
            {
                "category": "Introduction",
                "page_titles": "How to get started",
                "slug": "introduction-getting-started",
                "title": "Getting started"
            }
        ],
        "limit": 20,
        "offset": 0,
        "processingTimeMs": 2,
        "query": "get started"
    }
}