---
title: "Save posts to a collection"
description: "To Disukai, an existing collection, or a new one by name. Needs the `videos:create` permission."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.mosio.me/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Mosio REST API › Discover

`POST /v1/discover/save`

To Disukai, an existing collection, or a new one by name. Needs the `videos:create` permission.

## Authentication

- `apiKey`, apiKey, in header, header `x-api-key`

## Request body

_Required._

- `post_ids` (`saveToDiscoverCollection.post_ids`; array<string>, required)
  - pattern `^dps_[0-9a-f]{16}$`
- `collection_id` (`saveToDiscoverCollection.collection_id`; string, optional) — Leave out for Disukai, the user's default collection
  - pattern `^dcl_[0-9a-f]{16}$`
- `new_collection` (`saveToDiscoverCollection.new_collection`; string, optional) — Make a collection with this name and save there instead
  - minLength 1; maxLength 80
- `note` (`saveToDiscoverCollection.note`; string, optional) — Why it was kept
  - maxLength 500; default `""`

## Example request

```json
{
  "post_ids": [
    "string"
  ],
  "collection_id": "string",
  "new_collection": "string",
  "note": ""
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://app.mosio.me/v1/discover/save \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <x-api-key>' \
  --data '
{
  "post_ids": [
    "string"
  ],
  "collection_id": "string",
  "new_collection": "string",
  "note": ""
}
'
```

### TypeScript

```typescript
const url = 'https://app.mosio.me/v1/discover/save';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', 'x-api-key': '<x-api-key>'},
  body: JSON.stringify({
    post_ids: ['string'],
    collection_id: 'string',
    new_collection: 'string',
    note: ''
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://app.mosio.me/v1/discover/save"

payload = {
    "post_ids": ["string"],
    "collection_id": "string",
    "new_collection": "string",
    "note": ""
}
headers = {
    "Content-Type": "application/json",
    "x-api-key": "<x-api-key>"
}

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

print(response.text)
```

## Responses

### 200

Where they were saved.

#### Example

```json
{
  "collection": {
    "id": "string",
    "name": "string"
  },
  "saved": -9007199254740991
}
```

- `collection` (`saveToDiscoverCollection.response.200.collection`; object, required)
  - `id` (`saveToDiscoverCollection.response.200.collection.id`; string, required)
  - `name` (`saveToDiscoverCollection.response.200.collection.name`; string, required)
- `saved` (`saveToDiscoverCollection.response.200.saved`; integer, required)
  - min -9007199254740991; max 9007199254740991

### 400

The request body is not valid JSON or does not match the schema.

#### Example

```json
{
  "error": "unauthorized",
  "message": "string",
  "details": null
}
```

- `error` (`saveToDiscoverCollection.response.400.error`; string, required) — A stable error code.
  - one of `"unauthorized"`, `"invalid_api_key"`, `"insufficient_scope"`, `"forbidden"`, `"invalid_input"`, `"invalid_composition"`, `"idempotency_conflict"`, `"project_edited"`, `"quota_exceeded"`, `"insufficient_credits"`, `"too_many_active_renders"`, `"duration_too_long"`, `"not_found"`, `"internal_error"`
- `message` (`saveToDiscoverCollection.response.400.message`; string, required) — A message for people, in Indonesian.
- `details` (`saveToDiscoverCollection.response.400.details`; unknown, optional) — More about the error, such as the fields to fix.

### 401

The API key is missing or not valid.

#### Example

```json
{
  "error": "unauthorized",
  "message": "Kirim API key di header x-api-key."
}
```

- `error` (`saveToDiscoverCollection.response.401.error`; string, required) — A stable error code.
  - one of `"unauthorized"`, `"invalid_api_key"`, `"insufficient_scope"`, `"forbidden"`, `"invalid_input"`, `"invalid_composition"`, `"idempotency_conflict"`, `"project_edited"`, `"quota_exceeded"`, `"insufficient_credits"`, `"too_many_active_renders"`, `"duration_too_long"`, `"not_found"`, `"internal_error"`
- `message` (`saveToDiscoverCollection.response.401.message`; string, required) — A message for people, in Indonesian.
- `details` (`saveToDiscoverCollection.response.401.details`; unknown, optional) — More about the error, such as the fields to fix.


Source: https://docs.mosio.me/api/save-to-discover-collection/index.md
