> ## Documentation Index
> Fetch the complete documentation index at: https://docs.api.ecylt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ACG Forum Hitokoto

> Call the ACG Forum Hitokoto API service

<Info>
  If you like this API and want to support its continued operation, please [sponsor us](https://afdian.com/a/wxs1546). Thank you very much!
</Info>

## API endpoint

`BaseURL`: `https://hitokoto-api.ecylt.com`

### 1. Get a random hitokoto

```http theme={null}
GET /api/hitokoto
```

Returns a random hitokoto quote.

#### Response example

```json theme={null}
{
  "id": 1,
  "content": "生命不息，奋斗不止",
  "source": "网络",
  "category": "f"
}
```

### 2. Get hitokoto by category

```http theme={null}
GET /api/hitokoto/{category}
```

Returns a random hitokoto from the specified category.

#### Parameters

| Parameter | Type   | Description                                                                                                   |
| --------- | ------ | ------------------------------------------------------------------------------------------------------------- |
| category  | string | Hitokoto category. Options:<br />- e: Original (includes community contributions)<br />- f: From the internet |

#### Response example

```json theme={null}
{
  "id": 2,
  "content": "人生最大的遗憾，就是在最无能为力的时候遇到一个想要保护一生的人",
  "source": "我们仍未知道那天所看见的花的名字",
  "category": "f"
}
```

#### Error responses

When the category is invalid:

```json theme={null}
{
  "error": "Invalid category"
}
```

When no quotes are found for the specified category:

```json theme={null}
{
  "error": "No sentences found for this category"
}
```
