> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidocs.movieknight.site/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidocs.movieknight.site/_mcp/server.

# Enhance collection

POST {{baseUrl}}/api/ai/enhance/66b0c1d2e3f4a5b6c7d8e9f0
Content-Type: application/json

**What:** Recommend up to 3 movies NOT already in the collection that fit its taste, each with a reason. Owner-only. Warms the movie cache with what it returns.

**Auth:** Bearer token required. Spends 1 daily AI action on success.

**Path params:** `id` (collection ObjectId).

**Body (JSON, all optional):**

| Field | Type | Required | Description | Example |
|---|---|---|---|---|
| exclude_ids | array | no | TMDB ids already shown this session (hard filter). | `[603]` |
| exclude_titles | array | no | Titles already suggested this session (prompt avoidance, max 100). | `["The Matrix"]` |

**Returns:** `data = [{ id, title, poster_path, vote_average, release_date, reason }]` + sibling `aiUsage`.

Reference: https://apidocs.movieknight.site/movie-knight-api/ai/enhance-collection

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/ai/enhance/66b0c1d2e3f4a5b6c7d8e9f0:
    post:
      operationId: enhance-collection
      summary: Enhance collection
      description: >-
        **What:** Recommend up to 3 movies NOT already in the collection that
        fit its taste, each with a reason. Owner-only. Warms the movie cache
        with what it returns.


        **Auth:** Bearer token required. Spends 1 daily AI action on success.


        **Path params:** `id` (collection ObjectId).


        **Body (JSON, all optional):**


        | Field | Type | Required | Description | Example |

        |---|---|---|---|---|

        | exclude_ids | array | no | TMDB ids already shown this session (hard
        filter). | `[603]` |

        | exclude_titles | array | no | Titles already suggested this session
        (prompt avoidance, max 100). | `["The Matrix"]` |


        **Returns:** `data = [{ id, title, poster_path, vote_average,
        release_date, reason }]` + sibling `aiUsage`.
      tags:
        - subpackage_ai
      parameters:
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AI_Enhance collection_Response_200'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiAiEnhance66b0c1d2e3f4a5b6c7d8e9f0RequestNotFoundError
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiAiEnhance66b0c1d2e3f4a5b6c7d8e9f0RequestTooManyRequestsError
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiAiEnhance66b0c1d2e3f4a5b6c7d8e9f0RequestInternalServerError
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                exclude_ids:
                  type: array
                  items:
                    description: Any type
                exclude_titles:
                  type: array
                  items:
                    description: Any type
              required:
                - exclude_ids
                - exclude_titles
servers:
  - url: '{{baseUrl}}'
    description: '{{baseUrl}}'
components:
  schemas:
    ApiAiEnhance66B0C1D2E3F4A5B6C7D8E9F0PostResponsesContentApplicationJsonSchemaDataItems:
      type: object
      properties:
        id:
          type: integer
        title:
          type: string
        reason:
          type: string
        poster_path:
          type: string
        release_date:
          type: string
          format: date
        vote_average:
          type: number
          format: double
      required:
        - id
        - title
        - reason
        - poster_path
        - release_date
        - vote_average
      title: >-
        ApiAiEnhance66B0C1D2E3F4A5B6C7D8E9F0PostResponsesContentApplicationJsonSchemaDataItems
    ApiAiEnhance66B0C1D2E3F4A5B6C7D8E9F0PostResponsesContentApplicationJsonSchemaAiUsage:
      type: object
      properties:
        used:
          type: integer
        limit:
          type: integer
        remaining:
          type: integer
      required:
        - used
        - limit
        - remaining
      title: >-
        ApiAiEnhance66B0C1D2E3F4A5B6C7D8E9F0PostResponsesContentApplicationJsonSchemaAiUsage
    AI_Enhance collection_Response_200:
      type: object
      properties:
        ok:
          type: boolean
        data:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiAiEnhance66B0C1D2E3F4A5B6C7D8E9F0PostResponsesContentApplicationJsonSchemaDataItems
        aiUsage:
          $ref: >-
            #/components/schemas/ApiAiEnhance66B0C1D2E3F4A5B6C7D8E9F0PostResponsesContentApplicationJsonSchemaAiUsage
      required:
        - ok
        - data
        - aiUsage
      title: AI_Enhance collection_Response_200
    PostApiAiEnhance66b0c1d2e3f4a5b6c7d8e9f0RequestNotFoundError:
      type: object
      properties:
        ok:
          type: boolean
        error:
          type: string
      required:
        - ok
        - error
      title: PostApiAiEnhance66b0c1d2e3f4a5b6c7d8e9f0RequestNotFoundError
    PostApiAiEnhance66b0c1d2e3f4a5b6c7d8e9f0RequestTooManyRequestsError:
      type: object
      properties:
        ok:
          type: boolean
        code:
          type: string
        error:
          type: string
      required:
        - ok
        - code
        - error
      title: PostApiAiEnhance66b0c1d2e3f4a5b6c7d8e9f0RequestTooManyRequestsError
    PostApiAiEnhance66b0c1d2e3f4a5b6c7d8e9f0RequestInternalServerError:
      type: object
      properties:
        ok:
          type: boolean
        error:
          type: string
      required:
        - ok
        - error
      title: PostApiAiEnhance66b0c1d2e3f4a5b6c7d8e9f0RequestInternalServerError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

```

## Examples



**Request**

```json
{
  "exclude_ids": [],
  "exclude_titles": []
}
```

**Response**

```json
{
  "ok": true,
  "data": [
    {
      "id": 603,
      "title": "The Matrix",
      "reason": "Shares the cerebral, reality-bending tone of your collection.",
      "poster_path": "/p96dm7sCMn4VYAStA6siNz30G1r.jpg",
      "release_date": "1999-03-30",
      "vote_average": 8.2
    },
    {
      "id": 157336,
      "title": "Interstellar",
      "reason": "Big-idea science fiction with the same emotional weight.",
      "poster_path": "/gEU2QniE6E77NI6lCU6MxlNBvIx.jpg",
      "release_date": "2014-11-05",
      "vote_average": 8.4
    }
  ],
  "aiUsage": {
    "used": 1,
    "limit": 5,
    "remaining": 4
  }
}
```

**SDK Code**

```python AI_Enhance collection_example
import requests

url = "https://{{baseurl}}/api/ai/enhance/66b0c1d2e3f4a5b6c7d8e9f0"

payload = {
    "exclude_ids": [],
    "exclude_titles": []
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript AI_Enhance collection_example
const url = 'https://{{baseurl}}/api/ai/enhance/66b0c1d2e3f4a5b6c7d8e9f0';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"exclude_ids":[],"exclude_titles":[]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go AI_Enhance collection_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://{{baseurl}}/api/ai/enhance/66b0c1d2e3f4a5b6c7d8e9f0"

	payload := strings.NewReader("{\n  \"exclude_ids\": [],\n  \"exclude_titles\": []\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby AI_Enhance collection_example
require 'uri'
require 'net/http'

url = URI("https://{{baseurl}}/api/ai/enhance/66b0c1d2e3f4a5b6c7d8e9f0")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"exclude_ids\": [],\n  \"exclude_titles\": []\n}"

response = http.request(request)
puts response.read_body
```

```java AI_Enhance collection_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://{{baseurl}}/api/ai/enhance/66b0c1d2e3f4a5b6c7d8e9f0")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"exclude_ids\": [],\n  \"exclude_titles\": []\n}")
  .asString();
```

```php AI_Enhance collection_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://{{baseurl}}/api/ai/enhance/66b0c1d2e3f4a5b6c7d8e9f0', [
  'body' => '{
  "exclude_ids": [],
  "exclude_titles": []
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp AI_Enhance collection_example
using RestSharp;

var client = new RestClient("https://{{baseurl}}/api/ai/enhance/66b0c1d2e3f4a5b6c7d8e9f0");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"exclude_ids\": [],\n  \"exclude_titles\": []\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift AI_Enhance collection_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "exclude_ids": [],
  "exclude_titles": []
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://{{baseurl}}/api/ai/enhance/66b0c1d2e3f4a5b6c7d8e9f0")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```