---
title: "API 文档 | PSRay"
description: "PSRay 公开 API 的使用说明：读取奖杯组、玩家资料、游戏和系列数据的接口、参数、响应字段和示例，并可在页面上直接试用。"
image: "https://psray.net/images/psray-share.jpg"
url: "https://psray.net/docs/api?lang=zh-Hans"
lang: "zh-Hans"
---

Developers

# PSRay API

用简单的 HTTP 请求读取 PSRay 的奖杯组、玩家资料、游戏和系列数据。本页列出最常用的公开只读接口，每个接口都可以直接在页面上试用。

只读 无需 API Key JSON 支持跨域

Base URL `https://api.psray.net`

- 路径直接接在 Base URL 后面，没有 `/api` 前缀。

- 本页的接口都是 GET 请求，不需要登录，也不需要 API Key。

- 响应是 UTF-8 编码的 JSON。

- 允许任意来源跨域请求，可以直接在浏览器里调用。

快速开始

```bash
curl 'https://api.psray.net/trophies/5059'
```

Responses

## 响应格式

请求成功时，结果在 `data` 里。列表接口另有 `meta`，包含页码、每页条数、总数和总页数；页码超过末页时返回空数组，不会报错。

请求失败时，返回相应的 HTTP 状态码和 `error` 对象。`error.code` 是固定的错误码，程序里请按它判断；`error.message` 是英文说明；参数校验失败时，`error.details` 会逐项列出原因。

每个响应都带 `X-Request-Id` 响应头，错误响应里还有同样的 `request_id`。反馈问题时请附上它，方便我们查找日志。

时间字段是 UTC 的 ISO 8601 字符串，例如 `2026-08-10T15:23:07.000000Z`。

200

```json
{
  "data": [ … ],
  "meta": {
    "page": 1,
    "per_page": 24,
    "total": 35,
    "total_pages": 2
  }
}
```

Languages

## 展示语言

奖杯组标题、奖杯名称、游戏和系列名称都有多种语言。接口按以下顺序决定使用哪种语言：

1. 查询参数 `lang`，例如 `?lang=zh-Hans`
2. 请求头 `Accept-Language`，按权重从高到低匹配
3. 都没有或都匹配不上时，使用该条目的默认语言

中文会按地区归入 PSN 的语言变体：`zh-TW` 视为 `zh-Hant`，`zh-CN` 视为 `zh-Hans`。

响应中的 `display_language` 是实际使用的语言。`name` 始终是原名，界面上请显示 `localized_name`。

```bash
curl 'https://api.psray.net/trophies/5059?lang=ja'
```

## 浏览奖杯组

GET `/trophies` 公开 分页

分页列出奖杯组，可以按标题搜索，按平台或有无白金筛选，并按最新入库、近期热门或参与人数排序。

### 请求参数

参数 位置 说明

- `q` string

  查询

  搜索关键词，匹配原名、各语言官方译名和 NPWR 编号；纯数字或 #数字 按 ID 精确匹配。搜索时按相关度排序，忽略 sort

- `sort` string

  查询

  排序：newest 按入库时间，trending 按近 7 天玩家数，popular 按累计玩家数

  默认 `newest` `newest` `trending` `popular`

- `platform[]` string\[]

  查询

  按平台筛选，可多选

  `PS5` `PS4` `PS3` `PSVITA` `PSPC`

- `has_platinum` boolean

  查询

  true 只返回有白金的奖杯组，false 只返回没有白金的

  `true` `false`

- `page` integer

  查询

  页码，从 1 开始

  默认 `1`

- `per_page` integer

  查询

  每页条数，1 到 100

  默认 `24`

- `lang` string

  查询

  展示语言，例如 zh-Hans、ja、en，见「展示语言」

### 常用字段

只列出常用字段，完整结构见响应示例。

- `id` integer

  奖杯组 ID

- `np_communication_id` string

  PSN 的奖杯组编号，例如 NPWR11556_00

- `name / localized_name` string

  原名，以及按展示语言选出的名称（界面上显示后者）

- `platform` string\[]

  平台，例如 PS5、PS4

- `icon_url` string

  奖杯组图标地址

- `defined_trophies` object

  各等级的奖杯数：bronze、silver、gold、platinum

- `owners` integer

  参与的公开玩家数

- `platinum_rate / completion_rate` number | null

  白金率和完成率（百分比），可能为 null

- `median_completion_time` integer | null

  完成耗时的中位数（秒）

### 错误

422 VALIDATION_FAILED 全部错误码

```bash
curl --get 'https://api.psray.net/trophies' \
  --data-urlencode 'q=horizon' \
  --data-urlencode 'per_page=1'
```

200

```json
{
  "data": [
    {
      "id": 29439,
      "np_communication_id": "NPWR24321_00",
      "name": "Horizon Zero Dawn™ Remastered",
      "default_language": "en-US",
      "platform": [
        "PS5"
      ],
      "icon_url": "https://psnobj.prod.dl.playstation.net/psnobj/NPWR24321_00/96674236-573c-422c-9754-0357cfde931d.png",
      "defined_trophies": {
        "bronze": 65,
        "silver": 11,
        "gold": 2,
        "platinum": 1
      },
      "owners": 4134,
      "completed_players": 669,
      "platinum_achievers": 1534,
      "recent_players": 26,
      "average_progress": 42,
      "average_completion_time": 4165628,
      "median_completion_time": 1461384,
      "p10_completion_time": 444815,
      "fastest_completion_time": 8290,
      "median_platinum_time": 1513724,
      "difficult_trophy_count": 11,
      "translation_count": 19,
      "created_at": "2024-10-15T16:57:06.000000Z",
      "updated_at": "2026-11-20T00:15:10.000000Z",
      "localized_name": "Horizon Zero Dawn™ Remastered",
      "display_language": "en-US",
      "available_languages": [
        {
          "language_code": "en-US",
          "is_default": true,
          "source": "official",
          "name": "Horizon Zero Dawn™ Remastered"
        },
        {
          "language_code": "ja-JP",
          "is_default": false,
          "source": "official",
          "name": "Horizon Zero Dawn™ Remastered"
        }
      ],
      "platinum_rate": 37.1,
      "completion_rate": 16.2
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 1,
    "total": 35,
    "total_pages": 35
  }
}
```

## 奖杯组详情

GET `/trophies/{id}` 公开

返回单个奖杯组的完整信息：分组与全部奖杯、可用语言、最近的玩家、所属游戏和系列。传入 psnid 时，还会附带这名玩家的公开进度。

### 请求参数

参数 位置 说明

- `id` integer

  路径

  必填 奖杯组 ID（站内的数字 ID，不是 NPWR 编号）

- `psnid` string

  查询

  附带这名玩家在该奖杯组的进度（仅限资料公开的玩家）

- `lang` string

  查询

  展示语言，例如 zh-Hans、ja、en，见「展示语言」

### 常用字段

只列出常用字段，完整结构见响应示例。

- `trophy_set` object

  奖杯组本身，字段与列表项基本相同

- `display_language` string

  本次使用的展示语言

- `available_languages` array

  可用语言及对应标题，包括非官方翻译

- `groups` array

  奖杯分组：本体和各个追加内容

- `groups[].trophies` array

  分组中的奖杯：等级、名称、说明、图标、获得率、稀有度

- `recent_players` array

  最近获得奖杯的公开玩家，最多 10 人

- `game` object | null

  所属游戏，结构同游戏列表项；没有关联时为 null

- `series` array

  所属系列

- `viewer_progress` object | null

  psnid 对应玩家的进度；找不到或资料未公开时为 null

### 错误

404 TROPHY_SET_NOT_FOUND 全部错误码

```bash
curl 'https://api.psray.net/trophies/5059'
```

200

```json
{
  "data": {
    "trophy_set": {
      "id": 5059,
      "np_communication_id": "NPWR11556_00",
      "version": "01.02",
      "platform": [
        "PS4"
      ],
      "name": "Horizon Zero Dawn",
      "detail": "Horizon Zero Dawn trophies",
      "icon_url": "https://image.api.playstation.com/trophy/np/NPWR11556_00_005122C6D8E4545DAC325B8E748CBE7180ED11F3E7/F24674E946809EB0A2E214DB490149851BCEC0EC.PNG",
      "has_trophy_groups": true,
      "np_service_name": "trophy",
      "defined_trophies": {
        "bronze": 65,
        "silver": 11,
        "gold": 2,
        "platinum": 1
      },
      "default_language": "en-US",
      "owners": 30142,
      "recent_players": 7,
      "average_progress": 64,
      "completed_players": 5911,
      "platinum_achievers": 18847,
      "game_id": 6679,
      "region": null,
      "created_at": "2022-12-31T16:00:00.000000Z",
      "updated_at": "2026-11-20T00:10:52.000000Z",
      "average_completion_time": 42067747,
      "median_completion_time": 17864400,
      "p10_completion_time": 1094939,
      "fastest_completion_time": 223327,
      "median_platinum_time": 7741552,
      "difficult_trophy_count": 8,
      "translation_count": 19
    },
    "display_language": "en-US",
    "available_languages": [
      {
        "language_code": "ar-AE",
        "is_default": false,
        "source": "official",
        "name": "‏Horizon فجرٌ جديد"
      },
      {
        "language_code": "da-DK",
        "is_default": false,
        "source": "official",
        "name": "Horizon Zero Dawn"
      }
    ],
    "groups": [
      {
        "id": 6687,
        "psn_group_id": "default",
        "name": "Horizon Zero Dawn",
        "detail": "Horizon Zero Dawn trophies",
        "localized_name": "Horizon Zero Dawn",
        "localized_detail": "Horizon Zero Dawn trophies",
        "icon_url": "https://image.api.playstation.com/trophy/np/NPWR11556_00_005122C6D8E4545DAC325B8E748CBE7180ED11F3E7/F24674E946809EB0A2E214DB490149851BCEC0EC.PNG",
        "defined_trophies": {
          "bronze": 48,
          "silver": 5,
          "gold": 2,
          "platinum": 1
        },
        "trophies": [
          {
            "id": 163185,
            "trophy_group_id": 6687,
            "type": "platinum",
            "np_communication_id": "NPWR11556_00",
            "psn_group_id": "default",
            "psn_trophy_id": 0,
            "name": "All trophies obtained",
            "detail": "Obtained all Horizon Zero Dawn trophies.",
            "icon_url": "https://image.api.playstation.com/trophy/np/NPWR11556_00_005122C6D8E4545DAC325B8E748CBE7180ED11F3E7/1E6115EB5EA2E026D9A157BE27A44DFBBE329C7C.PNG",
            "is_hidden": false,
            "psn_earned_rate": "5.3",
            "psray_rate": 62.5,
            "earned_count": 18847,
            "rarity": "COMMON",
            "tip_count": 0,
            "localized_name": "All trophies obtained",
            "localized_detail": "Obtained all Horizon Zero Dawn trophies."
          }
        ]
      }
    ],
    "recent_players": [
      {
        "psnid": "abyssmoe",
        "avatar_url": "https://api.dev.psray.net/media/avatar/hr/01m824wbtnacwx2qnhk3a8qphr/sm.webp",
        "country": "HK",
        "progress": 30,
        "earned_platinum": 0,
        "last_earned_at": "2021-04-21T19:40:46.000000Z"
      }
    ],
    "similar_trophy_sets": [],
    "game": {
      "id": 6679,
      "name": "Horizon Zero Dawn",
      "localized_name": "Horizon Zero Dawn",
      "display_language": null,
      "cover": {
        "id": null,
        "url": "https://images.igdb.com/igdb/image/upload/t_cover_big_2x/co2una.jpg",
        "width": null,
        "height": null,
        "color": null,
        "srcset": null
      },
      "first_release_date": "2017-02-28",
      "first_release_precision": "day",
      "platforms": [
        {
          "code": "PS4",
          "name": "PlayStation 4",
          "abbreviation": "PS4"
        }
      ],
      "trophy_set_count": 1
    },
    "series": [
      {
        "id": 860,
        "name": "Horizon",
        "localized_name": "Horizon",
        "display_language": null,
        "cover": null,
        "covers": [
          "https://image.api.playstation.com/trophy/np/NPWR11556_00_005122C6D8E4545DAC325B8E748CBE7180ED11F3E7/F24674E946809EB0A2E214DB490149851BCEC0EC.PNG",
          "https://psnobj.prod.dl.playstation.net/psnobj/NPWR21008_00/2b1ab462-7ee0-4415-81d8-bf2632f03850.png",
          "https://psnobj.prod.dl.playstation.net/psnobj/NPWR27777_00/a858c347-f4c0-4e6b-8b88-e2b9167d3055.png",
          "https://psnobj.prod.dl.playstation.net/psnobj/NPWR37082_00/ab7daeb9-8cdf-4164-ae7b-ed7913a72ac2.png"
        ],
        "stage_count": 4,
        "side_count": 0,
        "trophy_set_count": 8,
        "popularity": 55199,
        "first_year": 2017,
        "last_year": 2024,
        "card": "c5e7a74811f8",
        "stage_number": 1,
        "stage_kind": "main"
      }
    ],
    "viewer_progress": null
  }
}
```

## 玩家资料

GET `/profile/{psnid}` 公开

返回玩家的个人资料：奖杯等级、各等级奖杯数、排名、近一年的奖杯日历和最近发表的留言。资料未公开的玩家同样返回 200，但 is_profile_public 为 false，calendar 为 null。

### 请求参数

参数 位置 说明

- `psnid` string

  路径

  必填 玩家的 PSN 在线 ID，不区分大小写

- `lang` string

  查询

  最近留言中奖杯和奖杯组名称的展示语言

### 常用字段

只列出常用字段，完整结构见响应示例。

- `psnid` string

  PSN 在线 ID

- `avatar_url` string

  头像地址

- `country` string | null

  国家或地区代码，例如 JP

- `trophy_level / progress` integer

  奖杯等级，以及升到下一级的进度（0 到 100）

- `platinum / gold / silver / bronze` integer

  各等级的奖杯数

- `points` integer

  奖杯点数

- `rank / server_rank` integer | null

  全站排名和地区排名；不参与排名时为 null

- `is_profile_public` boolean

  资料是否公开

- `calendar` array | null

  近一年每天获得的奖杯数，每项包含 date 和 count；资料未公开时为 null

- `recent_tips` array | null

  最近发表的 5 条留言；未在本站注册的玩家为 null

### 错误

404 USER_NOT_FOUND 410 USER_BANNED 全部错误码

```bash
curl 'https://api.psray.net/profile/abyssmoe'
```

200

```json
{
  "data": {
    "id": 1,
    "role": "admin",
    "psnid": "abyssmoe",
    "account_id": "1848172946608790926",
    "status": 1,
    "country": "HK",
    "language": [
      "zh-CN",
      "ja"
    ],
    "avatar_url": "https://api.dev.psray.net/media/avatar/hr/01m824wbtnacwx2qnhk3a8qphr/sm.webp",
    "about_me": "May you find your worth in the waking world.",
    "is_plus": false,
    "played_game_count": 181,
    "completed_game_count": 156,
    "abandoned_game_count": 11,
    "trophy_level": 444,
    "progress": 97,
    "platinum": 153,
    "gold": 573,
    "silver": 1359,
    "bronze": 4828,
    "points": 210660,
    "rank": 19378,
    "server_rank": 2649,
    "follower_count": 5,
    "following_count": 9,
    "first_trophy_at": "2018-07-07T14:59:21.000000Z",
    "last_trophy_at": "2026-10-05T13:17:09.000000Z",
    "is_profile_public": true,
    "is_rankable": true,
    "tip_count": 2,
    "tip_vote_count": 0,
    "page_view_count": 89,
    "sync_interval": 1440,
    "sync_next_at": "2027-01-19T18:11:10.000000Z",
    "last_synced_at": "2026-11-20T18:11:10.000000Z",
    "registered_at": "2022-09-09T21:13:28.000000Z",
    "created_at": null,
    "updated_at": "2026-11-22T17:29:24.000000Z",
    "can_follow": false,
    "banner": {
      "id": "01m824wdd0nzdytf32v0jmt650",
      "url": "https://api.dev.psray.net/media/banner/50/01m824wdd0nzdytf32v0jmt650/lg.webp",
      "width": 2048,
      "height": 455,
      "color": "#483d35",
      "srcset": "https://api.dev.psray.net/media/banner/50/01m824wdd0nzdytf32v0jmt650/sm.webp 1440w, https://api.dev.psray.net/media/banner/50/01m824wdd0nzdytf32v0jmt650/lg.webp 2048w"
    },
    "is_following": false,
    "is_follower": false,
    "calendar": [
      {
        "date": "2025-01-24",
        "count": 11
      },
      {
        "date": "2025-01-25",
        "count": 4
      }
    ],
    "recent_tips": [
      {
        "id": 45,
        "trophy_id": 143739,
        "user_id": 1,
        "language": "ja",
        "has_spoiler": false,
        "missable": null,
        "vote_up_count": 0,
        "vote_down_count": 0,
        "content": "::: checklist 必殺技\n…",
        "content_type": "markdown",
        "created_at": "2024-09-16T17:01:12.000000Z",
        "updated_at": "2026-08-14T16:10:02.000000Z",
        "trophy_set_id": 4404,
        "trophy_set": {
          "id": 4404,
          "name": "うたわれるもの 二人の白皇",
          "display_language": "ja-JP",
          "icon_url": "https://image.api.playstation.com/trophy/np/NPWR10330_00_000D5E47E59040943750D0813739DB7D7E481F5C0C/4B7719284069838D0C2F23BAA767B12464775B06.PNG",
          "platform": [
            "PS3",
            "PSVITA",
            "PS4"
          ]
        },
        "trophy": {
          "id": 143739,
          "name": "協必百景",
          "icon_url": "https://image.api.playstation.com/trophy/np/NPWR10330_00_000D5E47E59040943750D0813739DB7D7E481F5C0C/8E71750B2AADBABE6B7339FCC50B979EB624169A.PNG",
          "type": "silver",
          "display_language": "ja-JP"
        }
      }
    ]
  }
}
```

## 浏览游戏

GET `/games` 公开 分页

分页列出游戏，按首发日期从新到旧排列，可以按名称或别名搜索，按平台筛选。

### 请求参数

参数 位置 说明

- `q` string

  查询

  搜索关键词，匹配名称、各语言名称和别名（例如 FF7R）

- `platform[]` string\[]

  查询

  按平台筛选，可多选，例如 PS5、PS4、PC、SWITCH

- `page` integer

  查询

  页码，从 1 开始

  默认 `1`

- `per_page` integer

  查询

  每页条数，1 到 100

  默认 `24`

- `lang` string

  查询

  展示语言，例如 zh-Hans、ja、en，见「展示语言」

### 常用字段

只列出常用字段，完整结构见响应示例。

- `id` integer

  游戏 ID

- `name / localized_name` string

  原名，以及按展示语言选出的名称（界面上显示后者）

- `cover` object | null

  封面图，包含地址、尺寸和主色；可能为 null

- `first_release_date` string | null

  首发日期；未定档时为 null

- `platforms` array

  发售过的平台，每项包含 code、name、abbreviation

- `trophy_set_count` integer

  关联的奖杯组数量

### 错误

422 VALIDATION_FAILED 全部错误码

```bash
curl --get 'https://api.psray.net/games' \
  --data-urlencode 'q=horizon' \
  --data-urlencode 'per_page=1'
```

200

```json
{
  "data": [
    {
      "id": 12334,
      "name": "Horizon Zero Dawn Remastered",
      "localized_name": "Horizon Zero Dawn Remastered",
      "display_language": null,
      "cover": {
        "id": null,
        "url": "https://images.igdb.com/igdb/image/upload/t_cover_big_2x/co8vsm.jpg",
        "width": null,
        "height": null,
        "color": null,
        "srcset": null
      },
      "first_release_date": "2024-10-31",
      "first_release_precision": "day",
      "platforms": [
        {
          "code": "PS5",
          "name": "PlayStation 5",
          "abbreviation": "PS5"
        }
      ],
      "trophy_set_count": 1
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 1,
    "total": 21,
    "total_pages": 21
  }
}
```

## 游戏详情

GET `/games/{id}` 公开

返回单款游戏的简介、别名、各平台和地区的发售日期、外部链接，以及关联的奖杯组和所属系列。

### 请求参数

参数 位置 说明

- `id` integer

  路径

  必填 游戏 ID

- `lang` string

  查询

  展示语言，例如 zh-Hans、ja、en，见「展示语言」

### 常用字段

只列出常用字段，完整结构见响应示例。

- `summary / localized_summary` string | null

  简介，以及按展示语言选出的简介

- `aliases` string\[]

  别名，例如缩写或旧名

- `releases` array

  各平台、各地区的发售日期

- `links` array

  外部数据库中的页面，例如 IGDB

- `trophy_sets` array

  关联的奖杯组，结构同浏览奖杯组的列表项

- `series` array

  所属系列

### 错误

404 GAME_NOT_FOUND 全部错误码

```bash
curl 'https://api.psray.net/games/6679'
```

200

```json
{
  "data": {
    "id": 6679,
    "name": "Horizon Zero Dawn",
    "localized_name": "Horizon Zero Dawn",
    "display_language": null,
    "cover": {
      "id": null,
      "url": "https://images.igdb.com/igdb/image/upload/t_cover_big_2x/co2una.jpg",
      "width": null,
      "height": null,
      "color": null,
      "srcset": null
    },
    "first_release_date": "2017-02-28",
    "first_release_precision": "day",
    "platforms": [
      {
        "code": "PS4",
        "name": "PlayStation 4",
        "abbreviation": "PS4"
      }
    ],
    "trophy_set_count": 1,
    "summary": null,
    "localized_summary": null,
    "translations": [],
    "aliases": [],
    "releases": [
      {
        "platform": "PS4",
        "region": "NA",
        "release_date": "2017-02-28",
        "date_precision": "day",
        "status": null
      },
      {
        "platform": "PS4",
        "region": "EU",
        "release_date": "2017-03-01",
        "date_precision": "day",
        "status": null
      }
    ],
    "links": [
      {
        "source": "igdb",
        "url": "https://www.igdb.com/games/horizon-zero-dawn"
      }
    ],
    "trophy_sets": [
      {
        "id": 5059,
        "np_communication_id": "NPWR11556_00",
        "name": "Horizon Zero Dawn",
        "default_language": "en-US",
        "platform": [
          "PS4"
        ],
        "icon_url": "https://image.api.playstation.com/trophy/np/NPWR11556_00_005122C6D8E4545DAC325B8E748CBE7180ED11F3E7/F24674E946809EB0A2E214DB490149851BCEC0EC.PNG",
        "defined_trophies": {
          "bronze": 65,
          "silver": 11,
          "gold": 2,
          "platinum": 1
        },
        "owners": 30142,
        "completed_players": 5911,
        "platinum_achievers": 18847,
        "recent_players": 7,
        "average_progress": 64,
        "average_completion_time": 42067747,
        "median_completion_time": 17864400,
        "p10_completion_time": 1094939,
        "fastest_completion_time": 223327,
        "median_platinum_time": 7741552,
        "difficult_trophy_count": 8,
        "translation_count": 19,
        "created_at": "2022-12-31T16:00:00.000000Z",
        "updated_at": "2026-11-20T00:10:52.000000Z",
        "localized_name": "Horizon Zero Dawn",
        "display_language": "en-US",
        "available_languages": [
          {
            "language_code": "en-US",
            "is_default": true,
            "source": "official",
            "name": "Horizon Zero Dawn"
          },
          {
            "language_code": "ja-JP",
            "is_default": false,
            "source": "official",
            "name": "Horizon Zero Dawn"
          }
        ],
        "platinum_rate": 62.5,
        "completion_rate": 19.6
      }
    ],
    "series": [
      {
        "id": 860,
        "name": "Horizon",
        "localized_name": "Horizon",
        "display_language": null,
        "cover": null,
        "covers": [
          "https://image.api.playstation.com/trophy/np/NPWR11556_00_005122C6D8E4545DAC325B8E748CBE7180ED11F3E7/F24674E946809EB0A2E214DB490149851BCEC0EC.PNG",
          "https://psnobj.prod.dl.playstation.net/psnobj/NPWR21008_00/2b1ab462-7ee0-4415-81d8-bf2632f03850.png",
          "https://psnobj.prod.dl.playstation.net/psnobj/NPWR27777_00/a858c347-f4c0-4e6b-8b88-e2b9167d3055.png",
          "https://psnobj.prod.dl.playstation.net/psnobj/NPWR37082_00/ab7daeb9-8cdf-4164-ae7b-ed7913a72ac2.png"
        ],
        "stage_count": 4,
        "side_count": 0,
        "trophy_set_count": 8,
        "popularity": 55199,
        "first_year": 2017,
        "last_year": 2024,
        "card": "c5e7a74811f8",
        "stage_number": 1,
        "stage_kind": "main"
      }
    ]
  }
}
```

## 浏览系列

GET `/series` 公开 分页

分页列出游戏系列，可以按系列名或其中作品的标题搜索，按热度、最近新作或名称排序。

### 请求参数

参数 位置 说明

- `q` string

  查询

  搜索关键词，匹配系列名，也匹配系列中奖杯组的标题

- `sort` string

  查询

  排序：popular 按热度，recent 按最新作年份，name 按名称

  默认 `popular` `popular` `recent` `name`

- `page` integer

  查询

  页码，从 1 开始

  默认 `1`

- `per_page` integer

  查询

  每页条数，1 到 60

  默认 `24`

- `lang` string

  查询

  展示语言，例如 zh-Hans、ja、en，见「展示语言」

### 常用字段

只列出常用字段，完整结构见响应示例。

- `id` integer

  系列 ID

- `name / localized_name` string

  原名，以及按展示语言选出的名称（界面上显示后者）

- `covers` string\[]

  最多 4 张代表作图标，可以拼成封面

- `stage_count / side_count` integer

  主线作品数和外传数

- `trophy_set_count` integer

  系列中的奖杯组总数

- `popularity` integer

  热度，即主线各作玩家数之和

- `first_year / last_year` integer | null

  主线首作和最新作的发售年份

### 错误

422 VALIDATION_FAILED 全部错误码

```bash
curl --get 'https://api.psray.net/series' \
  --data-urlencode 'q=horizon' \
  --data-urlencode 'per_page=1'
```

200

```json
{
  "data": [
    {
      "id": 860,
      "name": "Horizon",
      "localized_name": "Horizon",
      "display_language": null,
      "cover": null,
      "covers": [
        "https://image.api.playstation.com/trophy/np/NPWR11556_00_005122C6D8E4545DAC325B8E748CBE7180ED11F3E7/F24674E946809EB0A2E214DB490149851BCEC0EC.PNG",
        "https://psnobj.prod.dl.playstation.net/psnobj/NPWR21008_00/2b1ab462-7ee0-4415-81d8-bf2632f03850.png",
        "https://psnobj.prod.dl.playstation.net/psnobj/NPWR27777_00/a858c347-f4c0-4e6b-8b88-e2b9167d3055.png",
        "https://psnobj.prod.dl.playstation.net/psnobj/NPWR37082_00/ab7daeb9-8cdf-4164-ae7b-ed7913a72ac2.png"
      ],
      "stage_count": 4,
      "side_count": 0,
      "trophy_set_count": 8,
      "popularity": 55199,
      "first_year": 2017,
      "last_year": 2024,
      "card": "c5e7a74811f8",
      "viewer_progress": null
    }
  ],
  "meta": {
    "page": 1,
    "per_page": 1,
    "total": 5,
    "total_pages": 5
  }
}
```

## 系列详情

GET `/series/{id}` 公开

按顺序返回系列中的各部作品（主线和外传）及其奖杯组。传入 psnid 时，还会附带这名玩家在系列中的进度。

### 请求参数

参数 位置 说明

- `id` integer

  路径

  必填 系列 ID

- `psnid` string

  查询

  附带这名玩家在该系列的进度（仅限资料公开的玩家）

- `lang` string

  查询

  展示语言，例如 zh-Hans、ja、en，见「展示语言」

### 常用字段

只列出常用字段，完整结构见响应示例。

- `description` string | null

  系列简介

- `tier_totals` object

  主线各作（每作取玩家最多的版本）的奖杯总数，按等级统计

- `stages` array

  按顺序排列的作品，kind 为 main（主线）或 side（外传）

- `stages[].entries` array

  该作品对应的奖杯组，例如不同平台的版本

- `viewer` object | null

  psnid 对应玩家在系列中的进度；未传 psnid 时为 null

### 错误

404 SERIES_NOT_FOUND 全部错误码

```bash
curl 'https://api.psray.net/series/860'
```

200

```json
{
  "data": {
    "id": 860,
    "name": "Horizon",
    "localized_name": "Horizon",
    "display_language": null,
    "cover": null,
    "covers": [
      "https://image.api.playstation.com/trophy/np/NPWR11556_00_005122C6D8E4545DAC325B8E748CBE7180ED11F3E7/F24674E946809EB0A2E214DB490149851BCEC0EC.PNG",
      "https://psnobj.prod.dl.playstation.net/psnobj/NPWR21008_00/2b1ab462-7ee0-4415-81d8-bf2632f03850.png",
      "https://psnobj.prod.dl.playstation.net/psnobj/NPWR27777_00/a858c347-f4c0-4e6b-8b88-e2b9167d3055.png",
      "https://psnobj.prod.dl.playstation.net/psnobj/NPWR37082_00/ab7daeb9-8cdf-4164-ae7b-ed7913a72ac2.png"
    ],
    "stage_count": 4,
    "side_count": 0,
    "trophy_set_count": 8,
    "popularity": 55199,
    "first_year": 2017,
    "last_year": 2024,
    "description": null,
    "languages": [],
    "tier_totals": {
      "platinum": 4,
      "gold": 15,
      "silver": 40,
      "bronze": 160
    },
    "stages": [
      {
        "id": 3313,
        "kind": "main",
        "number": 1,
        "name": "Horizon Zero Dawn",
        "release_date": "2017-02-28",
        "entries": [
          {
            "id": 5059,
            "np_communication_id": "NPWR11556_00",
            "name": "Horizon Zero Dawn",
            "localized_name": "Horizon Zero Dawn",
            "display_language": "en-US",
            "default_language": "en-US",
            "platform": [
              "PS4"
            ],
            "region": null,
            "icon_url": "https://image.api.playstation.com/trophy/np/NPWR11556_00_005122C6D8E4545DAC325B8E748CBE7180ED11F3E7/F24674E946809EB0A2E214DB490149851BCEC0EC.PNG",
            "defined_trophies": {
              "bronze": 65,
              "silver": 11,
              "gold": 2,
              "platinum": 1
            },
            "owners": 30142,
            "completed_players": 5911,
            "platinum_rate": 62.5,
            "completion_rate": 19.6,
            "game_id": 6679
          }
        ]
      }
    ],
    "viewer": null
  }
}
```

Errors

## 错误码

所有错误使用相同的格式，按 `error.code` 区分即可。下表是本页接口可能返回的错误码。

- 404 `NOT_FOUND`

  路径不存在，或 ID 不是数字

- 404 `TROPHY_SET_NOT_FOUND`

  奖杯组不存在

- 404 `USER_NOT_FOUND`

  站内没有这名玩家（从未同步过，或已注销）

- 410 `USER_BANNED`

  这名玩家已被永久停用

- 404 `GAME_NOT_FOUND`

  游戏不存在

- 404 `SERIES_NOT_FOUND`

  系列不存在或尚未发布

- 405 `METHOD_NOT_ALLOWED`

  请求方法不对，本页接口只接受 GET

- 422 `VALIDATION_FAILED`

  参数不合法，原因见 error.details

- 500 `INTERNAL_ERROR`

  服务器内部错误，请稍后重试

错误

404

```json
{
  "error": {
    "code": "TROPHY_SET_NOT_FOUND",
    "message": "Trophy set not found."
  },
  "request_id": "01a21813-3f47-7265-bfc1-9bab0725ff8c"
}
```

Usage

## 使用须知

- 请缓存结果，避免高频轮询或批量抓取。目前没有设置限流，但滥用的来源可能会被限制访问。
- 响应以后可能增加字段，请忽略不认识的字段。本页没有列出的字段可能调整，不建议依赖。
- 数据来自 PSN 公开的奖杯信息，由 PSRay 定期同步，可能有延迟。玩家把资料设为私密后，我们不会公开其奖杯数据。
- 遇到问题或有建议，欢迎在[用户反馈](https://psray.net/feedback.md?lang=zh-Hans)告诉我们。

接口仍在完善中，变更会同步更新到本页。
