# Patch Stream Connection

`PATCH /v1/streams/{connection_id}`

Rename a connection, point it at another agent, move it, or disable it.

Disabling refuses new calls immediately and is the only way to stop a URL
answering; calls already running are untouched. Changing `region` changes
the URL, which the partner must switch to.

Authenticate with `Authorization: Bearer $TALQING_API_KEY`. Errors use the shared envelope: https://docs.talqing.com/api-reference/errors.md

## OpenAPI

```json
{
 "openapi":"3.1.0",
 "servers":[
  {
   "description":"Talqing API",
   "url":"https://api.talqing.com"
  }
 ],
 "paths":{
  "/v1/streams/{connection_id}":{
   "patch":{
    "description":"Rename a connection, point it at another agent, move it, or disable it.\n\nDisabling refuses new calls immediately and is the only way to stop a URL\nanswering; calls already running are untouched. Changing `region` changes\nthe URL, which the partner must switch to.",
    "operationId":"telephony.streams.update",
    "parameters":[
     {
      "in":"path",
      "name":"connection_id",
      "required":true,
      "schema":{
       "format":"uuid",
       "title":"Connection Id",
       "type":"string"
      }
     }
    ],
    "requestBody":{
     "content":{
      "application/json":{
       "schema":{
        "$ref":"#/components/schemas/PatchStreamConnectionRequest"
       }
      }
     },
     "required":true
    },
    "responses":{
     "200":{
      "content":{
       "application/json":{
        "schema":{
         "$ref":"#/components/schemas/StreamConnectionResponse"
        }
       }
      },
      "description":"Successful Response"
     },
     "400":{
      "$ref":"#/components/responses/BadRequest"
     },
     "401":{
      "$ref":"#/components/responses/Unauthorized"
     },
     "403":{
      "$ref":"#/components/responses/Forbidden"
     },
     "404":{
      "$ref":"#/components/responses/NotFound"
     },
     "409":{
      "$ref":"#/components/responses/Conflict"
     },
     "422":{
      "$ref":"#/components/responses/ValidationFailed"
     },
     "default":{
      "$ref":"#/components/responses/Error"
     }
    },
    "security":[
     {
      "BearerAuth":[]
     },
     {
      "SessionCookie":[]
     }
    ],
    "summary":"Patch Stream Connection",
    "tags":[
     "telephony"
    ]
   }
  }
 },
 "components":{
  "responses":{
   "BadRequest":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Well-formed, but rejected by a rule; `detail.errors` lists each problem."
   },
   "Conflict":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"The resource's current state forbids this \u2014 a name already taken, a job already running."
   },
   "Error":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Unexpected error. Every error this API returns carries this body."
   },
   "Forbidden":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Authenticated, but this organization role may not perform the operation."
   },
   "NotFound":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"No such resource in this organization."
   },
   "Unauthorized":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Missing credential, or one that is revoked or no longer a member of this organization."
   },
   "ValidationFailed":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"The request did not match this operation's schema; `detail.errors` lists each field."
   }
  },
  "schemas":{
   "ErrorBody":{
    "description":"The structured half of our error contract: a human `message` plus a list\nof individual `errors` (used wherever we surface many problems at once,\nincluding tool publish, op-tree checks, and request validation). The global\nexception handlers normalize every API error to\n`{detail: {message, errors, code}}`, so SDKs can parse one shape consistently.",
    "properties":{
     "code":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "default":null,
      "description":"A stable identifier for this error, when it has one.",
      "title":"Code"
     },
     "errors":{
      "items":{
       "type":"string"
      },
      "title":"Errors",
      "type":"array"
     },
     "message":{
      "title":"Message",
      "type":"string"
     }
    },
    "required":[
     "message",
     "errors"
    ],
    "title":"ErrorBody",
    "type":"object"
   },
   "ErrorResponse":{
    "description":"The body of every error response, at every status code.",
    "properties":{
     "detail":{
      "$ref":"#/components/schemas/ErrorBody"
     }
    },
    "required":[
     "detail"
    ],
    "title":"ErrorResponse",
    "type":"object"
   },
   "PatchStreamConnectionRequest":{
    "properties":{
     "agent_id":{
      "format":"uuid",
      "title":"Agent Id",
      "type":"string"
     },
     "name":{
      "maxLength":120,
      "minLength":1,
      "title":"Name",
      "type":"string"
     },
     "region":{
      "enum":[
       "us",
       "in"
      ],
      "title":"Region",
      "type":"string"
     },
     "status":{
      "enum":[
       "active",
       "disabled"
      ],
      "title":"Status",
      "type":"string"
     }
    },
    "title":"PatchStreamConnectionRequest",
    "type":"object"
   },
   "StreamConnectionResponse":{
    "description":"One connection, as a caller sees it.\n\n`url` is the whole configuration a partner needs, in full, on every read: it\ncarries no credential, so there is nothing here to mask and nothing to show\nonce and never again.",
    "properties":{
     "agent_id":{
      "format":"uuid",
      "title":"Agent Id",
      "type":"string"
     },
     "agent_name":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Agent Name"
     },
     "created_at":{
      "format":"date-time",
      "title":"Created At",
      "type":"string"
     },
     "dialect":{
      "enum":[
       "twilio",
       "sparktg",
       "plivo",
       "exotel",
       "vonage"
      ],
      "title":"Dialect",
      "type":"string"
     },
     "id":{
      "format":"uuid",
      "title":"Id",
      "type":"string"
     },
     "name":{
      "title":"Name",
      "type":"string"
     },
     "readiness":{
      "enum":[
       "live",
       "needs_agent",
       "disabled"
      ],
      "title":"Readiness",
      "type":"string"
     },
     "region":{
      "enum":[
       "us",
       "in"
      ],
      "title":"Region",
      "type":"string"
     },
     "status":{
      "enum":[
       "active",
       "disabled"
      ],
      "title":"Status",
      "type":"string"
     },
     "updated_at":{
      "format":"date-time",
      "title":"Updated At",
      "type":"string"
     },
     "url":{
      "title":"Url",
      "type":"string"
     }
    },
    "required":[
     "id",
     "name",
     "dialect",
     "agent_id",
     "agent_name",
     "status",
     "readiness",
     "region",
     "url",
     "created_at",
     "updated_at"
    ],
    "title":"StreamConnectionResponse",
    "type":"object"
   }
  }
 }
}
```
