Attachments

Create a temporary attachment

Create a temporary attachment for use as ad-hoc context on a content generation request. Submit as multipart/form-data. The type form field discriminates the payload carried on value: for FILE, send the file bytes as the value multipart part; for TEXT and URL, send the payload as the value form field.

Reference the returned id in the attachmentIds field on a subsequent POST /v1/tasks/{id}/run (or POST /v1/tasks/{id}/run/stream), POST /v1/command, or POST /v1/templates/{templateId}/run call. It is not supported by other endpoints.

Temporary attachments are intended for short-lived context (the same attachment can be referenced across retries of the same run) and should not be relied on for durable storage. Use the Knowledge API (POST /v1/knowledge) for content that should persist in your workspace.

post/v1/attachments

Request

  • Base URL
    https://api.jasper.ai
  • URL
    https://api.jasper.ai/v1/attachments
  • Auth
    • API key in header X-API-Key
    • or OAuth 2
      Authorization code: https://api.jasper.ai/oauth2/authorize
      Token URL: https://api.jasper.ai/oauth2/token scopes: user

Request body multipart/form-data

type'FILE' | 'TEXT' | 'URL' required

The kind of attachment being created. In every case the payload is carried on the value multipart part: FILE sends binary file bytes, TEXT sends a raw text string, URL sends a URL string.

Example request

{
  "type": "FILE"
}

Response

Attachment created successfully.

requestIdstring required
resourcestring required

Example response

{
  "requestId": "8393f82b3f6a4f6e8a405777b9305254",
  "resource": "knowledge",
  "data": {
    "id": "tmp_2ee766eaa4ef48e59da1d9602bfecf2d",
    "type": "FILE"
  }
}

Changes

No recorded changes to this operation across all 2 revisions of this API.