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

# Update collection (rename / publish / sort)

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

**What:** Owner-only update for rename, publish/unpublish, and remembered sort. At least one recognised field required.

**Auth:** Bearer token required.

**Body (JSON, all optional but at least one required):**

| Field | Type | Required | Description | Example |
|---|---|---|---|---|
| name | string | no | New title (trimmed, max 60). Rejected for default lists. | `Favorite Films` |
| isPublic | boolean | no | Publish (true) / unpublish (false). Allowed for default lists. | `true` |
| sort | string | no | One of: added_desc, added_asc, title_asc, title_desc, year_desc, year_asc. | `year_desc` |

**Returns:** `data = card`. Setting a field to its current value is a valid no-op (still 200).

Reference: https://apidocs.movieknight.site/movie-knight-api/collections/update-collection-rename-publish-sort

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/collections/{{collectionId}}:
    patch:
      operationId: update-collection-rename-publish-sort
      summary: Update collection (rename / publish / sort)
      description: >-
        **What:** Owner-only update for rename, publish/unpublish, and
        remembered sort. At least one recognised field required.


        **Auth:** Bearer token required.


        **Body (JSON, all optional but at least one required):**


        | Field | Type | Required | Description | Example |

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

        | name | string | no | New title (trimmed, max 60). Rejected for default
        lists. | `Favorite Films` |

        | isPublic | boolean | no | Publish (true) / unpublish (false). Allowed
        for default lists. | `true` |

        | sort | string | no | One of: added_desc, added_asc, title_asc,
        title_desc, year_desc, year_asc. | `year_desc` |


        **Returns:** `data = card`. Setting a field to its current value is a
        valid no-op (still 200).
      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_Update collection (rename /
                  publish / sort)_Response_200
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PatchApiCollections66b0c1d2e3f4a5b6c7d8e9f0RequestBadRequestError
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PatchApiCollections66b0c1d2e3f4a5b6c7d8e9f0RequestNotFoundError
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                sort:
                  type: string
                isPublic:
                  type: boolean
              required:
                - name
                - sort
                - isPublic
servers:
  - url: '{{baseUrl}}'
    description: '{{baseUrl}}'
components:
  schemas:
    ApiCollectionsCollectionIdPatchResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        sort:
          type: string
        author:
          type: string
        covers:
          type: array
          items:
            description: Any type
        isOwner:
          type: boolean
        isPublic:
          type: boolean
        movieIds:
          type: array
          items:
            description: Any type
        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
        - covers
        - isOwner
        - isPublic
        - movieIds
        - createdAt
        - isDefault
        - likesCount
        - movieCount
        - savesCount
      title: ApiCollectionsCollectionIdPatchResponsesContentApplicationJsonSchemaData
    Collections_Update collection (rename / publish / sort)_Response_200:
      type: object
      properties:
        ok:
          type: boolean
        data:
          $ref: >-
            #/components/schemas/ApiCollectionsCollectionIdPatchResponsesContentApplicationJsonSchemaData
      required:
        - ok
        - data
      title: Collections_Update collection (rename / publish / sort)_Response_200
    PatchApiCollections66b0c1d2e3f4a5b6c7d8e9f0RequestBadRequestError:
      type: object
      properties:
        ok:
          type: boolean
        error:
          type: string
      required:
        - ok
        - error
      title: PatchApiCollections66b0c1d2e3f4a5b6c7d8e9f0RequestBadRequestError
    PatchApiCollections66b0c1d2e3f4a5b6c7d8e9f0RequestNotFoundError:
      type: object
      properties:
        ok:
          type: boolean
        error:
          type: string
      required:
        - ok
        - error
      title: PatchApiCollections66b0c1d2e3f4a5b6c7d8e9f0RequestNotFoundError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

```

## Examples



**Request**

```json
{
  "name": "Classic Sci-Fi Collection",
  "sort": "year_desc",
  "isPublic": true
}
```

**Response**

```json
{
  "ok": true,
  "data": {
    "id": "66b0c1d2e3f4a5b6c7d8e9f5",
    "name": "Classic Sci-Fi Collection",
    "sort": "year_desc",
    "author": "moviefan",
    "covers": [
      "https://image.tmdb.org/t/p/w500/8UlWHLMpgZm9bx6QYh0NFoq67TZ.jpg",
      "https://image.tmdb.org/t/p/w500/6FfCtAuVAW8XJjZ7eWeLibRLWTw.jpg"
    ],
    "isOwner": true,
    "isPublic": true,
    "movieIds": [
      "tt0083658",
      "tt0078748",
      "tt0062622"
    ],
    "createdAt": "2026-06-25T11:00:00.000Z",
    "isDefault": false,
    "likesCount": 42,
    "movieCount": 3,
    "savesCount": 15,
    "posterUrl": null
  }
}
```

**SDK Code**

```python Collections_Update collection (rename / publish / sort)_example
import requests

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

payload = {
    "name": "Classic Sci-Fi Collection",
    "sort": "year_desc",
    "isPublic": True
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Collections_Update collection (rename / publish / sort)_example
const url = 'https://{{baseurl}}/api/collections/%7BcollectionId%7D';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"Classic Sci-Fi Collection","sort":"year_desc","isPublic":true}'
};

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

```go Collections_Update collection (rename / publish / sort)_example
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"name\": \"Classic Sci-Fi Collection\",\n  \"sort\": \"year_desc\",\n  \"isPublic\": true\n}")

	req, _ := http.NewRequest("PATCH", 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_Update collection (rename / publish / sort)_example
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Classic Sci-Fi Collection\",\n  \"sort\": \"year_desc\",\n  \"isPublic\": true\n}"

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

```java Collections_Update collection (rename / publish / sort)_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://{{baseurl}}/api/collections/%7BcollectionId%7D")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Classic Sci-Fi Collection\",\n  \"sort\": \"year_desc\",\n  \"isPublic\": true\n}")
  .asString();
```

```php Collections_Update collection (rename / publish / sort)_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://{{baseurl}}/api/collections/%7BcollectionId%7D', [
  'body' => '{
  "name": "Classic Sci-Fi Collection",
  "sort": "year_desc",
  "isPublic": true
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Collections_Update collection (rename / publish / sort)_example
using RestSharp;

var client = new RestClient("https://{{baseurl}}/api/collections/%7BcollectionId%7D");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Classic Sci-Fi Collection\",\n  \"sort\": \"year_desc\",\n  \"isPublic\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Collections_Update collection (rename / publish / sort)_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Classic Sci-Fi Collection",
  "sort": "year_desc",
  "isPublic": true
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://{{baseurl}}/api/collections/%7BcollectionId%7D")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
```