openapi: 3.0.3
info:
  title: naturali.ai — Installs API
  version: 1.0.0
  description: >
    Installs: the listings a project uses. Installing a listing lets the
    project name its tool or agent like one of its own, in an agent, an
    ingestion rule or a direct call. Each call runs on the publisher's
    configuration, and its records and usage stay in the installing project.

    Find listings in the marketplace
    ([`GET /v1/listings`](/docs/api/listings/list-public-listings)).
  contact:
    name: naturali.ai
    url: https://naturali.ai
servers:
  - url: '{baseUrl}'
    description: Host of your naturali.ai deployment; every path carries the /v1 prefix.
    variables:
      baseUrl:
        description: Base host URL.
        default: https://api.naturali.ai
tags:
  - name: Installs
    description: Install listings into a project, and remove them.
security:
  - bearerAuth: []
  - oauth2:
      - mcp:access
paths:
  /v1/projects/{project_id}/installs:
    parameters:
      - $ref: '#/components/parameters/ProjectId'
    get:
      tags: [Installs]
      summary: List installs
      description: The listings the project installed, newest first.
      operationId: listInstalls
      parameters:
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Cursor'
      responses:
        '200':
          description: A page of installs.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstallList'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    post:
      tags: [Installs]
      summary: Install a listing
      description: >
        Install a listing by its id. A listed entry, a draft and a listing in
        review all install; a suspended one answers `409 listing_suspended`.
        Installing again answers the existing install.

        After the publisher removed this project's access, installing answers
        `403 install_blocked`.
      operationId: createInstall
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InstallCreate'
      responses:
        '200':
          description: The project had already installed the listing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Install'
        '201':
          description: Listing installed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Install'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/InstallConflict'
  /v1/projects/{project_id}/installs/{install_id}:
    parameters:
      - $ref: '#/components/parameters/ProjectId'
      - $ref: '#/components/parameters/InstallId'
    get:
      tags: [Installs]
      summary: Get an install
      description: One of the project's installs.
      operationId: getInstall
      responses:
        '200':
          description: The install.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Install'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      tags: [Installs]
      summary: Uninstall a listing
      description: >
        Remove the install. While the project's agents, ingestion rules or
        other resources still name the installed resource, this answers `409
        install_in_use` with them in `details.references`; `force=true`
        uninstalls anyway and those resources stop reaching it.

        A `blocked` install, and the install managed conversion uses, answer
        `403`.
      operationId: deleteInstall
      parameters:
        - name: force
          in: query
          required: false
          description: Uninstall even while resources still use it.
          schema:
            type: boolean
            default: false
      responses:
        '204':
          description: Uninstalled.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/InstallConflict'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A naturali API key (nat_sk_…) or a session JWT.
    oauth2:
      type: oauth2
      description: >-
        A connected app's OAuth access token, issued by this API's authorization
        server (discovery: /.well-known/oauth-authorization-server). Its one scope
        carries every operation, confined to the projects the user chose when
        approving the app.
      flows:
        authorizationCode:
          authorizationUrl: https://api.naturali.ai/authorize
          tokenUrl: https://api.naturali.ai/token
          refreshUrl: https://api.naturali.ai/token
          scopes:
            mcp:access: Every operation this API serves, on the projects the grant covers.
  parameters:
    Limit:
      name: limit
      in: query
      required: false
      description: Maximum items per page — an integer from 1 to 100 (default 20).
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 20
    Cursor:
      name: cursor
      in: query
      required: false
      description: Opaque pagination cursor from a previous response's next_cursor.
      schema:
        type: string
    ProjectId:
      name: project_id
      in: path
      required: true
      description: Project public ID (proj_ prefix).
      schema:
        type: string
        example: proj_V1StGXR8Z5jdHi6B
    InstallId:
      name: install_id
      in: path
      required: true
      description: Install public ID (ins_ prefix).
      schema:
        type: string
        example: ins_V1StGXR8Z5jdHi6B
  responses:
    Unauthorized:
      description: Missing or invalid credentials.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: >-
        The credential is scoped to a different project, or the caller's role in
        the project does not carry this action.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: The resource does not exist (existence is not leaked).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    BadRequest:
      description: The request was malformed or failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InstallConflict:
      description: >
        `listing_suspended` (the listing cannot be installed while suspended)
        or `install_in_use` (resources still name the installed resource;
        `details.references` lists them).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  schemas:
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          description: >-
            Structured error. Every error response uses this shape, so `code` can
            be read without first checking the type of `error`.
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: >-
                Machine-readable error code: lower_snake for an error naturali
                raises (`access_denied`), UPPER_SNAKE for one the runtime reports
                (`RESOURCE_NOT_FOUND`).
              example: access_denied
            message:
              type: string
              description: Human-readable explanation.
              example: Your role in this project does not carry this action.
            details:
              type: object
              additionalProperties: true
              description: >-
                Structured context for an error naturali raises, such as the
                `resource` and `limit` of a `plan_limit_reached`.
            meta:
              type: object
              description: Structured context for an error the runtime reports.
    Install:
      type: object
      description: A listing installed in a project.
      properties:
        id:
          type: string
          example: ins_V1StGXR8Z5jdHi6B
        project_id:
          type: string
          description: The installing project.
          example: proj_6NgFz3xXy2kPq9Wd
        listing_id:
          type: string
          example: lst_V1StGXR8Z5jdHi6B
        resource_type:
          type: string
          enum: [tool, agent]
          example: tool
        resource_id:
          type: string
          description: The id the project names the installed resource by.
          example: tool_V1StGXR8Z5jdHi6B
        state:
          type: string
          enum: [active, suspended, blocked]
          description: >
            `active` while usable, `suspended` while its listing is, `blocked`
            after the publisher removed the project's access.
          example: active
        installed_at:
          type: string
          format: date-time
          example: '2026-10-01T00:00:00.000Z'
        updated_at:
          type: string
          format: date-time
          example: '2026-10-01T00:00:00.000Z'
      required:
        - id
        - project_id
        - listing_id
        - resource_type
        - resource_id
        - state
        - installed_at
        - updated_at
    InstallList:
      type: object
      required: [data, next_cursor]
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Install'
        next_cursor:
          type: string
          nullable: true
          description: Cursor for the next page, or null when there are no more.
          example: null
    InstallCreate:
      type: object
      additionalProperties: false
      required: [listing_id]
      properties:
        listing_id:
          type: string
          minLength: 1
          example: lst_V1StGXR8Z5jdHi6B
