---
title: "Batch set source metadata"
method: POST
path: "/sources/metadata/batch"
tags: ["sources"]
---

# Batch set source metadata

`POST /sources/metadata/batch`

Updates metadata for multiple sources in a single request. Merges with existing metadata by key. Send val: null to delete a key. Maximum 50 items per request.

Required roles: All

## Request body

- BatchSetSourceMetadataRequest
  - `items` object[], required — List of source metadata items (max 50)
    - `source_id` string, required — Source ID (file ID)
    - `source_group_id` string, required — Source group ID (required for database constraints)
    - `metadata` Metadata, required
      - `records` MetadataRecord[] — List of metadata records. A patch may contain up to 40 items; the merged result is capped at 20.
        - `key` string, required — Metadata key (max 20 characters)
        - `val` unknown, required
        - `type` 'string' | 'integer' | 'float' | 'date' | 'datetime' — Data type of the metadata value

## Response `200`

Successfully set metadata for all items

- BatchSetMetadataResponse
  - `success_count` integer, required — Number of successfully processed items
  - `results` object[], required
    - `id` string — Source or source group ID
    - `success` boolean — Whether the operation succeeded
    - `error` string — Error message if operation failed

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `500` — Internal Server Error

---

[API](https://skmtc.net/qlonolink/apis/qaip-apis.md) · [All operations](https://skmtc.net/qlonolink/apis/qaip-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/qlonolink/qaip-apis/revisions/f5f5994dfe05/schema)
