---
schema_version: "1"
id: e7a7c7037032173f14ba6ff49dce927a3d72f6abd2dcc045529d240f0e0c1038
title: Get an Image from a Rich Text Area Field
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/api-rest/guides/do-me/dome-sobject-rich-text-image-retrieve.md
canonical_url: https://developer.salesforce.com/docs/platform/api-rest/guide/dome-sobject-rich-text-image-retrieve.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8871d921f70f50fb1745f12c78b93e926b451dd4004c599ec229c96503984599
products:
  - REST API Developer Guide
  - Platform Developer Content
---

# Get an Image from a Rich Text Area Field

Use the sObject Rich Text Image Get resource to retrieve an image from a rich text area field. In this example, we retrieve an image from a custom rich text field of a Lead record called `LeadPhotoRichText__c`. We assume that an image has already been uploaded to this field.

**note:** This example doesn’t work with the EmailMessage object.

## Obtain the Image Reference ID

Before you can retrieve the image with a request, you must first obtain the `refid` from the rich text field. Use the [sObject Rows](https://developer.salesforce.com/docs/platform/api-rest/resources/resources-sobject-retrieve.md) resource to retrieve the field information for the Lead record.

```nolang
curl https://MyDomainName.my.salesforce.com/services/data/v68.0/sobjects/Lead/00Q112222233333 -H "Authorization: Bearer token"
```

Here’s an example of abridged output from the request.

```nolang
{
    "attributes": {
        "type": "Lead",
        "url": "/services/data/v51.0/sobjects/Lead/00Q112222233333"
    },
    "Id": "00Q112222233333",
    "IsDeleted": false,
    "MasterRecordId": null,
    "LastName": "Smith",
    "FirstName": "John",

    ...

    "LeadPhotoRichText__c": "<img alt=\"johnSmithPhoto\" src=\"https://MyDomainName.documentforce.com/servlet/rtaImage?eid=a005e000007Dksm&amp;feoid=00N5e00000djU6Y&amp;refid=0EM5e000000B9LQ\"></img>"
}
```

You can see from the LeadPhotoRichText__c field that the `refid` of the image is `0EM5e000000B9LQ`. Use this value in the next step to retrieve the image.

## Retrieve the Image

Use the Lead record ID, rich text field name, and image `refid` to retrieve the image. The response returns the image as encoded data with the same file type as it was uploaded with. Save the returned data as an image file with the appropriate file type using the `--output filename` parameter.

```nolang
curl https://MyDomainName.my.salesforce.com/services/data/v68.0/sobjects/Lead/00Q112222233333/richTextImageFields/LeadPhotoRichText__c/0EMR00000000A8V -H "Authorization: Bearer token" --output "LeadPhoto.jpeg"
```

