---
title: "Generate content gaps"
method: POST
path: "/api/agent/gaps/generate"
tags: ["Gaps"]
---

# Generate content gaps

`POST /api/agent/gaps/generate`

Generate content gaps from competitor URLs. Optional `favorite_id` scopes the resulting gaps to a product/identity and uses `ai_favorites.domain` as the analysis target instead of the tenant blog domain. Cross-tenant `favorite_id` is rejected with 403 before credits are charged.

## Request body

- GenerateGapsRequest
  - `competitor_urls` string[], required
  - `favorite_id` string, uuid — Optional favorite (product identity) ID from ai_favorites. Owner-checked against tenant; gaps are tagged and analysis domain is overridden to ai_favorites.domain.

## Response `200`

Gaps generated

- GenerateGapsResponse
  - `gaps_found` integer, required
  - `gaps` object[], required
  - `credits_used` number, required

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `402` — Insufficient credits
- `403` — Forbidden
- `429` — Rate limit exceeded
- `500` — Internal server error

## Changes

> 28 revisions in range; 1 could not be searched.

- **2026-05-04** `ad161f576254` — 2 info
  - added the new optional request property `favorite_id`
  - added the non-success response with the status `403`
- **2026-03-01** `2df2182b5901` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/citedy/apis/citedy-agent-api/changes/api/agent/gaps/generate/post.md)

---

[API](https://skmtc.dev/citedy/apis/citedy-agent-api.md) · [All operations](https://skmtc.dev/citedy/apis/citedy-agent-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/citedy/citedy-agent-api/revisions/b5785d3fe446/schema)
