openapi: 3.0.0
info:
  title: Nuxeo REST API
  version: 2.0.0
  description: Nuxeo Content Repository REST API for Bedrock AgentCore Gateway

servers:
  - url: https://psdassets-test.churchofjesuschrist.org/nuxeo/api/v1
    description: Nuxeo Sandbox Server

paths:

  /me:
    get:
      summary: Get repository info
      description: Get information about the Nuxeo repository and current authenticated user
      operationId: getRepositoryInfo
      responses:
        '200':
          description: Server and user information
          content:
            application/json:
              schema:
                type: object

  /id/{docId}:
    get:
      summary: Get document by ID
      description: Retrieve a document by its unique identifier
      operationId: getDocumentById
      parameters:
        - name: docId
          in: path
          required: true
          description: Document UUID
          schema:
            type: string
      responses:
        '200':
          description: Document retrieved successfully
          content:
            application/json:
              schema:
                type: object
        '404':
          description: Document not found

    put:
      summary: Update document by ID
      description: Update properties of an existing document
      operationId: updateDocumentById
      parameters:
        - name: docId
          in: path
          required: true
          description: Document UUID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                entity-type:
                  type: string
                  default: document
                properties:
                  type: object
                  description: Document properties to update (e.g. {"dc:title":"New Title"})
              required:
                - entity-type
                - properties
      responses:
        '200':
          description: Document updated successfully
          content:
            application/json:
              schema:
                type: object

    delete:
      summary: Delete document by ID
      description: Delete a document from the repository
      operationId: deleteDocumentById
      parameters:
        - name: docId
          in: path
          required: true
          description: Document UUID
          schema:
            type: string
      responses:
        '204':
          description: Document deleted successfully

  /id/{docId}/children:
    get:
      summary: List children of a document
      description: List child documents of a folder by its UUID
      operationId: getChildrenById
      parameters:
        - name: docId
          in: path
          required: true
          description: Parent document UUID
          schema:
            type: string
        - name: pageSize
          in: query
          description: Number of results per page
          schema:
            type: integer
            default: 20
        - name: currentPageIndex
          in: query
          description: Page index (0-based)
          schema:
            type: integer
            default: 0
      responses:
        '200':
          description: List of child documents
          content:
            application/json:
              schema:
                type: object

  /path/{docPath}:
    get:
      summary: Get document by path
      description: Retrieve a document from Nuxeo by its path
      operationId: getDocumentByPath
      parameters:
        - name: docPath
          in: path
          required: true
          description: Document path without leading slash (e.g. default-domain/workspaces)
          schema:
            type: string
      responses:
        '200':
          description: Document retrieved successfully
          content:
            application/json:
              schema:
                type: object
        '404':
          description: Document not found

    post:
      summary: Create a document
      description: Create a new document under the specified parent path
      operationId: createDocument
      parameters:
        - name: docPath
          in: path
          required: true
          description: Parent folder path without leading slash (e.g. default-domain/workspaces)
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                entity-type:
                  type: string
                  default: document
                type:
                  type: string
                  description: Document type (e.g. File, Folder, Note)
                name:
                  type: string
                  description: Document name (used in path)
                properties:
                  type: object
                  description: Document properties (e.g. {"dc:title":"My Doc","dc:description":"..."})
              required:
                - entity-type
                - type
                - name
                - properties
      responses:
        '200':
          description: Document created successfully
          content:
            application/json:
              schema:
                type: object

  /search/lang/NXQL/execute:
    get:
      summary: Search documents with NXQL
      description: Execute an NXQL query to search for documents
      operationId: searchDocuments
      parameters:
        - name: query
          in: query
          required: true
          description: NXQL query string
          schema:
            type: string
            example: "SELECT * FROM Document WHERE dc:title LIKE '%test%'"
        - name: pageSize
          in: query
          description: Number of results per page
          schema:
            type: integer
            default: 20
        - name: currentPageIndex
          in: query
          description: Page index (0-based)
          schema:
            type: integer
            default: 0
      responses:
        '200':
          description: Search results
          content:
            application/json:
              schema:
                type: object

  /config/types:
    get:
      summary: Get document types
      description: Get all document types and schemas defined in the Nuxeo server
      operationId: getDocumentTypes
      responses:
        '200':
          description: Document types and schemas
          content:
            application/json:
              schema:
                type: object

  /config/schemas:
    get:
      summary: Get schemas
      description: Get detailed information about schemas defined in the Nuxeo server
      operationId: getSchemas
      responses:
        '200':
          description: Schema definitions
          content:
            application/json:
              schema:
                type: object

  /automation/{operationId}:
    post:
      summary: Execute automation operation
      description: Execute any Nuxeo Automation operation with optional input and parameters
      operationId: executeOperation
      parameters:
        - name: operationId
          in: path
          required: true
          description: The ID of the automation operation (e.g. Document.Move, Document.Copy)
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                input:
                  type: string
                  description: Input document reference (e.g. doc:/default-domain/workspaces/myDoc)
                params:
                  type: object
                  description: Operation parameters (varies per operation)
                context:
                  type: object
                  description: Operation context variables
      responses:
        '200':
          description: Operation result
          content:
            application/json:
              schema:
                type: object

components:
  schemas: {}
