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

# Detach Contact

> Removes a contact from a run that has not launched. Draft only: after launch the contact's conversation exists and may already have been called, so removing the link would be a half-truth. Cancel the run instead.

Removes a contact from a run that has not launched.

## Draft only

Detach works while the run is a `DRAFT` and returns `422` after that.

The reason is that launching mints a conversation per contact, and that conversation may already have been called. Removing the link afterwards would be a half-truth: the contact would vanish from the run while the record of their call, its recording and its analysis stayed behind, still carrying the run's id. [Cancel](/api-reference/runs/cancel-run) the run instead — that stops the dialling and leaves an honest record of what happened.

## Basic Usage

```
DELETE /runs/789e0123-.../contacts/contact-uuid
```

```json theme={null}
{ "totalContacts": 9 }
```

Detaching a contact that is not on the run is a `404`.

## Error Scenarios

* **404 Not Found**: the run does not exist, belongs to another company, or the contact is not attached to it
* **422 Unprocessable Entity**: the run has already launched
* **403 Forbidden**: the API key does not hold `write:runs`

## Related Resources

<CardGroup cols={2}>
  <Card title="Attach Contacts" icon="user-plus" href="/api-reference/runs/attach-run-contacts">
    Add contacts to the run
  </Card>

  <Card title="Cancel Run" icon="ban" href="/api-reference/runs/cancel-run">
    Stop a run that has already launched
  </Card>
</CardGroup>


## OpenAPI

````yaml DELETE /runs/{id}/contacts/{contactId}
openapi: 3.0.0
info:
  title: InstaView API
  description: |-
    InstaView API Documentation

    ## Authentication

    All endpoints require API key authentication using Bearer token:
    ```
    Authorization: Bearer sk_your_api_key_here
    ```

    ## API Key Management

    The API Key module provides comprehensive key management for:
    - **Direct Client Keys**: Company-scoped keys for your applications
    - **ATS Partner Keys**: Resource-scoped keys for ATS integrations

    ### Key Features
    - HMAC-SHA256 hashing for API key storage
    - Configurable rate limiting
    - Comprehensive audit logging
    - Company-level isolation
    - Resource scoping for ATS partners
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.instaview.sk
    description: Production API Gateway
security: []
tags: []
paths:
  /runs/{id}/contacts/{contactId}:
    delete:
      tags:
        - Runs
      summary: Detach a contact from a draft run
      description: >-
        Removes a contact from a run that has not launched. Draft only: after
        launch the contact's conversation exists and may already have been
        called, so removing the link would be a half-truth. Cancel the run
        instead.
      operationId: PublicRunsController_detachContact_v1
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
            format: uuid
        - name: contactId
          required: true
          in: path
          schema:
            type: string
            format: uuid
        - name: companyId
          required: false
          in: query
          description: >-
            Required for ATS API keys to specify which company to access.
            Ignored for standard company API keys.
          schema:
            type: string
      responses:
        '200':
          description: Contact detached
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicDetachRunContactResponseDto'
        '422':
          description: Unprocessable Entity - the run has already launched.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearer: []
components:
  schemas:
    PublicDetachRunContactResponseDto:
      type: object
      properties:
        totalContacts:
          type: number
          description: Contacts remaining on the run
          example: 9
      required:
        - totalContacts
    ErrorResponse:
      type: object
      properties:
        statusCode:
          type: integer
          example: 400
        message:
          type: string
          example: Validation failed
        error:
          type: string
          example: Bad Request
      required:
        - statusCode
        - message
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: API key for authentication using Bearer scheme

````