# Get Attachment

`GET /v1/attachments/{attachment_id}`

One file a person sent, by its id, with a fresh link (it lives 1 hour).

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/attachments/{attachment_id}":{
   "get":{
    "description":"One file a person sent, by its id, with a fresh link (it lives 1 hour).",
    "operationId":"attachments.get",
    "parameters":[
     {
      "in":"path",
      "name":"attachment_id",
      "required":true,
      "schema":{
       "format":"uuid",
       "title":"Attachment Id",
       "type":"string"
      }
     }
    ],
    "responses":{
     "200":{
      "content":{
       "application/json":{
        "schema":{
         "discriminator":{
          "mapping":{
           "audio":"#/components/schemas/ConversationAudio",
           "contact":"#/components/schemas/ConversationContact",
           "document":"#/components/schemas/ConversationDocument",
           "file":"#/components/schemas/ConversationFile",
           "image":"#/components/schemas/ConversationImage"
          },
          "propertyName":"kind"
         },
         "oneOf":[
          {
           "$ref":"#/components/schemas/ConversationImage"
          },
          {
           "$ref":"#/components/schemas/ConversationDocument"
          },
          {
           "$ref":"#/components/schemas/ConversationAudio"
          },
          {
           "$ref":"#/components/schemas/ConversationContact"
          },
          {
           "$ref":"#/components/schemas/ConversationFile"
          }
         ],
         "title":"Response Attachments.Get"
        }
       }
      },
      "description":"Successful Response"
     },
     "401":{
      "$ref":"#/components/responses/Unauthorized"
     },
     "404":{
      "$ref":"#/components/responses/NotFound"
     },
     "422":{
      "$ref":"#/components/responses/ValidationFailed"
     },
     "default":{
      "$ref":"#/components/responses/Error"
     }
    },
    "security":[
     {
      "BearerAuth":[]
     },
     {
      "SessionCookie":[]
     }
    ],
    "summary":"Get Attachment",
    "tags":[
     "conversations"
    ]
   }
  }
 },
 "components":{
  "responses":{
   "Error":{
    "content":{
     "application/json":{
      "schema":{
       "$ref":"#/components/schemas/ErrorResponse"
      }
     }
    },
    "description":"Unexpected error. Every error this API returns carries this body."
   },
   "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":{
   "ContactCard":{
    "description":"One card in a shared contact file.",
    "properties":{
     "emails":{
      "items":{
       "type":"string"
      },
      "title":"Emails",
      "type":"array"
     },
     "name":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Name"
     },
     "organization":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Organization"
     },
     "phones":{
      "items":{
       "type":"string"
      },
      "title":"Phones",
      "type":"array"
     }
    },
    "required":[
     "name",
     "phones",
     "emails",
     "organization"
    ],
    "title":"ContactCard",
    "type":"object"
   },
   "ConversationAudio":{
    "description":"A voice note or audio file the person sent, and what they said in it.",
    "properties":{
     "bytes":{
      "title":"Bytes",
      "type":"integer"
     },
     "duration_seconds":{
      "anyOf":[
       {
        "type":"number"
       },
       {
        "type":"null"
       }
      ],
      "title":"Duration Seconds"
     },
     "extension":{
      "description":"The type read from its bytes, e.g. `ogg` or `m4a`.",
      "title":"Extension",
      "type":"string"
     },
     "failed_reason":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "description":"Why it could not be transcribed.",
      "title":"Failed Reason"
     },
     "filename":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Filename"
     },
     "id":{
      "format":"uuid",
      "title":"Id",
      "type":"string"
     },
     "kind":{
      "const":"audio",
      "default":"audio",
      "title":"Kind",
      "type":"string"
     },
     "mime_type":{
      "title":"Mime Type",
      "type":"string"
     },
     "playable":{
      "description":"Whether `url` plays in an `<audio>` element.",
      "title":"Playable",
      "type":"boolean"
     },
     "status":{
      "description":"`pending` until an agent with a speech-to-text model takes a turn.",
      "enum":[
       "pending",
       "transcribed",
       "failed"
      ],
      "title":"Status",
      "type":"string"
     },
     "transcript":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "description":"What was said; empty when there was no speech.",
      "title":"Transcript"
     },
     "url":{
      "description":"Signed link; valid until `url_expires_at`.",
      "title":"Url",
      "type":"string"
     },
     "url_expires_at":{
      "format":"date-time",
      "title":"Url Expires At",
      "type":"string"
     }
    },
    "required":[
     "id",
     "mime_type",
     "extension",
     "playable",
     "bytes",
     "filename",
     "status",
     "duration_seconds",
     "transcript",
     "failed_reason",
     "url",
     "url_expires_at"
    ],
    "title":"ConversationAudio",
    "type":"object"
   },
   "ConversationContact":{
    "description":"A contact card the person shared, as read from the vCard.",
    "properties":{
     "bytes":{
      "title":"Bytes",
      "type":"integer"
     },
     "contacts":{
      "description":"One per card in the file.",
      "items":{
       "$ref":"#/components/schemas/ContactCard"
      },
      "title":"Contacts",
      "type":"array"
     },
     "filename":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Filename"
     },
     "id":{
      "format":"uuid",
      "title":"Id",
      "type":"string"
     },
     "kind":{
      "const":"contact",
      "default":"contact",
      "title":"Kind",
      "type":"string"
     },
     "mime_type":{
      "const":"text/vcard",
      "default":"text/vcard",
      "title":"Mime Type",
      "type":"string"
     },
     "url":{
      "description":"Signed download of the .vcf; valid until `url_expires_at`.",
      "title":"Url",
      "type":"string"
     },
     "url_expires_at":{
      "format":"date-time",
      "title":"Url Expires At",
      "type":"string"
     }
    },
    "required":[
     "id",
     "bytes",
     "filename",
     "contacts",
     "url",
     "url_expires_at"
    ],
    "title":"ConversationContact",
    "type":"object"
   },
   "ConversationDocument":{
    "description":"A PDF or Word file the person sent, and whether the agent could read it.",
    "properties":{
     "bytes":{
      "title":"Bytes",
      "type":"integer"
     },
     "filename":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Filename"
     },
     "id":{
      "format":"uuid",
      "title":"Id",
      "type":"string"
     },
     "kind":{
      "const":"document",
      "default":"document",
      "title":"Kind",
      "type":"string"
     },
     "mime_type":{
      "title":"Mime Type",
      "type":"string"
     },
     "pages":{
      "anyOf":[
       {
        "type":"integer"
       },
       {
        "type":"null"
       }
      ],
      "description":"A PDF's page count; null for Word files.",
      "title":"Pages"
     },
     "status":{
      "description":"`pending` until the agent's next turn reads it.",
      "enum":[
       "pending",
       "read",
       "unreadable"
      ],
      "title":"Status",
      "type":"string"
     },
     "unreadable_reason":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "description":"Why the agent could not read it.",
      "title":"Unreadable Reason"
     },
     "url":{
      "description":"Signed download link; valid until `url_expires_at`.",
      "title":"Url",
      "type":"string"
     },
     "url_expires_at":{
      "format":"date-time",
      "title":"Url Expires At",
      "type":"string"
     }
    },
    "required":[
     "id",
     "mime_type",
     "bytes",
     "filename",
     "status",
     "pages",
     "unreadable_reason",
     "url",
     "url_expires_at"
    ],
    "title":"ConversationDocument",
    "type":"object"
   },
   "ConversationFile":{
    "description":"Any other file the person sent, stored for you; the agent cannot open it.",
    "properties":{
     "bytes":{
      "title":"Bytes",
      "type":"integer"
     },
     "extension":{
      "description":"The type read from its bytes, e.g. `xlsx`; `bin` if unknown.",
      "title":"Extension",
      "type":"string"
     },
     "filename":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "title":"Filename"
     },
     "id":{
      "format":"uuid",
      "title":"Id",
      "type":"string"
     },
     "kind":{
      "const":"file",
      "default":"file",
      "title":"Kind",
      "type":"string"
     },
     "mime_type":{
      "title":"Mime Type",
      "type":"string"
     },
     "playable":{
      "anyOf":[
       {
        "const":"video",
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "description":"Set when `url` plays in a `<video>` element.",
      "title":"Playable"
     },
     "url":{
      "description":"Signed link; valid until `url_expires_at`.",
      "title":"Url",
      "type":"string"
     },
     "url_expires_at":{
      "format":"date-time",
      "title":"Url Expires At",
      "type":"string"
     }
    },
    "required":[
     "id",
     "mime_type",
     "extension",
     "playable",
     "bytes",
     "filename",
     "url",
     "url_expires_at"
    ],
    "title":"ConversationFile",
    "type":"object"
   },
   "ConversationImage":{
    "description":"A photo the person sent, with a short-lived link to it.",
    "properties":{
     "bytes":{
      "title":"Bytes",
      "type":"integer"
     },
     "filename":{
      "anyOf":[
       {
        "type":"string"
       },
       {
        "type":"null"
       }
      ],
      "default":null,
      "title":"Filename"
     },
     "height":{
      "title":"Height",
      "type":"integer"
     },
     "id":{
      "format":"uuid",
      "title":"Id",
      "type":"string"
     },
     "kind":{
      "const":"image",
      "default":"image",
      "title":"Kind",
      "type":"string"
     },
     "mime_type":{
      "title":"Mime Type",
      "type":"string"
     },
     "url":{
      "description":"Signed; valid until `url_expires_at`.",
      "title":"Url",
      "type":"string"
     },
     "url_expires_at":{
      "format":"date-time",
      "title":"Url Expires At",
      "type":"string"
     },
     "width":{
      "title":"Width",
      "type":"integer"
     }
    },
    "required":[
     "id",
     "mime_type",
     "bytes",
     "width",
     "height",
     "url",
     "url_expires_at"
    ],
    "title":"ConversationImage",
    "type":"object"
   },
   "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"
   }
  }
 }
}
```
