# docs-library

> docs-library is a paid API for AI agents from payai.agentstools.dev, paid per call via x402, $0.01/call, status unknown (last checked 2026-10-11).

Fetches version-pinned, topic-filtered documentation for a package from PyPI, npm, crates.io, or GitHub — returning package identity metadata plus the relevant README or llms.txt section.

## Facts

- Endpoint: GET https://payai.agentstools.dev/docs/library?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-11
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/docs-library-f52f063b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_INIzqEq5Yx70bRVz0JCZF

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability docs-library-f52f063b
```

Example prompt: Can you pull up the authentication section of the requests library docs from PyPI — latest version — so I know how to handle sessions?

## When to prefer this

Choose this endpoint when a coding agent needs up-to-date, version-pinned documentation for a specific library without requiring API keys or authentication. It is ideal when you need both package identity metadata (license, versions, URLs) and a relevant documentation slice in one call. Prefer it over raw web scraping or general search when working with PyPI, npm, crates.io, or GitHub repos and you want structured, citation-backed output optimized for LLM consumption (llms.txt support).

## Known failure modes

- Package not found in the specified ecosystem — returns an error indicating the package name is invalid or unavailable
- Requested version does not exist — returns an error with available version list
- Topic heading not found in README or llms.txt — may return the full README or an empty section
- Ecosystem alias not recognized — returns a validation error
- Rate limiting or upstream registry unavailability — returns a service error

## How this service works

Up-to-date, version-pinned documentation for a library or API, for coding agents. Give an ecosystem and a package name (optional version and topic) and get a compact doc slice: package identity (latest and requested version, license, repo, homepage and doc URLs, version list) plus the README or llms.txt section matching the topic, each with a provenance citation. Keyless PyPI, npm, crates and GitHub sources.

## Output

Returns a JSON object containing: package identity fields (requested and latest version, license, repo URL, homepage URL, docs URL, full version list) and a relevant documentation slice (README or llms.txt section matching the requested topic), each entry accompanied by a provenance citation indicating the source.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "name",
      "ecosystem"
     ],
     "properties": {
      "name": {
       "type": "string",
       "description": "Package name; for github pass owner/repo such as coinbase/x402. npm scoped names @scope/name are allowed."
      },
      "topic": {
       "type": "string",
       "description": "Optional topic or symbol; matched against the README/llms.txt markdown headings, such as authentication or useEffect."
      },
      "version": {
       "type": "string",
       "description": "Optional exact version to pin, such as 2.31.0; default is latest."
      },
      "ecosystem": {
       "enum": [
        "npm",
        "pypi",
        "crates",
        "github"
       ],
       "type": "string",
       "description": "Package ecosystem. Aliases accepted: pip and python map to pypi; cargo and rust map to crates; node maps to npm; gh maps to github."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/docs-library-f52f063b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from payai.agentstools.dev](https://www.zero.xyz/host/payai.agentstools.dev/llms.txt)
