{
    "openapi": "3.1.0",
    "info": {
        "title": "INTEL public API",
        "version": "1.0.0",
        "description": "Read-only JSON for the public entries in the INTEL library: researched, cited reports, guides and notes. No key. Published, public entries only. Bodies are Markdown; [n] markers cite the numbered sources. Please keep to about one request a second and credit intel.innerpulse.net."
    },
    "servers": [
        {
            "url": "https://intel.innerpulse.net/api/v1"
        }
    ],
    "externalDocs": {
        "url": "https://intel.innerpulse.net/developers"
    },
    "paths": {
        "/meta": {
            "get": {
                "operationId": "getMeta",
                "summary": "What the library holds: counts, newest entry, formats and kinds",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Envelope"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad parameter",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/documents": {
            "get": {
                "operationId": "listDocuments",
                "summary": "Entries, newest first, filtered by topic, section, subject, kind, format or month",
                "parameters": [
                    {
                        "name": "topic",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "description": "Topic slug (from /topics)"
                        },
                        "description": "Topic slug (from /topics)"
                    },
                    {
                        "name": "section",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "description": "Section slug (from /topics)"
                        },
                        "description": "Section slug (from /topics)"
                    },
                    {
                        "name": "tag",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "description": "Subject slug (from /tags)"
                        },
                        "description": "Subject slug (from /tags)"
                    },
                    {
                        "name": "kind",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "description": "Kind of entry",
                            "enum": [
                                "research",
                                "article",
                                "guide",
                                "note",
                                "reference"
                            ]
                        },
                        "description": "Kind of entry"
                    },
                    {
                        "name": "format",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "description": "Research format",
                            "enum": [
                                "research",
                                "guide",
                                "reference",
                                "comparison",
                                "memo",
                                "faq",
                                "repo",
                                "deepdive",
                                "roundup"
                            ]
                        },
                        "description": "Research format"
                    },
                    {
                        "name": "month",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "description": "Month published, YYYY-MM",
                            "pattern": "^\\d{4}-\\d{2}$"
                        },
                        "description": "Month published, YYYY-MM"
                    },
                    {
                        "name": "order",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "description": "Sort order",
                            "enum": [
                                "newest",
                                "oldest",
                                "updated",
                                "title"
                            ],
                            "default": "newest"
                        },
                        "description": "Sort order"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "description": "Entries per page",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 25
                        },
                        "description": "Entries per page"
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "description": "Entries to skip (next_offset from the last page)",
                            "minimum": 0,
                            "maximum": 100000,
                            "default": 0
                        },
                        "description": "Entries to skip (next_offset from the last page)"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Envelope"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad parameter",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/documents/{slug}": {
            "get": {
                "operationId": "getDocument",
                "summary": "One entry: Markdown body, numbered sources, topic, subjects and dates",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "description": "Entry slug, the last part of its /doc/ address",
                            "pattern": "^[a-z0-9-]+$"
                        },
                        "description": "Entry slug"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Envelope"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad parameter",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/search": {
            "get": {
                "operationId": "search",
                "summary": "Full-text search, best match first, with a snippet",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "description": "Words to look for"
                        },
                        "description": "Words to look for"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "description": "How many results",
                            "minimum": 1,
                            "maximum": 50,
                            "default": 10
                        },
                        "description": "How many results"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Envelope"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad parameter",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/topics": {
            "get": {
                "operationId": "listTopics",
                "summary": "Sections and the topics filed under them, with entry counts",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Envelope"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad parameter",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/tags": {
            "get": {
                "operationId": "listTags",
                "summary": "Subjects (tags) with entry counts",
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Envelope"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad parameter",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "Envelope": {
                "type": "object",
                "required": [
                    "api",
                    "endpoint",
                    "generated_at",
                    "scope",
                    "data",
                    "source"
                ],
                "properties": {
                    "api": {
                        "type": "string",
                        "const": "v1"
                    },
                    "endpoint": {
                        "type": "string"
                    },
                    "generated_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "scope": {
                        "type": "string",
                        "description": "What the data covers, in words"
                    },
                    "total": {
                        "type": "integer",
                        "description": "listDocuments: entries matching the filters"
                    },
                    "next_offset": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "listDocuments: offset of the next page, null on the last"
                    },
                    "data": {
                        "description": "The payload: an object or a list"
                    },
                    "source": {
                        "type": "string",
                        "description": "Credit line"
                    },
                    "docs": {
                        "type": "string"
                    }
                }
            },
            "Error": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "object",
                        "properties": {
                            "status": {
                                "type": "integer"
                            },
                            "message": {
                                "type": "string"
                            }
                        }
                    },
                    "docs": {
                        "type": "string"
                    }
                }
            }
        }
    }
}