---
schema_version: "1"
id: 56c64649e12d6a3985bc56f3871dcf8ddf7190263325ef4221692a0cf130ab19
title: SOAP API Examples
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/caf-dev/guides/caf/caf-dev-examples-api-soap.md
canonical_url: https://developer.salesforce.com/docs/platform/caf-dev/guide/caf-dev-examples-api-soap.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1a813339c21eefcc1d80e91c0174311c4a4f091ae1fd54b33720e535a0fc56c5
products:
  - Custom Address Fields Developer Guide
  - Platform Developer Content
---

# SOAP API Examples

Use SOAP API to create, update, or delete a record with Custom Address Fields data.

**note:** Before you create a custom address field, review the [Custom Address Fields Requirements and Limitations](https://developer.salesforce.com/docs/platform/caf-dev/guide/caf-dev-limitations.md). To discuss the feature and ask questions, join the [Custom Address Fields Discussion](https://trailhead.salesforce.com/trailblazer-community/groups/0F94S000000H3KISA0) group on the Trailblazer Community.

## Create a New Account with Data in a Custom Address Field

This example creates an Account record which includes address data stored in the Mailing Address custom address field.

```xml
<?xml version="1.0" encoding="utf-8"?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:urn="urn:enterprise.soap.sforce.com"
    xmlns:urn1="urn:sobject.enterprise.soap.sforce.com"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <urn:SessionHeader>
            <urn:sessionId>$0XXXXXXXXXXXXXXX</urn:sessionId>
        </urn:SessionHeader>
    </soapenv:Header>
    <soapenv:Body> 
        <urn:create>
            <urn:sObjects xsi:type="urn1:Account"> <!--Zero or more repetitions:-->
                <Name>Puneet Ahmedabad Account</Name>
                <Mailing_Address__City__s>Ahmedabad</Mailing_Address__City__s>
                <Mailing_Address__Street__s>102 Suryakoti</Mailing_Address__Street__s>
                <Mailing_Address__PostalCode__s>380022</Mailing_Address__PostalCode__s>
                <Mailing_Address__StateCode__s>GJ</Mailing_Address__StateCode__s>
                <Mailing_Address__CountryCode__s>IN</Mailing_Address__CountryCode__s>
                <Mailing_Address__Latitude__s>37.775</Mailing_Address__Latitude__s>
                <Mailing_Address__Longitude__s>-122.418</Mailing_Address__Longitude__s>
            </urn:sObjects>
        </urn:create> 
    </soapenv:Body> 
</soapenv:Envelope>
```

## Update Data Within a Custom Address Field on a Record

This example updates the data stored in the Mailing Address custom address field for record ID `001XXXXXXXXXXXXXXX`.

```xml
<?xml version="1.0" encoding="utf-8"?>   
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:urn="urn:enterprise.soap.sforce.com"
    xmlns:urn1="urn:sobject.enterprise.soap.sforce.com"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <urn:SessionHeader>
            <urn:sessionId>$0XXXXXXXXXXXXXXX</urn:sessionId>
        </urn:SessionHeader>
    </soapenv:Header>
    <soapenv:Body> 
        <urn:update>
            <urn:sObjects xsi:type="urn1:Account">
                <Id>$001XXXXXXXXXXXXXXX</Id>
                <Mailing_Address__Street__s>20 Udhyog Nagar</Mailing_Address__Street__s>
                <Mailing_Address__City__s>Surendranagar</Mailing_Address__City__s>
                <Mailing_Address__PostalCode__s>363001</Mailing_Address__PostalCode__s>
                <Mailing_Address__StateCode__s>GJ</Mailing_Address__StateCode__s>
                <Mailing_Address__CountryCode__s>IN</Mailing_Address__CountryCode__s>
                <Mailing_Address__Latitude__s>22.757580</Mailing_Address__Latitude__s>
                <Mailing_Address__Longitude__s>71.619350</Mailing_Address__Longitude__s>
            </urn:sObjects>
        </urn:update>
    </soapenv:Body>
</soapenv:Envelope> 
```

## Delete Data Within a Custom Address Field from a Record

To delete address data stored within a custom address field on a record, update the record. This example deletes the address stored in the Mailing Address custom address field on the Account with record with ID `001XXXXXXXXXXXXXXX`.

```xml
<?xml version="1.0" encoding="utf-8"?>   
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:urn="urn:enterprise.soap.sforce.com"
    xmlns:urn1="urn:sobject.enterprise.soap.sforce.com"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <urn:SessionHeader>
            <urn:sessionId>$0XXXXXXXXXXXXXXX</urn:sessionId>
        </urn:SessionHeader>
    </soapenv:Header>
    <soapenv:Body> 
        <urn:update>
            <urn:sObjects xsi:type="urn1:Account">
                <Id>$001XXXXXXXXXXXXXXX</Id>
                <Name>Acc updated</Name>
                <urn:fieldsToNull>Mailing_Address__Street__s</urn:fieldsToNull>
                <urn:fieldsToNull>Mailing_Address__City__s</urn:fieldsToNull>
                <urn:fieldsToNull>Mailing_Address__PostalCode__s</urn:fieldsToNull>
                <urn:fieldsToNull>Mailing_Address__StateCode__s</urn:fieldsToNull>
                <urn:fieldsToNull>Mailing_Address__CountryCode__s</urn:fieldsToNull>
                <urn:fieldsToNull>Mailing_Address__Latitude__s</urn:fieldsToNull>
                <urn:fieldsToNull>Mailing_Address__Longitude__s</urn:fieldsToNull>
            </urn:sObjects>
        </urn:update>
    </soapenv:Body>
</soapenv:Envelope>  
```

## Delete a Record That Contains Data in a Custom Address Field

This example deletes the Account record with ID `001XXXXXXXXXXXXXXX`. When a record is deleted, all data for that record is deleted, including the custom address field information.

```xml
<?xml version="1.0" encoding="utf-8"?>   
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:urn="urn:enterprise.soap.sforce.com"
    xmlns:urn1="urn:sobject.enterprise.soap.sforce.com"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header>
        <urn:SessionHeader>
           <urn:sessionId>$0XXXXXXXXXXXXXXX</urn:sessionId>
        </urn:SessionHeader>
  </soapenv:Header>
  <soapenv:Body> 
      <urn:delete>
          <Id>$001XXXXXXXXXXXXXXX</Id>
      </urn:delete> 
   </soapenv:Body>
</soapenv:Envelope> 
```

