> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clinia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bulk upsert or delete vocabularies

> Bulk upsert or delete vocabularies.
Bulk operations are processed synchronously.




## OpenAPI

````yaml /api-reference/terminology.yml post /terminology/v1/vocabularies/bulk
openapi: 3.0.1
info:
  title: Terminology API
  version: 1.0.0
servers:
  - url: https://api.{workspaceId}.clinia.cloud
    variables:
      workspaceId:
        default: ''
        description: The workspace id.
security:
  - apiKey: []
  - basicHttpAuth: []
  - bearerHttpAuth: []
tags:
  - name: Vocabularies
    description: Management of the vocabularies.
paths:
  /terminology/v1/vocabularies/bulk:
    post:
      tags:
        - Vocabularies
      summary: Bulk upsert or delete vocabularies
      description: |
        Bulk upsert or delete vocabularies.
        Bulk operations are processed synchronously.
      operationId: BulkVocabularies
      requestBody:
        description: >-
          The request body should contain a list of vocabularies to upsert or
          delete.
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - operations
              properties:
                operations:
                  type: array
                  items:
                    $ref: '#/components/schemas/v1VocabularyOperation'
              additionalProperties: false
      responses:
        '200':
          description: >
            The bulk operation is valid.

            Response contains the status of bulk request and status of each
            processed operation.

            Bulk request status will be `SUCCESS` if all operations are
            successful, otherwise `FAILURE`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1BulkVocabularyResponse'
        '400':
          description: Returned when the request is malformed or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1Error'
        '413':
          $ref: '#/components/responses/v1PayloadTooLargeError'
        '429':
          $ref: '#/components/responses/v1TooManyRequestError'
        '504':
          $ref: '#/components/responses/v1GatewayTimeoutError'
components:
  schemas:
    v1VocabularyOperation:
      oneOf:
        - $ref: '#/components/schemas/v1VocabularyOperationUpsert'
        - $ref: '#/components/schemas/v1VocabularyOperationDelete'
      discriminator:
        propertyName: action
        mapping:
          UPSERT:
            $ref: '#/components/schemas/v1VocabularyOperationUpsert'
          DELETE:
            $ref: '#/components/schemas/v1VocabularyOperationDelete'
    v1BulkVocabularyResponse:
      type: object
      required:
        - status
      properties:
        status:
          $ref: '#/components/schemas/v1OperationStatus'
          description: >
            The status of the bulk request. If one or more operations failed,
            the status will be `FAILURE`.
          readOnly: true
        receipts:
          type: array
          readOnly: true
          items:
            $ref: '#/components/schemas/v1VocabularyOperationReceipt'
          description: >
            In case of failure, receipts of the operations are returned. Every
            operation sent will have a receipt corresponding to their original
            order.

            Each receipt will contain the status of the operation and an error
            if the operation failed.
    v1Error:
      type: object
      required:
        - code
        - message
        - type
      properties:
        code:
          $ref: '#/components/schemas/v1ErrorCode'
        message:
          type: string
        type:
          $ref: '#/components/schemas/v1ErrorType'
        details:
          description: list of errors that occurred if applicable.
          type: array
          items:
            $ref: '#/components/schemas/v1Error'
        additionalContext:
          type: object
          additionalProperties: true
    v1VocabularyOperationUpsert:
      allOf:
        - $ref: '#/components/schemas/v1VocabularyOperationBase'
        - type: object
          required:
            - upsert
          properties:
            upsert:
              $ref: '#/components/schemas/v1Vocabulary'
    v1VocabularyOperationDelete:
      allOf:
        - $ref: '#/components/schemas/v1VocabularyOperationBase'
        - type: object
          required:
            - delete
          properties:
            delete:
              $ref: '#/components/schemas/v1VocabularyOperationDeleteContent'
    v1OperationStatus:
      type: string
      description: |
        Status of the operation.
          * `SUCCESS`: The operation was persisted in the source, or was dropped by a reject action of the user.
          * `PENDING`: The operation is being processed asyncronously by the system or is in a pipeline IN_REVIEW status.
          * `CANCELLED`: The operation was cancelled by the system due to a concurrent operation.
          * `FAILURE`: The operation failed due to validation or processing error.
      enum:
        - SUCCESS
        - PENDING
        - CANCELLED
        - FAILURE
    v1VocabularyOperationReceipt:
      type: object
      required:
        - status
        - key
      properties:
        key:
          type: string
          description: The Key of the vocabulary to upserted or deleted.
        status:
          $ref: '#/components/schemas/v1OperationStatus'
        error:
          $ref: '#/components/schemas/v1Error'
    v1ErrorCode:
      type: integer
      format: int32
      enum:
        - 400
        - 401
        - 403
        - 404
        - 408
        - 409
        - 413
        - 429
        - 500
        - 501
        - 504
    v1ErrorType:
      type: string
      enum:
        - ALREADY_EXISTS
        - FAILED_PRECONDITION
        - INTERNAL
        - INVALID_ARGUMENT
        - NOT_FOUND
        - OUT_OF_RANGE
        - UNIMPLEMENTED
        - PERMISSION_DENIED
        - UNAUTHENTICATED
        - CONTENT_TOO_LARGE
        - REQUEST_TIMEOUT
        - TOO_MANY_REQUEST
        - GATEWAY_TIMEOUT
    v1VocabularyOperationBase:
      type: object
      required:
        - action
      properties:
        action:
          $ref: '#/components/schemas/v1OperationAction'
    v1Vocabulary:
      type: object
      required:
        - key
        - title
        - description
      properties:
        key:
          type: string
        title:
          type: string
        description:
          type: string
    v1VocabularyOperationDeleteContent:
      type: object
      required:
        - key
      properties:
        key:
          type: string
          description: The Key of the vocabulary to delete.
    v1OperationAction:
      type: string
      enum:
        - CREATE
        - UPSERT
        - DELETE
        - UPDATE
      description: The action to perform.
  responses:
    v1PayloadTooLargeError:
      description: Returned when the payload exceeds the max content size (100kB).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/v1Error'
    v1TooManyRequestError:
      description: Returned when the server starts throttling the requests.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/v1Error'
    v1GatewayTimeoutError:
      description: Returned when the request exceeds the server timeout window.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/v1Error'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-Clinia-API-Key
    basicHttpAuth:
      description: Basic HTTP authentication.
      type: http
      scheme: basic
    bearerHttpAuth:
      description: JWT Bearer authentication.
      type: http
      scheme: Bearer
      bearerFormat: JWT

````