Attachment API - GET /now/attachment/{sys_id}/file

This method gets the binary file attachment with a specific sys_id value.

URL format

Versioned URL: api/now/v1/attachment/<attachment sys_id>/file

Default URL: api/now/attachment/<attachment sys_id>/file

Supported request parameters

Table 1. Parameters
Parameter Description
sys_id The sys_id of the attachment record you want to get binary data from.


The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see REST API headers.

Table 2. Request headers
Header Description
Table 3. Response headers
Header Description
X-Attachment-Metadata Metadata about the returned file, such as size, name, and file type.

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API response codes.

Table 4. Status codes
Status code Description
200 Indicates the query ran successfully.

Sample cURL request

curl "" \
--request GET \
--header "Accept:*/*" \
--user 'admin':'admin'
Binary response not shown.

Sample Python request

#Need to install requests package for python
#easy_install requests
import requests

# Set the request parameters
url = ''

# Eg. User name="admin", Password="admin" for this code sample.
user = 'admin'
pwd = 'admin'

# Set proper headers
headers = {"Content-Type":"application/xml","Accept":"*/*"}

# Do the HTTP request
response = requests.get(url, auth=(user, pwd), headers=headers  )

# Check for HTTP codes other than 200
if response.status_code != 200: 
    print('Status:', response.status_code, 'Headers:', response.headers, 'Error Response:',response.json())

# Decode the JSON response into a dictionary and use the data
data = response.json()
Binary response not shown.