Codehooks · Capability

Codehooks Database REST API — Documents

Codehooks Database REST API — Documents. 9 operations. Lead operation: Codehooks List documents in a collection. Self-contained Naftiko capability covering one Codehooks business surface.

Run with Naftiko CodehooksDocuments

What You Can Do

GET
Listdocuments — Codehooks List documents in a collection
/v1/{collection}
POST
Createdocument — Codehooks Create a new document
/v1/{collection}
PATCH
Updatedocumentsbyquery — Codehooks Update multiple documents by query
/v1/{collection}/byquery
DELETE
Deletedocumentsbyquery — Codehooks Delete multiple documents by query
/v1/{collection}/byquery
GET
Countdocuments — Codehooks Count documents in a collection
/v1/{collection}/count
GET
Getdocument — Codehooks Get a document by ID
/v1/{collection}/{id}
PUT
Replacedocument — Codehooks Replace a document
/v1/{collection}/{id}
PATCH
Updatedocument — Codehooks Update a document
/v1/{collection}/{id}
DELETE
Deletedocument — Codehooks Delete a document
/v1/{collection}/{id}

MCP Tools

codehooks-list-documents-collection

Codehooks List documents in a collection

read-only idempotent
codehooks-create-new-document

Codehooks Create a new document

codehooks-update-multiple-documents-query

Codehooks Update multiple documents by query

idempotent
codehooks-delete-multiple-documents-query

Codehooks Delete multiple documents by query

idempotent
codehooks-count-documents-collection

Codehooks Count documents in a collection

read-only idempotent
codehooks-get-document-id

Codehooks Get a document by ID

read-only idempotent
codehooks-replace-document

Codehooks Replace a document

idempotent
codehooks-update-document

Codehooks Update a document

idempotent
codehooks-delete-document

Codehooks Delete a document

idempotent

Capability Spec

database-rest-documents.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Codehooks Database REST API — Documents
  description: 'Codehooks Database REST API — Documents. 9 operations. Lead operation: Codehooks List documents in a collection.
    Self-contained Naftiko capability covering one Codehooks business surface.'
  tags:
  - Codehooks
  - Documents
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    CODEHOOKS_API_KEY: CODEHOOKS_API_KEY
capability:
  consumes:
  - type: http
    namespace: database-rest-documents
    baseUri: https://{projectId}.api.codehooks.io/{space}
    description: Codehooks Database REST API — Documents business capability. Self-contained, no shared references.
    resources:
    - name: collection
      path: /{collection}
      operations:
      - name: listdocuments
        method: GET
        description: Codehooks List documents in a collection
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: collection
          in: path
          type: string
          description: The name of the collection to query
          required: true
        - name: q
          in: query
          type: string
          description: Advanced NoSQL JSON query object (URL-encoded). Supports MongoDB-like operators such as $gt, $gte,
            $lt, $lte, $ne, $in, $nin, $exists, $regex, $or, and $and.
        - name: h
          in: query
          type: string
          description: Query hints as a JSON object (URL-encoded). Supports fields, sort, skip, limit, and projection.
        - name: limit
          in: query
          type: integer
          description: Maximum number of documents to return
        - name: offset
          in: query
          type: integer
          description: Number of documents to skip in the result set
        - name: sort
          in: query
          type: string
          description: Comma-separated list of fields to sort by. Prefix with - for descending order.
        - name: fields
          in: query
          type: string
          description: Comma-separated list of fields to include in the response
      - name: createdocument
        method: POST
        description: Codehooks Create a new document
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: collection
          in: path
          type: string
          description: The name of the collection to add the document to
          required: true
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: collection-_byquery
      path: /{collection}/_byquery
      operations:
      - name: updatedocumentsbyquery
        method: PATCH
        description: Codehooks Update multiple documents by query
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: collection
          in: path
          type: string
          description: The name of the collection
          required: true
        - name: q
          in: query
          type: string
          description: NoSQL JSON query object (URL-encoded) to select documents to update.
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
      - name: deletedocumentsbyquery
        method: DELETE
        description: Codehooks Delete multiple documents by query
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: collection
          in: path
          type: string
          description: The name of the collection
          required: true
        - name: q
          in: query
          type: string
          description: NoSQL JSON query object (URL-encoded) to select documents to delete.
    - name: collection-_count
      path: /{collection}/_count
      operations:
      - name: countdocuments
        method: GET
        description: Codehooks Count documents in a collection
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: collection
          in: path
          type: string
          description: The name of the collection
          required: true
        - name: q
          in: query
          type: string
          description: Optional NoSQL JSON query object to filter the count
    - name: collection-id
      path: /{collection}/{id}
      operations:
      - name: getdocument
        method: GET
        description: Codehooks Get a document by ID
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: collection
          in: path
          type: string
          description: The name of the collection
          required: true
        - name: id
          in: path
          type: string
          description: The unique identifier of the document
          required: true
      - name: replacedocument
        method: PUT
        description: Codehooks Replace a document
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: collection
          in: path
          type: string
          description: The name of the collection
          required: true
        - name: id
          in: path
          type: string
          description: The unique identifier of the document
          required: true
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
      - name: updatedocument
        method: PATCH
        description: Codehooks Update a document
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: collection
          in: path
          type: string
          description: The name of the collection
          required: true
        - name: id
          in: path
          type: string
          description: The unique identifier of the document
          required: true
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
      - name: deletedocument
        method: DELETE
        description: Codehooks Delete a document
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: collection
          in: path
          type: string
          description: The name of the collection
          required: true
        - name: id
          in: path
          type: string
          description: The unique identifier of the document
          required: true
    authentication:
      type: bearer
      token: '{{env.CODEHOOKS_API_KEY}}'
  exposes:
  - type: rest
    namespace: database-rest-documents-rest
    port: 8080
    description: REST adapter for Codehooks Database REST API — Documents. One Spectral-compliant resource per consumed operation,
      prefixed with /v1.
    resources:
    - path: /v1/{collection}
      name: collection
      description: REST surface for collection.
      operations:
      - method: GET
        name: listdocuments
        description: Codehooks List documents in a collection
        call: database-rest-documents.listdocuments
        with:
          collection: rest.collection
          q: rest.q
          h: rest.h
          limit: rest.limit
          offset: rest.offset
          sort: rest.sort
          fields: rest.fields
        outputParameters:
        - type: object
          mapping: $.
      - method: POST
        name: createdocument
        description: Codehooks Create a new document
        call: database-rest-documents.createdocument
        with:
          collection: rest.collection
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/{collection}/byquery
      name: collection-byquery
      description: REST surface for collection-_byquery.
      operations:
      - method: PATCH
        name: updatedocumentsbyquery
        description: Codehooks Update multiple documents by query
        call: database-rest-documents.updatedocumentsbyquery
        with:
          collection: rest.collection
          q: rest.q
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: deletedocumentsbyquery
        description: Codehooks Delete multiple documents by query
        call: database-rest-documents.deletedocumentsbyquery
        with:
          collection: rest.collection
          q: rest.q
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/{collection}/count
      name: collection-count
      description: REST surface for collection-_count.
      operations:
      - method: GET
        name: countdocuments
        description: Codehooks Count documents in a collection
        call: database-rest-documents.countdocuments
        with:
          collection: rest.collection
          q: rest.q
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/{collection}/{id}
      name: collection-id
      description: REST surface for collection-id.
      operations:
      - method: GET
        name: getdocument
        description: Codehooks Get a document by ID
        call: database-rest-documents.getdocument
        with:
          collection: rest.collection
          id: rest.id
        outputParameters:
        - type: object
          mapping: $.
      - method: PUT
        name: replacedocument
        description: Codehooks Replace a document
        call: database-rest-documents.replacedocument
        with:
          collection: rest.collection
          id: rest.id
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
      - method: PATCH
        name: updatedocument
        description: Codehooks Update a document
        call: database-rest-documents.updatedocument
        with:
          collection: rest.collection
          id: rest.id
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: deletedocument
        description: Codehooks Delete a document
        call: database-rest-documents.deletedocument
        with:
          collection: rest.collection
          id: rest.id
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: database-rest-documents-mcp
    port: 9090
    transport: http
    description: MCP adapter for Codehooks Database REST API — Documents. One tool per consumed operation, routed inline through
      this capability's consumes block.
    tools:
    - name: codehooks-list-documents-collection
      description: Codehooks List documents in a collection
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: database-rest-documents.listdocuments
      with:
        collection: tools.collection
        q: tools.q
        h: tools.h
        limit: tools.limit
        offset: tools.offset
        sort: tools.sort
        fields: tools.fields
      outputParameters:
      - type: object
        mapping: $.
    - name: codehooks-create-new-document
      description: Codehooks Create a new document
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: database-rest-documents.createdocument
      with:
        collection: tools.collection
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: codehooks-update-multiple-documents-query
      description: Codehooks Update multiple documents by query
      hints:
        readOnly: false
        destructive: false
        idempotent: true
      call: database-rest-documents.updatedocumentsbyquery
      with:
        collection: tools.collection
        q: tools.q
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: codehooks-delete-multiple-documents-query
      description: Codehooks Delete multiple documents by query
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: database-rest-documents.deletedocumentsbyquery
      with:
        collection: tools.collection
        q: tools.q
      outputParameters:
      - type: object
        mapping: $.
    - name: codehooks-count-documents-collection
      description: Codehooks Count documents in a collection
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: database-rest-documents.countdocuments
      with:
        collection: tools.collection
        q: tools.q
      outputParameters:
      - type: object
        mapping: $.
    - name: codehooks-get-document-id
      description: Codehooks Get a document by ID
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: database-rest-documents.getdocument
      with:
        collection: tools.collection
        id: tools.id
      outputParameters:
      - type: object
        mapping: $.
    - name: codehooks-replace-document
      description: Codehooks Replace a document
      hints:
        readOnly: false
        destructive: false
        idempotent: true
      call: database-rest-documents.replacedocument
      with:
        collection: tools.collection
        id: tools.id
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: codehooks-update-document
      description: Codehooks Update a document
      hints:
        readOnly: false
        destructive: false
        idempotent: true
      call: database-rest-documents.updatedocument
      with:
        collection: tools.collection
        id: tools.id
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: codehooks-delete-document
      description: Codehooks Delete a document
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: database-rest-documents.deletedocument
      with:
        collection: tools.collection
        id: tools.id
      outputParameters:
      - type: object
        mapping: $.