payload-v3-endpoints

Migrate Payload v2 endpoints to v3 handler patterns with req.json().

46|5|Updated Jun 15, 2025
One-click install
npx skills add https://github.com/aniketpanjwani/payload-plugin-email-newsletter --skill payload-v3-endpoints
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: payload-v3-endpoints
Source: https://github.com/aniketpanjwani/payload-plugin-email-newsletter/tree/main/.claude/skills/payload-v3-endpoints
Command: npx skills add https://github.com/aniketpanjwani/payload-plugin-email-newsletter --skill payload-v3-endpoints

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Payload v3 endpoint patterns and logger usage can be misapplied when migrating from v2, causing undefined body access, incorrect response handling, and broken TypeScript types.

Core Features & Use Cases

  • Enforces v3 handler signatures (async (req) => ...) and correct body parsing with await req.json()
  • Standardizes responses using Response.json() and proper error handling patterns
  • Guides secure, predictable logger usage on req.payload.logger to avoid runtime issues

Quick Start

Refactor your v3 endpoints to use the PayloadRequest handler, parse the body with await req.json(), and return responses using Response.json().

Frequently Asked Questions about payload-v3-endpoints

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I access request body data in Payload v3 endpoints?

To access request body data in Payload v3 endpoints, you must parse it asynchronously using `await req.json()`. This replaces the Payload v2 `req.data` property, resolving undefined body access and TypeScript type errors during migration.

Why does req.data return undefined in my Payload v3 custom handlers?

The `req.data` property returns undefined in Payload v3 custom handlers because it was removed in the migration from v2. You must refactor your handlers to use `await req.json()` to parse the incoming REST API request body correctly.

What is the correct handler signature for Payload v3 API endpoints?

The correct handler signature for Payload v3 API endpoints uses an asynchronous function taking a single request argument: `async (req) => ...`. This signature enables proper body parsing and compatibility with Payload v3 runtime patterns.

How do I return JSON responses from Payload v3 custom endpoints?

You return JSON responses from Payload v3 custom endpoints by using the standard web API `Response.json()` method. This standardizes your API endpoint responses and ensures proper error handling patterns within your TypeScript types.

How do I use the logger in Payload v3 endpoint handlers?

You use the logger in Payload v3 endpoint handlers by accessing `req.payload.logger`. This approach ensures secure and predictable logger usage, avoiding common runtime issues caused by misapplied v2 patterns during migration.

Do I need to change req.cookies handling when migrating endpoints to Payload v3?

Yes, you need to change `req.cookies` handling when migrating endpoints to Payload v3, as direct v2 patterns cause runtime issues. Refactoring to the v3 endpoint patterns using the `async (req)` signature ensures proper compatibility and resolves TypeScript type errors.