> ## 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.

# Purge operation request for resources or relationships

> Purge operation request for resources or relationships.




## OpenAPI

````yaml /api-reference/registry.yml post /sources/{sourceKey}/v1/purge
openapi: 3.0.1
info:
  title: Registry 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: Collections
    description: Management of collections in a registry.
  - name: Relationships
    description: Management of relationships in a registry.
  - name: Resources
    description: Management of resources in a registry.
paths:
  /sources/{sourceKey}/v1/purge:
    post:
      tags:
        - Purge
      summary: Purge operation request for resources or relationships
      description: |
        Purge operation request for resources or relationships.
      operationId: CreatePurgeOperation
      parameters:
        - name: sourceKey
          in: path
          description: The key of the source.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v1PurgeRequest'
      responses:
        '202':
          description: >-
            A successful response for a valid and accepted purge operation with
            status 'ACCEPTED'.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1PurgeResponse'
        '400':
          description: Returned when the request is malformed or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1RegistryError'
        '404':
          description: >-
            Returned when the source, collection type, or item type does not
            exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1RegistryError'
        '413':
          $ref: '#/components/responses/v1PayloadTooLargeError'
        '429':
          $ref: '#/components/responses/v1TooManyRequestError'
        '504':
          $ref: '#/components/responses/v1GatewayTimeoutError'
components:
  schemas:
    v1PurgeRequest:
      type: object
      required:
        - collectionType
        - collectionKey
      properties:
        collectionType:
          $ref: '#/components/schemas/v1CollectionType'
          description: Type of document, either relationships or resources.
        collectionKey:
          type: string
          description: Key of the resource or relationship collection.
    v1PurgeResponse:
      oneOf:
        - $ref: '#/components/schemas/v1PurgeAcceptedResponse'
      discriminator:
        propertyName: status
        mapping:
          ACCEPTED:
            $ref: '#/components/schemas/v1PurgeAcceptedResponse'
    v1RegistryError:
      allOf:
        - $ref: '#/components/schemas/v1Error'
        - type: object
          properties:
            code:
              $ref: '#/components/schemas/v1ErrorCode'
            applicationErrorCode:
              type: string
              enum:
                - REGISTRY_DUPLICATE_IDENTIFIER
                - REGISTRY_INVALID_COLLECTION_TYPE
                - REGISTRY_INVALID_CONTENT_TYPE
                - REGISTRY_INVALID_PIPELINE_STEP_DEFINITION
                - REGISTRY_INVALID_REQUEST_BODY
                - REGISTRY_INVALID_REVISION_ID
                - REGISTRY_PAYLOAD_PARSE_ERROR
                - REGISTRY_REQUIRED_FIELD_MISSING
                - REGISTRY_RESOURCE_TYPE_NOT_FOUND
                - REGISTRY_UNAVAILABLE_UPSTREAM_SERVICE
                - REGISTRY_BROWSE_SESSION_EXPIRED
                - REGISTRY_BULK_OPERATION_NOT_FOUND
                - REGISTRY_COLLECTION_NOT_FOUND
                - REGISTRY_CONTAINED_DEFINITION_NOT_FOUND
                - REGISTRY_PIPELINE_EXECUTION_NOT_FOUND
                - REGISTRY_PROFILE_NOT_FOUND
                - REGISTRY_PURGE_NOT_FOUND
                - REGISTRY_RELATIONSHIP_COLLECTION_NOT_FOUND
                - REGISTRY_RELATIONSHIP_DEFINITION_NOT_FOUND
                - REGISTRY_RELATIONSHIP_NOT_FOUND
                - REGISTRY_RESOURCE_NOT_FOUND
                - REGISTRY_RESOURCE_COLLECTION_NOT_FOUND
                - REGISTRY_SOURCE_NOT_FOUND
                - REGISTRY_TASK_NOT_FOUND
                - REGISTRY_VERSION_HISTORY_ITEM_NOT_FOUND
                - REGISTRY_REQUEST_CANCELLED
                - REGISTRY_REQUEST_TIMEOUT
                - REGISTRY_COLLECTION_ALREADY_EXISTS
                - REGISTRY_DUPLICATE_OPERATION_IN_BUNDLE
                - REGISTRY_IDENTIFIER_ALREADY_EXISTS
                - REGISTRY_RELATIONSHIP_ALREADY_EXISTS
                - REGISTRY_RELATIONSHIP_FROM_REF_ALREADY_EXISTS
                - REGISTRY_RELATIONSHIP_TO_REF_ALREADY_EXISTS
                - REGISTRY_RESOURCE_ALREADY_EXISTS
    v1CollectionType:
      type: string
      enum:
        - resources
        - relationships
    v1PurgeAcceptedResponse:
      allOf:
        - $ref: '#/components/schemas/v1TaskSubmissionAcceptedResponse'
        - type: object
          required:
            - purgeOperation
          properties:
            purgeOperation:
              $ref: '#/components/schemas/v1PurgeOperationReceipt'
              readOnly: true
    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
    v1ErrorCode:
      type: integer
      format: int32
      enum:
        - 400
        - 401
        - 403
        - 404
        - 408
        - 409
        - 413
        - 429
        - 500
        - 501
        - 504
    v1TaskSubmissionAcceptedResponse:
      allOf:
        - $ref: '#/components/schemas/v1BaseTaskSubmissionResponse'
      description: |
        Response when a task has been accepted for asynchronous processing.
        The task will be executed in the background.
    v1PurgeOperationReceipt:
      type: object
      required:
        - collectionType
        - collectionKey
        - taskId
        - purgeId
        - status
      properties:
        taskId:
          $ref: '#/components/schemas/v1TaskId'
          readOnly: true
        purgeId:
          description: >-
            ID of the purge operation. Deprecated, please use the taskId
            instead.
          type: string
          readOnly: true
        collectionType:
          $ref: '#/components/schemas/v1CollectionType'
          description: Type of document, either relationships or resources.
          readOnly: true
        collectionKey:
          type: string
          description: Key of the resource or relationship collection.
          readOnly: true
        status:
          $ref: '#/components/schemas/v1OperationStatus'
          description: Status of the purge operation.
          readOnly: true
        deletedCount:
          type: integer
          format: int64
          description: Number of documents deleted in case of success status.
          readOnly: true
        createdAt:
          type: string
          format: date-time
          readOnly: true
        updatedAt:
          type: string
          format: date-time
          readOnly: true
    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
    v1BaseTaskSubmissionResponse:
      type: object
      required:
        - status
        - taskId
      properties:
        taskId:
          $ref: '#/components/schemas/v1TaskId'
          readOnly: true
        status:
          $ref: '#/components/schemas/v1TaskSubmissionStatus'
          readOnly: true
    v1TaskId:
      type: string
      description: >
        The task identifier. Used to track an async task in the system. Use the
        task ID to poll for completion status.

        The taskId holds different prefix to represent different tasks.

        - oneOf task: `s_<id>`.

        - bulk task: `bk_<id>` (deprecated: `<id>` only).

        - bundle task: `bd_<id>` (deprecated: `<id>` only).

        - purge task: `pg_<id>` (deprecated: `purge:<id>`).
    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
    v1TaskSubmissionStatus:
      type: string
      description: >
        Status of the task submission.

        * `ACCEPTED`: The task has been accepted for asynchronous processing.
        The task will be executed in the background.

        * `PERSISTED`: The task has been executed synchronously and the results
        are immediately persisted.
      enum:
        - ACCEPTED
        - PERSISTED
  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

````