openapi: 3.0.0
paths:
  /:
    get:
      operationId: AppController_root
      parameters: []
      responses:
        '200':
          description: ''
  /api/v1/settings:
    get:
      operationId: AppSettingsController_settings
      parameters: []
      responses:
        '200':
          description: ''
  /api/v1/sdk/settings:
    get:
      operationId: AppSettingsController_sdkSettings
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
  /api/v1/ai/ontology:
    post:
      operationId: AiController_getOntology
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OntologyFilterDto'
      responses:
        '200':
          description: ''
      tags: &ref_0
        - AI
      security:
        - bearer: []
  /api/v1/ai/ontology/md:
    post:
      operationId: AiController_getOntologyMarkdown
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OntologyFilterDto'
      responses:
        '200':
          description: ''
      tags: *ref_0
      security:
        - bearer: []
  /api/v1/ai/indexes:
    get:
      operationId: AiController_getIndexes
      parameters: []
      responses:
        '200':
          description: ''
      tags: *ref_0
      security:
        - bearer: []
    post:
      operationId: AiController_createIndex
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEmbeddingIndexDto'
      responses:
        '201':
          description: ''
      tags: *ref_0
      security:
        - bearer: []
  /api/v1/ai/indexes/{id}:
    delete:
      operationId: AiController_deleteIndex
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '202':
          description: ''
      tags: *ref_0
      security:
        - bearer: []
  /api/v1/ai/indexes/{id}/stats:
    get:
      operationId: AiController_getIndexStats
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: *ref_0
      security:
        - bearer: []
  /api/v1/ai/indexes/{id}/vectors/upsert:
    post:
      operationId: AiController_upsertIndexVectors
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertIndexVectorsDto'
      responses:
        '200':
          description: ''
      tags: *ref_0
      security:
        - bearer: []
  /api/v1/ai/search:
    post:
      operationId: AiController_semanticSearch
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SemanticSearchDto'
      responses:
        '200':
          description: ''
      tags: *ref_0
      security:
        - bearer: []
  /api/v1/records/{entityId}:
    get:
      operationId: EntityController_getById
      parameters:
        - name: entityId
          required: true
          in: path
          description: entity identifier (UUIDv7)
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: &ref_1
        - Records
      security:
        - bearer: []
    patch:
      operationId: EntityController_update
      parameters:
        - name: entityId
          required: true
          in: path
          description: entity identifier (UUIDv7)
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditEntityDto'
      responses:
        '201':
          description: ''
      tags: *ref_1
      security:
        - bearer: []
    put:
      operationId: EntityController_set
      parameters:
        - name: entityId
          required: true
          in: path
          description: entity identifier (UUIDv7)
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditEntityDto'
      responses:
        '201':
          description: ''
      tags: *ref_1
      security:
        - bearer: []
    delete:
      operationId: EntityController_deleteById
      parameters:
        - name: entityId
          required: true
          in: path
          description: entity identifier (UUIDv7)
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: *ref_1
      security:
        - bearer: []
  /api/v1/records:
    post:
      operationId: EntityController_create
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEntityDto'
      responses:
        '201':
          description: ''
      tags: *ref_1
      security:
        - bearer: []
  /api/v1/records/delete:
    post:
      operationId: EntityController_delete
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchDto'
      responses:
        '201':
          description: ''
      tags: *ref_1
      security:
        - bearer: []
  /api/v1/records/search:
    post:
      operationId: EntityController_find
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchDto'
      responses:
        '200':
          description: ''
      tags: *ref_1
      security:
        - bearer: []
  /api/v1/records/{entityId}/search:
    post:
      operationId: EntityController_findFromId
      parameters:
        - name: entityId
          required: true
          in: path
          description: entity identifier (UUIDv7)
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchDto'
      responses:
        '200':
          description: ''
      tags: *ref_1
      security:
        - bearer: []
  /api/v1/labels/search:
    post:
      operationId: LabelsController_labelsSearch
      parameters: []
      responses:
        '200':
          description: ''
      tags:
        - Labels
      security:
        - bearer: []
  /api/v1/relationships/{entityId}:
    post:
      operationId: RelationshipsController_attach
      parameters:
        - name: entityId
          required: true
          in: path
          description: entity identifier (UUIDv7)
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AttachDto'
      responses:
        '201':
          description: ''
      tags: &ref_2
        - Relationships
      security:
        - bearer: []
    put:
      operationId: RelationshipsController_detach
      parameters:
        - name: entityId
          required: true
          in: path
          description: entity identifier (UUIDv7)
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DetachDto'
      responses:
        '200':
          description: ''
      tags: *ref_2
      security:
        - bearer: []
  /api/v1/relationships/create-many:
    post:
      operationId: RelationshipsController_createMany
      parameters: []
      responses:
        '201':
          description: ''
      tags: *ref_2
      security:
        - bearer: []
  /api/v1/relationships/search:
    post:
      operationId: RelationshipsController_findRelations
      parameters:
        - name: skip
          required: true
          in: query
          schema:
            type: number
        - name: limit
          required: true
          in: query
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchDto'
      responses:
        '200':
          description: ''
      tags: *ref_2
      security:
        - bearer: []
  /api/v1/relationships/delete-many:
    post:
      operationId: RelationshipsController_deleteMany
      parameters: []
      responses:
        '200':
          description: ''
      tags: *ref_2
      security:
        - bearer: []
  /api/v1/billing/payment/create-session:
    post:
      operationId: BillingController_createCheckoutSession
      parameters: []
      responses:
        '201':
          description: ''
      security:
        - bearer: []
  /api/v1/billing/payment/create-portal-session:
    post:
      operationId: BillingController_createPortalSession
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
  /api/v1/billing/payment/usage:
    get:
      operationId: BillingController_getUsage
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
  /api/v1/billing/payment/ku-history:
    get:
      operationId: BillingController_getKuHistory
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
  /api/v1/billing/payment/inquiry:
    post:
      operationId: BillingController_submitInquiry
      parameters: []
      responses:
        '200':
          description: ''
      security:
        - bearer: []
  /api/v1/properties/search:
    post:
      operationId: PropertyController_listProperties
      parameters: []
      responses:
        '200':
          description: ''
      tags: &ref_3
        - Properties
      security:
        - bearer: []
  /api/v1/properties/{propertyId}/values:
    post:
      operationId: PropertyController_getPropertyValues
      parameters:
        - name: propertyId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: *ref_3
      security:
        - bearer: []
  /api/v1/properties/{propertyId}:
    get:
      operationId: PropertyController_findById
      parameters:
        - name: propertyId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: *ref_3
      security:
        - bearer: []
    delete:
      operationId: PropertyController_deleteField
      parameters:
        - name: propertyId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: *ref_3
      security:
        - bearer: []
  /api/v1/tx:
    post:
      operationId: TransactionController_create
      parameters: []
      responses:
        '200':
          description: ''
      tags: &ref_4
        - Transactions
      security:
        - bearer: []
  /api/v1/tx/{txId}:
    get:
      operationId: TransactionController_read
      parameters:
        - name: txId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: *ref_4
      security:
        - bearer: []
  /api/v1/tx/{txId}/rollback:
    post:
      operationId: TransactionController_rollback
      parameters:
        - name: txId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: *ref_4
      security:
        - bearer: []
  /api/v1/tx/{txId}/commit:
    post:
      operationId: TransactionController_commit
      parameters:
        - name: txId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: *ref_4
      security:
        - bearer: []
  /api/v1/records/import/json:
    post:
      operationId: ImportController_collectJson
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportJsonDto'
      responses:
        '201':
          description: ''
      tags: &ref_5
        - Records
      security:
        - bearer: []
  /api/v1/records/import/csv:
    post:
      operationId: ImportController_collectCsv
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportCsvDto'
      responses:
        '201':
          description: ''
      tags: *ref_5
      security:
        - bearer: []
  /api/v1/records/export/csv:
    post:
      operationId: ExportController_exportCsv
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchDto'
      responses:
        '200':
          description: ''
      tags:
        - Records
      security:
        - bearer: []
  /api/v1/query/records/find:
    post:
      operationId: QueryController_find
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchDto'
      responses:
        '200':
          description: ''
      tags: &ref_6
        - Query
      security:
        - bearer: []
  /api/v1/query/raw:
    post:
      operationId: QueryController_runCypher
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CypherDto'
      responses:
        '200':
          description: ''
      tags: *ref_6
      security:
        - bearer: []
  /.well-known/oauth-authorization-server:
    get:
      operationId: WellKnownController_getAuthorizationServerMetadata
      summary: OAuth 2.0 Authorization Server Metadata (RFC 8414)
      parameters: []
      responses:
        '200':
          description: ''
      tags: &ref_7
        - OAuth Discovery
  /.well-known/oauth-protected-resource:
    get:
      operationId: WellKnownController_getProtectedResourceMetadata
      summary: OAuth 2.0 Protected Resource Metadata
      parameters: []
      responses:
        '200':
          description: ''
      tags: *ref_7
  /.well-known/jwks.json:
    get:
      operationId: WellKnownController_getJwks
      summary: JSON Web Key Set (JWKS) for OAuth access-token verification
      parameters: []
      responses:
        '200':
          description: ''
      tags: *ref_7
  /oauth/register:
    post:
      operationId: OAuthController_registerClient
      summary: Dynamic Client Registration (RFC 7591)
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegisterClientDto'
      responses:
        '201':
          description: ''
      tags: &ref_8
        - OAuth 2.1
  /oauth/authorize:
    get:
      operationId: OAuthController_authorize
      summary: OAuth 2.1 Authorization endpoint — redirects to consent UI
      parameters:
        - name: response_type
          required: true
          in: query
          schema:
            type: string
        - name: client_id
          required: true
          in: query
          schema:
            type: string
        - name: redirect_uri
          required: true
          in: query
          schema:
            type: string
        - name: scope
          required: true
          in: query
          schema:
            type: string
        - name: code_challenge
          required: true
          in: query
          schema:
            type: string
        - name: code_challenge_method
          required: true
          in: query
          schema:
            type: string
        - name: state
          required: true
          in: query
          schema:
            type: string
        - name: resource
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: *ref_8
  /oauth/authorize/request/{authRequestId}:
    get:
      operationId: OAuthController_getAuthRequestInfo
      summary: Get authorization request metadata for consent UI
      parameters:
        - name: authRequestId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: *ref_8
  /oauth/authorize/accept:
    post:
      operationId: OAuthController_acceptAuthorization
      summary: Submit user consent and receive redirect URL with authorization code
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthorizeAcceptDto'
      responses:
        '201':
          description: ''
      tags: *ref_8
  /oauth/authorize/deny:
    post:
      operationId: OAuthController_denyAuthorization
      summary: Deny an authorization request and redirect back with access_denied error
      parameters: []
      responses:
        '201':
          description: ''
      tags: *ref_8
  /oauth/token:
    post:
      operationId: OAuthController_token
      summary: Token endpoint (RFC 6749 / RFC 8693)
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TokenRequestDto'
      responses:
        '201':
          description: ''
      tags: *ref_8
  /oauth/consents:
    get:
      operationId: OAuthController_listConsents
      summary: List OAuth consents for the authenticated user
      parameters: []
      responses:
        '200':
          description: ''
      tags: *ref_8
  /oauth/consents/{consentId}:
    delete:
      operationId: OAuthController_revokeConsent
      summary: Revoke an OAuth consent
      parameters:
        - name: consentId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: *ref_8
info:
  title: RushDB API
  description: RushDB API specs
  version: '1.0'
  contact: {}
tags: []
servers: []
components:
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
  schemas:
    OntologyFilterDto:
      type: object
      properties: {}
    CreateEmbeddingIndexDto:
      type: object
      properties:
        propertyName:
          type: string
          example: description
          description: Name of the property to embed
        label:
          type: string
          example: Book
          description: Neo4j label to scope this index to (e.g. "Book", "Task")
        sourceType:
          type: string
          example: managed
          enum:
            - managed
            - external
          description: Whether RushDB generates embeddings or the client provides them
        external:
          type: boolean
          example: true
          description: >-
            Shorthand for sourceType: 'external'. When true, RushDB expects the
            client to provide vectors.
        similarityFunction:
          type: string
          example: cosine
          enum:
            - cosine
            - euclidean
          description: Similarity function for the vector index
        dimensions:
          type: number
          example: 1536
          description: >-
            Vector dimensions. Defaults to the configured provider dimensions
            for managed indexes.
      required:
        - propertyName
        - label
    UpsertIndexVectorsDto:
      type: object
      properties: {}
    SemanticSearchDto:
      type: object
      properties: {}
    PropertyDto:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        type:
          type: string
        value:
          type: object
        valueSeparator:
          type: string
        metadata:
          type: string
      required:
        - name
        - type
    InlineVectorEntryDto:
      type: object
      properties: {}
    CreateEntityDto:
      type: object
      properties:
        label:
          type: string
          default: ''
        properties:
          type: array
          items:
            $ref: '#/components/schemas/PropertyDto'
        options:
          type: object
        vectors:
          description: Inline vectors for external embedding indexes
          type: array
          items:
            $ref: '#/components/schemas/InlineVectorEntryDto'
      required:
        - label
    EditEntityDto:
      type: object
      properties:
        label:
          type: string
          default: ''
        properties:
          type: array
          items:
            $ref: '#/components/schemas/PropertyDto'
        vectors:
          description: Inline vectors for external embedding indexes
          type: array
          items:
            $ref: '#/components/schemas/InlineVectorEntryDto'
    SearchDto:
      type: object
      properties:
        limit:
          type: number
          default: 100
        skip:
          type: number
          default: 0
        orderBy:
          type: object
        where:
          type: object
          default: {}
        select:
          type: object
          default: {}
        aggregate:
          type: object
          default: {}
          deprecated: true
        labels:
          default: []
          type: array
          items:
            type: string
        groupBy:
          default: []
          type: array
          items:
            type: string
    AttachDto:
      type: object
      properties:
        targetIds:
          type: object
        type:
          type: string
        direction:
          type: string
      required:
        - targetIds
    DetachDto:
      type: object
      properties:
        targetIds:
          type: object
        typeOrTypes:
          type: object
        direction:
          type: string
      required:
        - targetIds
    ImportJsonDto:
      type: object
      properties:
        parentId:
          type: string
        data:
          type: object
          default: {}
        format:
          type: string
          enum:
            - json
            - jsonl
            - ndjson
          description: Optional hint for text payload parsing when `data` is a string.
        label:
          type: string
          default: ''
        options:
          type: object
          default: {}
    ImportCsvDto:
      type: object
      properties:
        parentId:
          type: string
        data:
          type: string
          default: ''
        label:
          type: string
          default: ''
        options:
          type: object
          default: {}
        parseConfig:
          type: object
          description: CSV parse config (allowed subset)
          default:
            delimiter: ','
            header: true
            skipEmptyLines: true
        vectors:
          description: >-
            Per-row inline vectors for external embedding indexes. vectors[i] is
            applied to CSV row i (0-based, after header).
          items:
            type: array
          type: array
      required:
        - data
    CypherDto:
      type: object
      properties: {}
    RegisterClientDto:
      type: object
      properties:
        redirect_uris:
          example:
            - https://chatgpt.com/connector_platform_oauth_redirect
          type: array
          items:
            type: string
        client_name:
          type: string
          example: ChatGPT
        token_endpoint_auth_method:
          type: string
          enum:
            - none
          default: none
        application_type:
          type: string
          enum:
            - web
            - native
          default: web
      required:
        - redirect_uris
    AuthorizeAcceptDto:
      type: object
      properties:
        auth_request_id:
          type: string
          example: oa_req_...
        project_id:
          type: string
          example: proj_019c90d5-...
        scope:
          type: string
          example: records:read
          description: >-
            Space-separated list of scopes to grant. Defaults to all requested
            scopes.
      required:
        - auth_request_id
        - project_id
    TokenRequestDto:
      type: object
      properties:
        grant_type:
          type: string
          example: authorization_code
          description: >-
            OAuth grant type. Supported: authorization_code,
            urn:ietf:params:oauth:grant-type:token-exchange
        code:
          type: string
          example: oa_code_...
        redirect_uri:
          type: string
          example: https://chatgpt.com/connector_platform_oauth_redirect
        client_id:
          type: string
          example: oauthc_...
        code_verifier:
          type: string
          description: PKCE code verifier (RFC 7636)
        resource:
          type: string
          example: https://api.rushdb.com
        subject_token:
          type: string
        subject_token_type:
          type: string
          example: urn:ietf:params:oauth:token-type:access_token
        requested_token_type:
          type: string
          example: urn:ietf:params:oauth:token-type:access_token
        project_id:
          type: string
          example: proj_1
          description: Target project for token exchange
      required:
        - grant_type
