Update Address
Change or modify an address.
To clear a field, set it to an empty string.
Code Samples
.NET
using System; using System.Text.Json; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { var requestObj = new { line_2 = "Apt. 34" }; string address_id = "address_27833f1b6d463a65bef7694a35facaad"; string request = JsonSerializer.Serialize(requestObj); string result = RapydApiRequestSample.Utilities.MakeRequest("POST", $"/v1/addresses/{address_id}", request); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Error completing request: " + e.Message); } } } }
JavaScript
const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest; async function main() { try { const body = { line_2: 'Apt. 34' }; const result = await makeRequest( 'POST', '/v1/addresses/address_80923fd28383ea14c127f9ea9997a0ec', body ); console.log(result); } catch (error) { console.error('Error completing request', error); } }
PHP
<?php $path = $_SERVER['DOCUMENT_ROOT']; $path .= "/<path-to-your-utility-file>/utilities.php"; include($path); $body = [ "line_2" =>"Apt. 34" ]; try { $object = make_request('post', "/v1/addresses/address_3e5ee33a65805dae26f56f45d6d5c79e", $body); var_dump($object); } catch(Exception $e) { echo "Error =>$e"; } ?>
Python
from pprint import pprint from utilities import make_request address = { "metadata": { "merchant_defined": "updated" }, "line_2": "Apt. 56" } result = make_request(method='post', path='/v1/addresses/address_211814f6e85b112fe786b87140f10f0e', body=address) pprint(result)
/v1/addresses/:address
Update Address
curl -X post 'https://sandboxapi.rapyd.net/v1/addresses/address_f9189070a0671b1a4302851b839d166a' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "line_2": "Apt. 56" }'{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "07865320-3bfb-4c4e-b808-8f9a41ec349f" }, "data": { "id": "address_f9189070a0671b1a4302851b839d166a", "name": "John Doe", "line_1": "123 First Street", "line_2": "Apt. 56", "line_3": "", "city": "Anytown", "state": "", "country": "US", "zip": "12345", "phone_number": "12125559999", "metadata": {}, "canton": "", "district": "", "created_at": 1761820962 } }
Bad Request - Address ID Missing
curl -X post 'https://sandboxapi.rapyd.net/v1/addresses/' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "line_2": "Apt. 56" }'{ "status": { "error_code": "ERROR_ADDRESS_GET", "status": "ERROR", "message": "The request attempted an operation that requires an address, but the address was not found. The request was rejected. Corrective action: For the 'address' parameter, use a valid address ID.", "response_code": "ERROR_ADDRESS_GET", "operation_id": "3f5e900a-f913-4b8a-ac66-6a867355ba0d" } }
Bad Request - Street Address Line 1 Missing
curl -X post 'https://sandboxapi.rapyd.net/v1/addresses/address_f9189070a0671b1a4302851b839d166a' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "line_1": "" }'{ "status": { "error_code": "INVALID_ADDRESS_LINE_1", "status": "ERROR", "message": "The request attempted an operation that requires an address, but Line 1 of the address was missing. The request was rejected. Corrective action: In the 'line_1' field, provide a valid street address.", "response_code": "INVALID_ADDRESS_LINE_1", "operation_id": "b63b507d-146f-4730-9db3-71e2d86f50cd" } }
Unauthorized
curl -X post 'https://sandboxapi.rapyd.net/v1/addresses/address_f9189070a0671b1a4302851b839d166a' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "line_2": "Apt. 56" }'{ "status": { "error_code": "UNAUTHENTICATED_API_CALL", "status": "ERROR", "message": "The request was rejected due to an authentication issue. Corrective action: Check the status of your account in the 'Account Details' page of the Client Portal.", "response_code": "UNAUTHENTICATED_API_CALL", "operation_id": "fbf4a044-ae72-4917-830b-143b1c74e814" } }