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

# Archive a protocol

> Requires role integrator or admin. Returns 409 if it has active enrollments.



## OpenAPI

````yaml /openapi/openapi-olivia-en.yaml delete /v1/protocols/{idOrKey}
openapi: 3.1.0
info:
  title: OlivIA API
  version: 0.1.0
  description: >
    OlivIA external API — Omniloy's clinical voice follow-up platform. It lets
    an external system (EHR/HIS, CRM, or your own backend):

    - Follow-up (outbound calls): enroll patients in a protocol so OlivIA calls
    them to complete a questionnaire.

    - Triage (inbound calls): results of triage calls are read through these
    same read endpoints.

    - Read results: questionnaires (protocol runs), answers, score, calls,
    transcript, and recording.

    Authentication uses a personal API key as a bearer token (`Authorization:
    Bearer oc_sk_...`). All routes are under the `/v1` prefix and responses wrap
    the payload in `data`.
servers:
  - url: https://{your-prod-endpoint}
    description: Production
    variables:
      your-prod-endpoint:
        default: your-prod-endpoint
        description: Replace this value with the real host before trying a request.
  - url: https://{your-dev-endpoint}
    description: Staging
    variables:
      your-dev-endpoint:
        default: your-dev-endpoint
        description: Replace this value with your staging host.
security:
  - bearerAuth: []
tags:
  - name: Protocols
    description: Read and archive protocols.
  - name: Enrollments
    description: Enroll patients and read enrollments (outbound follow-up).
  - name: Protocol Runs
    description: Protocol runs (questionnaire executions) and their results.
  - name: Calls
    description: Call detail, transcript, and recording.
paths:
  /v1/protocols/{idOrKey}:
    delete:
      tags:
        - Protocols
      summary: Archive a protocol
      description: >-
        Requires role integrator or admin. Returns 409 if it has active
        enrollments.
      operationId: delete-protocol
      parameters:
        - name: idOrKey
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Protocol archived
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProtocolResponse'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
components:
  schemas:
    ProtocolResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Protocol'
    Protocol:
      type: object
      properties:
        id:
          type: string
          format: uuid
        org_id:
          type: string
          format: uuid
        protocol_key:
          type: string
        title:
          type: string
        description:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - draft
            - active
            - archived
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details: {}
  responses:
    Forbidden:
      description: The key lacks the required role
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: State conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: oc_sk_ API key

````