---
name: tryghost-add-admin-api-endpoint
description: "Add a new endpoint or endpoints to Ghost's Admin API at `ghost/api/admin/**`."
license: "MIT"
metadata:
  decimalai-skill-id: "c2c3c525-99fc-4cee-b421-f1a0e84231ff"
  decimalai-version-id: "417bcb5d-8326-44a2-827d-ee7896720861"
  decimalai-version: "2"
  decimalai-body-sha256: "ad15364e476d25ebfdb9d495f26c27fb8c0e59c94d7b7d037bb80a258a6ae40b"
  decimalai-name: "tryghost/Add Admin API Endpoint"
  decimalai-format: "1"
  decimalai-invocation: "model"
  decimalai-category: "coding"
  decimalai-source: "https://app.decimal.ai/s/tryghost-add-admin-api-endpoint@2/SKILL.md"
---
# Create Admin API Endpoint

## Instructions

1. 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.
2. The endpoint file should create a controller object using the JSDoc type from (@tryghost/api-framework).Controller, including at minimum a `docName` and a single endpoint definition, i.e. `browse`.
3. Add routes for each endpoint to `ghost/core/server/web/api/endpoints/admin/routes.js`.
4. Add basic `e2e-api` tests for the endpoint in `ghost/test/e2e-api/admin` to ensure the new endpoints function as expected.
5. 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](reference.md).
