> 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.

# Add movie to collection

POST {{baseUrl}}/api/collections/{{collectionId}}/movies
Content-Type: application/json

**What:** Owner-only. Add a movie by TMDB id (idempotent: re-adding is a no-op). Hydrates the movie cache + filter facets from TMDB.

**Auth:** Bearer token required.

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

**Body (JSON):**

| Field | Type | Required | Description | Example |
|---|---|---|---|---|
| tmdbId | integer | yes | Numeric TMDB movie id (> 0). | `27205` |

**Returns:** `data = full` (the updated collection + movies).

Reference: https://apidocs.movieknight.site/movie-knight-api/collections/add-movie-to-collection

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/collections/{{collectionId}}/movies:
    post:
      operationId: add-movie-to-collection
      summary: Add movie to collection
      description: >-
        **What:** Owner-only. Add a movie by TMDB id (idempotent: re-adding is a
        no-op). Hydrates the movie cache + filter facets from TMDB.


        **Auth:** Bearer token required.


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


        **Body (JSON):**


        | Field | Type | Required | Description | Example |

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

        | tmdbId | integer | yes | Numeric TMDB movie id (> 0). | `27205` |


        **Returns:** `data = full` (the updated collection + movies).
      tags:
        - subpackage_collections
      parameters:
        - name: '{collectionId'
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Collections_Add movie to
                  collection_Response_200
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiCollections66b0c1d2e3f4a5b6c7d8e9f0MoviesRequestBadRequestError
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiCollections66b0c1d2e3f4a5b6c7d8e9f0MoviesRequestNotFoundError
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                tmdbId:
                  type: integer
              required:
                - tmdbId
servers:
  - url: '{{baseUrl}}'
    description: '{{baseUrl}}'
components:
  schemas:
    ApiCollectionsCollectionIdMoviesPostResponsesContentApplicationJsonSchemaDataMoviesItems:
      type: object
      properties:
        id:
          type: integer
        title:
          type: string
        addedAt:
          type: string
          format: date-time
        genre_ids:
          type: array
          items:
            type: integer
        sortOrder:
          type: integer
        poster_path:
          type: string
        releaseYear:
          type: integer
        provider_ids:
          type: array
          items:
            type: integer
        release_date:
          type: string
          format: date
        vote_average:
          type: number
          format: double
      required:
        - id
        - title
        - addedAt
        - genre_ids
        - sortOrder
        - poster_path
        - releaseYear
        - provider_ids
        - release_date
        - vote_average
      title: >-
        ApiCollectionsCollectionIdMoviesPostResponsesContentApplicationJsonSchemaDataMoviesItems
    ApiCollectionsCollectionIdMoviesPostResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        sort:
          type: string
        author:
          type: string
        movies:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiCollectionsCollectionIdMoviesPostResponsesContentApplicationJsonSchemaDataMoviesItems
        isOwner:
          type: boolean
        authorId:
          type: string
        isPublic:
          type: boolean
        createdAt:
          type: string
          format: date-time
        isDefault:
          type: boolean
        posterUrl:
          description: Any type
        likesCount:
          type: integer
        movieCount:
          type: integer
        savesCount:
          type: integer
      required:
        - id
        - name
        - sort
        - author
        - movies
        - isOwner
        - authorId
        - isPublic
        - createdAt
        - isDefault
        - likesCount
        - movieCount
        - savesCount
      title: >-
        ApiCollectionsCollectionIdMoviesPostResponsesContentApplicationJsonSchemaData
    Collections_Add movie to collection_Response_200:
      type: object
      properties:
        ok:
          type: boolean
        data:
          $ref: >-
            #/components/schemas/ApiCollectionsCollectionIdMoviesPostResponsesContentApplicationJsonSchemaData
      required:
        - ok
        - data
      title: Collections_Add movie to collection_Response_200
    PostApiCollections66b0c1d2e3f4a5b6c7d8e9f0MoviesRequestBadRequestError:
      type: object
      properties:
        ok:
          type: boolean
        error:
          type: string
      required:
        - ok
        - error
      title: PostApiCollections66b0c1d2e3f4a5b6c7d8e9f0MoviesRequestBadRequestError
    PostApiCollections66b0c1d2e3f4a5b6c7d8e9f0MoviesRequestNotFoundError:
      type: object
      properties:
        ok:
          type: boolean
        error:
          type: string
      required:
        - ok
        - error
      title: PostApiCollections66b0c1d2e3f4a5b6c7d8e9f0MoviesRequestNotFoundError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

```

## Examples



**Request**

```json
{
  "tmdbId": 27205
}
```

**Response**

```json
{
  "ok": true,
  "data": {
    "id": "66b0c1d2e3f4a5b6c7d8e9f0",
    "name": "Favorites",
    "sort": "added_desc",
    "author": "moviefan",
    "movies": [
      {
        "id": 550,
        "title": "Fight Club",
        "addedAt": "2026-06-25T10:31:00.000Z",
        "genre_ids": [
          18
        ],
        "sortOrder": 0,
        "poster_path": "/pB8BM7pdSp6B6Ih7QZ4DrQ3PmJK.jpg",
        "releaseYear": 1999,
        "provider_ids": [
          8
        ],
        "release_date": "1999-10-15",
        "vote_average": 8.438
      },
      {
        "id": 27205,
        "title": "Inception",
        "addedAt": "2026-06-25T10:32:00.000Z",
        "genre_ids": [
          28,
          878,
          12
        ],
        "sortOrder": 0,
        "poster_path": "/oYuLEt3zVCKq57qu2F8dT7NIa6f.jpg",
        "releaseYear": 2010,
        "provider_ids": [
          9,
          1899
        ],
        "release_date": "2010-07-15",
        "vote_average": 8.369
      }
    ],
    "isOwner": true,
    "authorId": "66a1f2c4e5b3a1234567890a",
    "isPublic": false,
    "createdAt": "2026-06-25T10:30:00.000Z",
    "isDefault": true,
    "likesCount": 0,
    "movieCount": 2,
    "savesCount": 0
  }
}
```

**SDK Code**

```python Collections_Add movie to collection_example
import requests

url = "https://{{baseurl}}/api/collections/%7BcollectionId%7D/movies"

payload = { "tmdbId": 27205 }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Collections_Add movie to collection_example
const url = 'https://{{baseurl}}/api/collections/%7BcollectionId%7D/movies';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"tmdbId":27205}'
};

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

```go Collections_Add movie to collection_example
package main

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

func main() {

	url := "https://{{baseurl}}/api/collections/%7BcollectionId%7D/movies"

	payload := strings.NewReader("{\n  \"tmdbId\": 27205\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 Collections_Add movie to collection_example
require 'uri'
require 'net/http'

url = URI("https://{{baseurl}}/api/collections/%7BcollectionId%7D/movies")

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  \"tmdbId\": 27205\n}"

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

```java Collections_Add movie to collection_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://{{baseurl}}/api/collections/%7BcollectionId%7D/movies")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"tmdbId\": 27205\n}")
  .asString();
```

```php Collections_Add movie to collection_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://{{baseurl}}/api/collections/%7BcollectionId%7D/movies', [
  'body' => '{
  "tmdbId": 27205
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Collections_Add movie to collection_example
using RestSharp;

var client = new RestClient("https://{{baseurl}}/api/collections/%7BcollectionId%7D/movies");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"tmdbId\": 27205\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Collections_Add movie to collection_example
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://{{baseurl}}/api/collections/%7BcollectionId%7D/movies")! 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()
```