# Fanfiction — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Search and browse fan fiction stories across FanFiction.net, accessing story metadata, full chapter content, and author profiles all in one place. Discover new stories and dive deeper into author information without navigating the website directly.

**Category:** Entertainment | **Website:** [fanfiction.net/](https://fanfiction.net/) | **Docs:** [parse.bot/marketplace/6c7d580d-a320-48c5-ab14-0db875cb1d9a/fanfiction-net-api](https://parse.bot/marketplace/6c7d580d-a320-48c5-ab14-0db875cb1d9a/fanfiction-net-api)

Pay-per-use API proxy for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/credits/fanfiction/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## Endpoints

### Get author

Retrieve an author's profile including display name, join date, bio, and a list of all their published stories. The author_id comes from search results or story metadata.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `author_id` | string | Yes | Numeric author ID (e.g. from search_stories or get_story results). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/credits/fanfiction/get-author \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"author_id":"<string>"}'
```

### Get chapter

Retrieve the full text content of a specific chapter of a story. Returns the chapter text along with chapter title and total chapter count for the story.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `chapter` | integer | No | Chapter number to retrieve. |
| `story_id` | string | Yes | Numeric story ID (e.g. from search_stories or get_story results). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/credits/fanfiction/get-chapter \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"chapter":"<integer>","story_id":"<string>"}'
```

### Get story

Retrieve full metadata for a single story including title, author info, description, cover image, detailed stats, and chapter listing. The story_id comes from search results or author profiles.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `story_id` | string | Yes | Numeric story ID (e.g. from search_stories results). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/credits/fanfiction/get-story \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"story_id":"<string>"}'
```

### Search stories

Full-text search over fan fiction stories by keyword. Returns paginated results with metadata including title, author, description, and stats (rating, word count, reviews, etc.). Results are ordered by relevance by default. Each page contains up to 50 results.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `keywords` | string | Yes | Search query to match against story titles and descriptions. |
| `page` | integer | No | Page number for paginated results. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/credits/fanfiction/search-stories \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"keywords":"<string>","page":"<integer>"}'
```

## Next steps

- [All wrapped API providers](https://paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://paywithlocus.com/agent/index.md): every Locus agent page.