Goatlab API Docs

Replace file metadata

PATCH
/v1/files/{file_id}/metadata

Replaces the metadata fields of a personal file with the provided set.

Behavior:

  • The payload is the complete metadata set: any existing field whose key is not included is removed.
  • Send an empty array to clear all metadata.
  • aiExtracted marks whether the value was produced by AI (defaults to false).

Validation:

  • Each key is required and must be non-empty.
  • Each value is required and must be a non-empty string (null is not allowed).
  • Keys must be unique within the payload.
  • A maximum of 15 fields is allowed.

Authorization

ApiTokenAuth PRODUCT
x-api-key<token>

API Key with role based permission

In: header

Scope: PRODUCT

Path Parameters

file_id*string

The unique identifier of the file whose metadata is being replaced

Header Parameters

x-user-id*string

The ID of the user who owns the file

Request Body

application/json

The full set of metadata fields to store for the file

TypeScript Definitions

Use the request body type in TypeScript.

The full set of metadata fields for the file. This replaces the current metadata: any existing field whose key is not present in the payload is removed. Send an empty array to clear all metadata.

[index: integer]?

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://example.com/v1/files/497f6eca-6276-4993-bfeb-53cbbbba6f08/metadata" \  -H "x-user-id: string" \  -H "Content-Type: application/json" \  -d '[    {      "key": "author",      "value": "Jane Doe",      "aiExtracted": false    },    {      "key": "topic",      "value": "finance",      "aiExtracted": true    },    {      "key": "fiscal_year",      "value": "2023"    }  ]'
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "summary": "Quarterly financial overview",
  "language": "en",
  "documentKind": "Report",
  "domain": "Finance",
  "tags": [
    {
      "key": "author",
      "value": "Jane Doe",
      "aiExtracted": false
    },
    {
      "key": "topic",
      "value": "finance",
      "aiExtracted": true
    },
    {
      "key": "fiscal_year",
      "value": "2023",
      "aiExtracted": false
    }
  ]
}
{
  "message": {
    "description": "Validation failed",
    "errors": [
      {
        "path": "body.0.key",
        "message": "Key is required"
      }
    ]
  }
}
{
  "message": "Invalid API Key"
}
{
  "message": "API Key does not have permission to access this resource"
}
{
  "message": "File not found"
}
{
  "message": "Internal Server Error"
}