Skip to main content
POST
/
my-account
Update customer account
curl --request POST \
  --url {protocol}://{host}/wp-json/cocart/preview/my-account \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "account_first_name": "<string>",
  "account_last_name": "<string>",
  "account_display_name": "<string>",
  "account_email": "jsmith@example.com",
  "password_current": "<string>",
  "password_1": "<string>",
  "password_2": "<string>"
}
'
import requests

url = "{protocol}://{host}/wp-json/cocart/preview/my-account"

payload = {
"account_first_name": "<string>",
"account_last_name": "<string>",
"account_display_name": "<string>",
"account_email": "jsmith@example.com",
"password_current": "<string>",
"password_1": "<string>",
"password_2": "<string>"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
account_first_name: '<string>',
account_last_name: '<string>',
account_display_name: '<string>',
account_email: 'jsmith@example.com',
password_current: '<string>',
password_1: '<string>',
password_2: '<string>'
})
};

fetch('{protocol}://{host}/wp-json/cocart/preview/my-account', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "{protocol}://{host}/wp-json/cocart/preview/my-account",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'account_first_name' => '<string>',
'account_last_name' => '<string>',
'account_display_name' => '<string>',
'account_email' => 'jsmith@example.com',
'password_current' => '<string>',
'password_1' => '<string>',
'password_2' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "{protocol}://{host}/wp-json/cocart/preview/my-account"

payload := strings.NewReader("{\n \"account_first_name\": \"<string>\",\n \"account_last_name\": \"<string>\",\n \"account_display_name\": \"<string>\",\n \"account_email\": \"jsmith@example.com\",\n \"password_current\": \"<string>\",\n \"password_1\": \"<string>\",\n \"password_2\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("{protocol}://{host}/wp-json/cocart/preview/my-account")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"account_first_name\": \"<string>\",\n \"account_last_name\": \"<string>\",\n \"account_display_name\": \"<string>\",\n \"account_email\": \"jsmith@example.com\",\n \"password_current\": \"<string>\",\n \"password_1\": \"<string>\",\n \"password_2\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("{protocol}://{host}/wp-json/cocart/preview/my-account")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_first_name\": \"<string>\",\n \"account_last_name\": \"<string>\",\n \"account_display_name\": \"<string>\",\n \"account_email\": \"jsmith@example.com\",\n \"password_current\": \"<string>\",\n \"password_1\": \"<string>\",\n \"password_2\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "message": "Account details updated successfully"
}
{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}
{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}
This endpoint is currently shown as a preview of what’s currently in development and is subject to change.

Authorizations

Authorization
string
header
required

WordPress username and password

Body

application/json

Account data to update

account_first_name
string
required

First name

account_last_name
string
required

Last name

account_display_name
string
required

Display name

account_email
string<email>
required

Email address

password_current
string

Current password (required if changing password)

password_1
string

New password

password_2
string

Confirm new password (must match password_1)

Response

Account updated successfully

success
boolean
Example:

true

message
string

Success message