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

# Connect to External Ticket

> Connect an existing Serval ticket to an existing external ticket in a sync channel. This establishes ongoing bidirectional sync between the tickets without creating a new external ticket. The external ticket must already exist in the target system.



## OpenAPI

````yaml /sections/api-reference/openapi-spec-v2.yaml post /v2/tickets/{ticket_id}/connect
openapi: 3.1.0
info:
  title: Serval Public API
  description: Serval Public API
  contact:
    name: Serval
    url: https://serval.com
    email: support@serval.com
  license:
    name: Serval License
    url: https://serval.com/license
  version: 2.0.0
servers:
  - url: https://public.api.serval.com
security:
  - BearerAuth: []
tags:
  - name: Access Policy API
  - name: Access Policy Approval Procedure API
  - name: Access Profile API
  - name: Access Relationship API
  - name: Access Request API
  - name: Agent API
  - name: App Instance API
  - name: App Resource API
  - name: App Resource Role API
  - name: Approval Delegation API
  - name: Approval Request API
  - name: Audit Log API
  - name: Change Blackout API
  - name: Change Model API
  - name: Custom Field API
  - name: Custom Service API
  - name: Entity API
  - name: Entity Field Mapping API
  - name: Entity Ingestion Config API
  - name: Entity Type API
  - name: Folder API
  - name: Group API
  - name: Guidance API
  - name: Help Agent API
  - name: Journey API
  - name: Knowledge API
  - name: Knowledge Base API
  - name: Report API
  - name: SLA API
  - name: Schedule API
  - name: Tag API
  - name: Team API
  - name: Team User API
  - name: Ticket API
  - name: Topic API
  - name: User API
  - name: User Relationship API
  - name: Workflow API
  - name: Workflow Approval Procedure API
  - name: Workflow Run API
paths:
  /v2/tickets/{ticket_id}/connect:
    post:
      tags:
        - Ticket API
      summary: Connect to External Ticket
      description: >-
        Connect an existing Serval ticket to an existing external ticket in a
        sync channel. This establishes ongoing bidirectional sync between the
        tickets without creating a new external ticket. The external ticket must
        already exist in the target system.
      operationId: svrelay.publicv2.PublicAPIServiceV2.ConnectTicketToExternalTicket
      parameters:
        - name: ticket_id
          in: path
          required: true
          schema:
            type: string
            title: ticket_id
            description: The Serval ticket ID to connect
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                channelTarget:
                  $ref: '#/components/schemas/svhelp.pubapimodels.ChannelTarget'
                  title: channel_target
                  description: The channel containing the external ticket
                externalTicketId:
                  type: string
                  title: external_ticket_id
                  description: |-
                    The external ticket ID (format depends on the channel type):
                     - For Slack (slack_channel or slack_dm): MUST be in the format "channelId:threadTs"
                       Example: "C9DDYQ1B4:1779146751.061339"
                       where channelId is the Slack channel ID (e.g., "C9DDYQ1B4")
                       and threadTs is the Slack message timestamp (e.g., "1779146751.061339")
                     - For ServiceNow and other integrations: the sys_id or unique identifier
                       from the external system
                     This should be a globally unique identifier for the external ticket.
                externalTicketData:
                  $ref: '#/components/schemas/google.protobuf.Struct'
                  title: external_ticket_data
                  description: >-
                    Optional: Raw external ticket data/metadata to store with
                    the connection.
                     This should be the JSON-serialized external ticket object from the external system.
                     For ServiceNow, this should be the RequestedItem or Incident object.
                     If not provided, external links may not display correctly.
                  nullable: true
                externalTicketSubtype:
                  type: string
                  title: external_ticket_subtype
                  description: >-
                    Optional: Subtype of the external ticket within the
                    integration.
                     For ServiceNow, use "incident" or "requested_item" to specify the type.
                     This determines which sync handler is used for ongoing synchronization.
                  nullable: true
                accountedForMessageIds:
                  type: array
                  items:
                    type: string
                  title: accounted_for_message_ids
                  description: >-
                    Optional: Serval message IDs on this ticket to register as
                    already present
                     in the external ticket's channel. Registered messages are skipped by the
                     egresser, so they will not be re-sent to the external system after the
                     connection is established. Use this when you have already posted a summary
                     of the prior conversation to the external system and do not want the
                     individual historical messages replayed on top of it. Each message must
                     belong to this ticket.
              title: ConnectTicketToExternalTicketRequest
              additionalProperties: false
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/svhelp.publicapi.ConnectTicketToExternalTicketResponse
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/connect.error'
      security:
        - BearerAuth: []
components:
  schemas:
    svhelp.pubapimodels.ChannelTarget:
      type: object
      oneOf:
        - $ref: '#/components/schemas/svhelp.pubapimodels.ChannelTarget.Email'
        - $ref: '#/components/schemas/svhelp.pubapimodels.ChannelTarget.SlackChannel'
        - $ref: '#/components/schemas/svhelp.pubapimodels.ChannelTarget.SlackDm'
        - $ref: '#/components/schemas/svhelp.pubapimodels.ChannelTarget.TicketSource'
      title: ChannelTarget
      description: |-
        Unified channel target that works across all syncing scenarios.
         This is used by SyncTicketToChannel and ConnectTicketToExternalTicket endpoints.
    google.protobuf.Struct:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/google.protobuf.Value'
      description: |-
        `Struct` represents a structured data value, consisting of fields
         which map to dynamically typed values. In some languages, `Struct`
         might be supported by a native representation. For example, in
         scripting languages like JS a struct is represented as an
         object. The details of that representation are described together
         with the proto support for the language.

         The JSON representation for `Struct` is JSON object.
    svhelp.publicapi.ConnectTicketToExternalTicketResponse:
      type: object
      title: ConnectTicketToExternalTicketResponse
      additionalProperties: false
    connect.error:
      type: object
      properties:
        code:
          type: string
          examples:
            - not_found
          enum:
            - canceled
            - unknown
            - invalid_argument
            - deadline_exceeded
            - not_found
            - already_exists
            - permission_denied
            - resource_exhausted
            - failed_precondition
            - aborted
            - out_of_range
            - unimplemented
            - internal
            - unavailable
            - data_loss
            - unauthenticated
          description: >-
            The status code, which should be an enum value of
            [google.rpc.Code][google.rpc.Code].
          x-stainless-terraform-configurability: optional
        message:
          type: string
          description: >-
            A developer-facing error message, which should be in English. Any
            user-facing error message should be localized and sent in the
            [google.rpc.Status.details][google.rpc.Status.details] field, or
            localized by the client.
          x-stainless-terraform-configurability: optional
        detail:
          $ref: '#/components/schemas/google.protobuf.Any'
          x-stainless-terraform-configurability: optional
      title: Connect Error
      additionalProperties: true
      description: >-
        Error type returned by Connect:
        https://connectrpc.com/docs/go/errors/#http-representation
    svhelp.pubapimodels.ChannelTarget.Email:
      type: object
      title: Email
      properties:
        email:
          $ref: '#/components/schemas/svhelp.pubapimodels.EmailChannelTarget'
          title: email
          x-stainless-terraform-configurability: optional
      required:
        - email
      additionalProperties: false
    svhelp.pubapimodels.ChannelTarget.SlackChannel:
      type: object
      title: Slack Channel
      properties:
        slackChannel:
          $ref: '#/components/schemas/svhelp.pubapimodels.SlackChannelTarget'
          title: slack_channel
          x-stainless-terraform-configurability: optional
      required:
        - slackChannel
      additionalProperties: false
    svhelp.pubapimodels.ChannelTarget.SlackDm:
      type: object
      title: Slack Dm
      properties:
        slackDm:
          $ref: '#/components/schemas/svhelp.pubapimodels.SlackDMChannelTarget'
          title: slack_dm
          x-stainless-terraform-configurability: optional
      required:
        - slackDm
      additionalProperties: false
    svhelp.pubapimodels.ChannelTarget.TicketSource:
      type: object
      title: Ticket Source
      properties:
        ticketSource:
          $ref: '#/components/schemas/svhelp.pubapimodels.TicketSourceChannelTarget'
          title: ticket_source
          x-stainless-terraform-configurability: optional
      required:
        - ticketSource
      additionalProperties: false
    google.protobuf.Value:
      oneOf:
        - type: 'null'
        - type: number
        - type: string
        - type: boolean
        - type: array
        - type: object
          additionalProperties: true
      description: |-
        `Value` represents a dynamically typed value which can be either
         null, a number, a string, a boolean, a recursive struct value, or a
         list of values. A producer of value is expected to set one of these
         variants. Absence of any variant indicates an error.

         The JSON representation for `Value` is JSON value.
    google.protobuf.Any:
      type: object
      properties:
        type:
          type: string
          x-stainless-terraform-configurability: optional
        value:
          type: string
          format: binary
          x-stainless-terraform-configurability: optional
        debug:
          type: object
          additionalProperties: true
          x-stainless-terraform-configurability: optional
      additionalProperties: true
      description: >-
        Contains an arbitrary serialized message along with a @type that
        describes the type of the serialized message.
    svhelp.pubapimodels.EmailChannelTarget:
      type: object
      properties:
        targetUserType:
          $ref: '#/components/schemas/svhelp.pubapimodels.ChannelSyncTargetUserType'
          title: target_user_type
          description: Which user to send the email to
          x-stainless-terraform-configurability: optional
      title: EmailChannelTarget
      additionalProperties: false
      description: For Email channels - uses team email config (no integration needed)
    svhelp.pubapimodels.SlackChannelTarget:
      type: object
      properties:
        integrationId:
          type: string
          title: integration_id
          description: Integration ID that identifies the Slack app instance
          x-stainless-terraform-configurability: optional
        channelId:
          type: string
          title: channel_id
          description: >-
            The Slack channel ID (e.g., "C1234567890" for public, "G1234567890"
            for private)
          x-stainless-terraform-configurability: optional
      title: SlackChannelTarget
      additionalProperties: false
      description: >-
        For Slack channels (public or private) - link a ticket to a thread in a
        Slack channel.
         The channel must already be connected to Serval (i.e., Serval bot is in the channel
         and the channel is configured with a non-disabled mode).
    svhelp.pubapimodels.SlackDMChannelTarget:
      type: object
      properties:
        integrationId:
          type: string
          title: integration_id
          description: Integration ID that identifies the Slack app instance
          x-stainless-terraform-configurability: optional
        targetUserType:
          $ref: '#/components/schemas/svhelp.pubapimodels.ChannelSyncTargetUserType'
          title: target_user_type
          description: Which user to send the DM to
          x-stainless-terraform-configurability: optional
      title: SlackDMChannelTarget
      additionalProperties: false
      description: For Slack DM channels - need to specify which user to sync to
    svhelp.pubapimodels.TicketSourceChannelTarget:
      type: object
      properties:
        ticketSourceId:
          type: string
          title: ticket_source_id
          description: |-
            The ticket source ID from svflow - identifies which external system
             Deprecated: Use integration_id instead
          x-stainless-terraform-configurability: optional
        integrationId:
          type: string
          title: integration_id
          description: >-
            The integration ID - identifies which external system/integration to
            sync to
          x-stainless-terraform-configurability: optional
      title: TicketSourceChannelTarget
      additionalProperties: false
      description: >-
        For ticket source channels (Jira, ServiceNow, Linear, Zendesk,
        Freshservice, etc.)
    svhelp.pubapimodels.ChannelSyncTargetUserType:
      type: string
      title: ChannelSyncTargetUserType
      enum:
        - CHANNEL_SYNC_USER_TYPE_UNSPECIFIED
        - CHANNEL_SYNC_TARGET_USER_TICKET_ASSIGNEE
        - CHANNEL_SYNC_TARGET_USER_TICKET_REQUESTOR
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````