{
  "openapi": "3.1.0",
  "info": {
    "title": "IO Intelligence",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.intelligence.io.solutions"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "oauth2",
        "flows": {}
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/api/r2r/v3/documents/{id}/metadata": {
      "patch": {
        "summary": "Append metadata to a document",
        "description": "Appends metadata to a document. This endpoint allows adding new metadata fields or updating existing ones.",
        "operationId": "update-document-metadata-partial",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Document ID (UUID)",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "metadata": {
                    "type": "string",
                    "description": "JSON object with metadata fields to update",
                    "format": "json"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": {
                      "results": {
                        "id": "123e4567-e89b-12d3-a456-426614174000",
                        "collection_ids": [
                          "123e4567-e89b-12d3-a456-426614174000"
                        ],
                        "owner_id": "123e4567-e89b-12d3-a456-426614174000",
                        "document_type": "pdf",
                        "metadata": {
                          "title": "Sample Document"
                        },
                        "version": "1.0",
                        "title": "Sample Document",
                        "size_in_bytes": 123456,
                        "ingestion_status": "pending",
                        "extraction_status": "pending",
                        "created_at": "2021-01-01T00:00:00Z",
                        "updated_at": "2021-01-01T00:00:00Z",
                        "ingestion_attempt_number": 0,
                        "summary": "A summary of the document",
                        "summary_embedding": [
                          0.1,
                          0.2,
                          0.3
                        ],
                        "total_tokens": 1000,
                        "chunks": [
                          {
                            "key": "value"
                          }
                        ]
                      }
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "123e4567-e89b-12d3-a456-426614174000"
                        },
                        "collection_ids": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "example": "123e4567-e89b-12d3-a456-426614174000"
                          }
                        },
                        "owner_id": {
                          "type": "string",
                          "example": "123e4567-e89b-12d3-a456-426614174000"
                        },
                        "document_type": {
                          "type": "string",
                          "example": "pdf"
                        },
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "title": {
                              "type": "string",
                              "example": "Sample Document"
                            }
                          }
                        },
                        "version": {
                          "type": "string",
                          "example": "1.0"
                        },
                        "title": {
                          "type": "string",
                          "example": "Sample Document"
                        },
                        "size_in_bytes": {
                          "type": "integer",
                          "example": 123456,
                          "default": 0
                        },
                        "ingestion_status": {
                          "type": "string",
                          "example": "pending"
                        },
                        "extraction_status": {
                          "type": "string",
                          "example": "pending"
                        },
                        "created_at": {
                          "type": "string",
                          "example": "2021-01-01T00:00:00Z"
                        },
                        "updated_at": {
                          "type": "string",
                          "example": "2021-01-01T00:00:00Z"
                        },
                        "ingestion_attempt_number": {
                          "type": "integer",
                          "example": 0,
                          "default": 0
                        },
                        "summary": {
                          "type": "string",
                          "example": "A summary of the document"
                        },
                        "summary_embedding": {
                          "type": "array",
                          "items": {
                            "type": "number",
                            "example": 0.1,
                            "default": 0
                          }
                        },
                        "total_tokens": {
                          "type": "integer",
                          "example": 1000,
                          "default": 0
                        },
                        "chunks": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "example": "value"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": {}
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "422": {
            "description": "422",
            "content": {
              "text/plain": {
                "examples": {
                  "Result": {
                    "value": {
                      "detail": [
                        {
                          "loc": [
                            "string",
                            0
                          ],
                          "msg": "string",
                          "type": "string"
                        }
                      ]
                    }
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "loc": {
                            "type": "array"
                          },
                          "msg": {
                            "type": "string",
                            "example": "string"
                          },
                          "type": {
                            "type": "string",
                            "example": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "curl -X PATCH https://api.intelligence.io.solutions/api/r2r/v3/documents/{id}/metadata \\\n     -H \"Authorization: Bearer $IOINTELLIGENCE_API_KEY\" \\\n     -H \"Content-Type: application/json\" \\\n     -d '[\n  {\n    \"key\": \"value\"\n  }\n]'"
            },
            {
              "language": "python",
              "code": "from r2r import R2RClient\n\nclient = R2RClient()\n# when using auth, do client.login(...)\n\nresponse = client.documents.append_metadata(\n    id=\"9fbe403b-c11c-5aae-8ade-ef22980c3ad1\",\n    metadata=[{\"key\": \"new_key\", \"value\": \"new_value\"}]\n)"
            }
          ],
          "samples-languages": [
            "curl",
            "python"
          ]
        }
      }
    }
  }
}