Metadata-Version: 2.4
Name: klyrek-api
Version: 0.1.0
Summary: API discovery and endpoint inventory for the Klyrek ecosystem
Author: Klyrek Contributors
License: MIT
Keywords: api,appsec,graphql,openapi,pentesting,reconnaissance,security
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security
Requires-Python: >=3.10
Requires-Dist: klyrek-core
Requires-Dist: klyrek-http
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# klyrek-api

API discovery and endpoint inventory. Three independent, composable pieces:

- **`openapi`** — parses an OpenAPI/Swagger JSON spec's `paths` object into `Endpoint` records
  (method, params, base path handled for both Swagger 2.0 `basePath` and OpenAPI 3.x `servers[]`).
- **`discovery`** — probes a small, curated set of well-known paths where a spec or an API root
  commonly lives (`/openapi.json`, `/swagger.json`, `/api/v1`, ...), all scope-checked through
  `klyrek-http`.
- **`graphql`** — probes common GraphQL paths with a minimal `{__typename}` query and confirms
  by the response shape (`{"data": ...}` / `{"data": ..., "errors": ...}`), not just a 200.

`inventory.build_api_inventory()` runs all of the above against a target and returns a
deduplicated `list[Endpoint]`. `classify.is_rest_like()` is a separate, standalone heuristic for
tagging URLs already discovered by `klyrek-crawler` as API-shaped (`/api/`, `/v1/`, numeric ID
segments) without making any additional requests.

```python
from klyrek_api.inventory import build_api_inventory

endpoints = build_api_inventory(client, "https://target.com/")
```
