Attachment Upload API Reference

This API allows you to upload an attachment that you may later send out to many users, without having to repeatedly upload the same data each time it is sent.

Contents

For error codes see this page.

Request

The Graph API version should be set to 2.6 or greater.

To send a message, make a POST request to https://graph.facebook.com/v2.6/me/message_attachments?access_token=<PAGE_ACCESS_TOKEN> with your page access token. The payload must be provided in JSON format as described below:

The Upload API requires the pages_messaging permission.

Example

curl -X POST -H "Content-Type: application/json" -d '{
  "message":{
    "attachment":{
      "type":"image", 
      "payload":{
        "url":"http://www.messenger-rocks.com/image.jpg", 
        "is_reusable":true,
      }
    }
  }
}' "https://graph.facebook.com/v2.6/me/message_attachments?access_token=PAGE_ACCESS_TOKEN"

Payload

Property Name Description Required

message

message object

Yes

The message is the same as the Send API message payload, but only multi-media attachments are supported:

Response

A successful Upload API request returns a JSON string containing the identifier for the attachment.

Example

{
  "attachment_id":"1854626884821032"
}

Fields

Property Name Description

attachment_id

Nonexpiring ID for the attachment

Limits

Calls to the Upload API

We support a high rate of calls to the Attachment Upload API. However, you should architect your systems such that you distribute any sudden high amounts of load over time and are able to control your throughput should you hit our rate limits.

Rate limits are in place to prevent malicious behavior and poor user experiences. Be sure to catch any errors returned by the Send API including the one indicating that you've reached the rate limit.