Article Attachments

JSON Format

Article Attachments are represented as JSON objects with the following properties:

Name Type Read-only Mandatory Description
article_id integer false false the associated article, if present
content_type string false false The file type. Example: image/png
content_url string false false URL where the attachment file can be downloaded
created_at string false false The time the article attachment was created
file_name string false false The file name
id integer false false Assigned ID when the article attachment is created
inline boolean false false The attached file is shown in the admin interface for inline attachments. Its URL can be referenced in the article's HTML body. If false, the attachment is listed in the list of attachments. The default value is "false"
size integer false false The attachment file size in bytes
updated_at string false false The time the article attachment was last updated
url string false false The URL of the attached article
Example
{
  "article_id": 23,
  "content_type": "application/pdf",
  "content_url": "https://company.zendesk.com/hc/article_attachments/200109629/party_invitation.pdf",
  "created_at": "2012-04-04T09:14:57Z",
  "file_name": "party_invitation.pdf",
  "id": 1428,
  "inline": false,
  "size": 58298
}

Create Unassociated Attachment

  • POST /api/v2/help_center/articles/attachments

You can use this endpoint for bulk imports. It lets you upload a file without associating it to an article until later. See Associate Attachments in Bulk to Article.

Note: Associate attachments to articles as soon as possible. For example, if you use the endpoint to bulk-import inline images, only signed-in end users can see the images; anonymous users don't have permission to view unassociated images. Also, from time to time, we purge old article attachments not associated to any article. To ensure you don't lose an uploaded file, associate it to an article.

Allowed for
  • Agents
Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/attachments.json \
  -F "inline=true" -F "[email protected]" \
  -v -u {email_address}:{password} -X POST
Example Response
Status 201 Created

{
  "article_attachment": {
    "article_id": 23,
    "content_type": "application/jpeg",
    "content_url": "https://company.zendesk.com/hc/article_attachments/200109629/logo.jpg",
    "file_name": "logo.jpg",
    "id": 1428,
    "inline": true,
    "size": 1428
  }
}

List Article Attachments

  • GET /api/v2/help_center{/locale}/articles/{article_id}/attachments

Lists all the article's attachments.

The {locale} is required only for end users. Admins and agents can omit it.

Allowed for
  • Agents
  • End users, as long as they can view the associated article
Parameters
Name Type In Required Description
article_id integer Path true The unique ID of this Article
locale string Path false The locale that the category is displayed in
Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/{locale}/articles/{article_id}/attachments.json \
  -v -u {email_address}:{password}
Example Response
Status 200 OK

{
  "article_attachments": [
    {
      "article_id": 23,
      "content_type": "application/jpeg",
      "content_url": "https://company.zendesk.com/hc/article_attachments/200109629/logo.jpg",
      "file_name": "logo.jpg",
      "id": 1428,
      "inline": true,
      "size": 1428
    },
    {
      "article_id": 23,
      "content_type": "application/pdf",
      "content_url": "https://company.zendesk.com/hc/article_attachments/200109629/party_invitation.pdf",
      "file_name": "party_invitation.pdf",
      "id": 2857,
      "inline": false,
      "size": 58298
    }
  ]
}

Create Article Attachment

  • POST /api/v2/help_center{/locale}/articles/{article_id}/attachments

Creates an attachment for the specified article. You can specify whether the attachment is inline or not. The default is false.

Allowed for
  • Agents
Parameters
Name Type In Required Description
article_id integer Path true The unique ID of this Article
locale string Path false The locale that the category is displayed in
Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/{article_id}/attachments.json \
  -F "inline=true" -F "[email protected]" \
  -v -u {email_address}:{password} -X POST
Example Response
Status 200 OK

{
  "article_attachment": {
    "article_id": 23,
    "content_type": "application/jpeg",
    "content_url": "https://company.zendesk.com/hc/article_attachments/200109629/logo.jpg",
    "file_name": "logo.jpg",
    "id": 1428,
    "inline": true,
    "size": 1428
  }
}

List Article Block Attachments

  • GET /api/v2/help_center{/locale}/articles/{article_id}/attachments/block

Lists all the article's block attachments. Block attachments are those that are not inline.

The {locale} is required only for end users. Admins and agents can omit it.

Allowed for
  • Agents
  • End users, as long as they can view the associated article
Parameters
Name Type In Required Description
article_id integer Path true The unique ID of this Article
locale string Path false The locale that the category is displayed in
Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/{locale}/articles/{article_id}/attachments/block.json \
  -v -u {email_address}:{password}
Example Response
Status 200 OK

{
  "article_attachments": [
    {
      "article_id": 23,
      "content_type": "application/pdf",
      "content_url": "https://company.zendesk.com/hc/article_attachments/200109629/logo.pdf",
      "file_name": "logo.pdf",
      "id": 1428,
      "inline": false,
      "size": 1428
    },
    {
      "article_id": 23,
      "content_type": "application/msword",
      "content_url": "https://company.zendesk.com/hc/article_attachments/200109629/results.doc",
      "file_name": "results.doc",
      "id": 2857,
      "inline": false,
      "size": 234
    }
  ]
}

List Article Inline Attachments

  • GET /api/v2/help_center{/locale}/articles/{article_id}/attachments/inline

Lists all the article's inline attachments.

The {locale} is required only for end users. Admins and agents can omit it.

Allowed for
  • Agents
  • End users, as long as they can view the associated article
Parameters
Name Type In Required Description
article_id integer Path true The unique ID of this Article
locale string Path false The locale that the category is displayed in
Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/{locale}/articles/{article_id}/attachments/inline.json \
  -v -u {email_address}:{password}
Example Response
Status 200 OK

{
  "article_attachments": [
    {
      "article_id": 23,
      "content_type": "application/jpeg",
      "content_url": "https://company.zendesk.com/hc/article_attachments/200109629/logo.jpg",
      "file_name": "logo.jpg",
      "id": 1428,
      "inline": true,
      "size": 1428
    },
    {
      "article_id": 23,
      "content_type": "application/gif",
      "content_url": "https://company.zendesk.com/hc/article_attachments/200109629/footer.gif",
      "file_name": "footer.gif",
      "id": 2857,
      "inline": true,
      "size": 234
    }
  ]
}

Show Article Attachment

  • GET /api/v2/help_center{/locale}/articles/{article_id}/attachments/{article_attachment_id}

Shows the properties of the specified attachment.

The {locale} is required only for end users. Admins and agents can omit it.

Allowed for
  • Agents
  • End users, as long as they can view the associated article
Parameters
Name Type In Required Description
article_attachment_id integer Path true The unique ID of this Article Attachment
article_id integer Path true The unique ID of this Article
locale string Path false The locale that the category is displayed in
Using curl
curl https://{subdomain}.zendesk.com/api/v2/help_center/{locale}/articles/attachments/{article_attachment_id}.json \
  -v -u {email_address}:{password}
Example Response
Status 200 OK

{
  "article_attachment": {
    "article_id": 23,
    "content_type": "application/jpeg",
    "content_url": "https://company.zendesk.com/hc/article_attachments/200109629/logo.jpg",
    "file_name": "logo.jpg",
    "id": 1428,
    "inline": true,
    "size": 1428
  }
}

Delete Article Attachment

  • DELETE /api/v2/help_center{/locale}/articles/{article_id}/attachments/{article_attachment_id}
Allowed for
  • Agents
Parameters
Name Type In Required Description
article_attachment_id integer Path true The unique ID of this Article Attachment
article_id integer Path true The unique ID of this Article
locale string Path false The locale that the category is displayed in
Using
curl https://{subdomain}.zendesk.com/api/v2/help_center/articles/attachments/{article_attachment_id}.json \
  -v -u {email_address}:{password} -X DELETE
Example Response
Status 204 No Content