About Add Admin API Endpoint
A Ghost development skill for adding Admin API endpoints. It guides contributors through controller and route changes and the required end-to-end API tests.
Key features
- 01Create or update endpoint files
- 02Define API controller and browse endpoint
- 03Register Admin API routes
- 04Add and run e2e-api tests
Use cases
- 01Adding an endpoint for a new Ghost resource
- 02Extending an existing Admin API endpoint
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ tryghost/ ghost --skill add-admin-api-endpointAfter installing, type/add-admin-api-endpointin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
permissions.mdreference.mdvalidation.mdDetails
From the project READMECreate Admin API Endpoint
Instructions
- If creating an endpoint for an entirely new resource, create a new endpoint file in
ghost/core/server/api/endpoints/. Otherwise, locate the existing endpoint file in the same directory. - The endpoint file should create a controller object using the JSDoc type from (@tryghost/api-framework).Controller, including at minimum a
docNameand a single endpoint definition, i.e.browse. - Add routes for each endpoint to
ghost/core/server/web/api/endpoints/admin/routes.js. - Add basic
e2e-apitests for the endpoint inghost/test/e2e-api/adminto ensure the new endpoints function as expected. - Run the tests and iterate until they pass:
cd ghost && pnpm test:single test/e2e-api/admin/{test-file-name}.
Reference
For a detailed reference on Ghost's API framework and how to create API controllers, see reference.md.
Comments
Markdown supported