> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.etera.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.etera.dev/_mcp/server.

# Update user profile

PATCH https://api.etera.dev/account/profile/
Content-Type: application/json

Update the current user's profile information. All fields are optional - only provided fields will be updated.

**Authentication Required:** Yes - Valid JWT token in Authorization header

**User Identification:** The system supports finding users by ID, email, or phone number from the authentication token.

**Available Fields:**

* **firstName** (string, 1-50 chars): User's first name
* **lastName** (string, 1-50 chars): User's last name
* **gender** (enum): MALE, FEMALE, OTHER
* **birthday** (ISO 8601 date-time): User's birthday
* **nationality** (2-char ISO code): Country code (e.g., US, DE, FR)
* **homeBase** (string, 1-100 chars): User's home location
* **language** (enum): DE, EN, AR
* **appearance** (enum): AUTO, LIGHT, DARK
* **termsAccepted** (boolean): Flag indicating user accepted terms of conditions. When set to true, automatically sets termsAcceptedAt timestamp
* **marketingAccepted** (boolean): Flag indicating user accepted marketing communications. When set to true, automatically sets marketingAcceptedAt timestamp

**Usage:**

1. Generate a test token using the `/auth/generate-test-token` endpoint
2. Include the token in the Authorization header: `Bearer <token>`
3. Send a PATCH request with the fields you want to update
4. Only provided fields will be updated; others remain unchanged

**Validation Rules:**

* firstName/lastName: 1-50 characters
* nationality: Exactly 2 characters (ISO Alpha-2)
* homeBase: 1-100 characters
* birthday: Valid ISO 8601 date-time format
* At least one field must be provided

**Note:** This endpoint requires a valid JWT token. The system will automatically find the user by ID, email, or phone number from the token.

Reference: https://docs.etera.dev/platform/account/account-api/profile/patch-profile

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://api.etera.dev/account` (Production, default)
- `https://api-stage.etera.dev/account` (Staging)
- `https://api-dev.etera.dev/account` (Development)

## Request

### Body (application/json)

This endpoint expects an any.

- `any`

## Response

### 200

User profile updated successfully

- `success` (boolean, optional)
- `message` (string, optional)
- `data` (any, optional)

## Errors

### 400 Bad Request Error

Bad Request - Invalid user identifier or malformed request

- `error` (string, optional)
- `message` (string, optional)
- `details` (string, optional)
- `statusCode` (double, optional)

### 401 Unauthorized Error

Unauthorized - Invalid or missing authentication token

- `error` (string, optional)
- `message` (string, optional)
- `details` (string, optional)
- `statusCode` (double, optional)

### 404 Not Found Error

Not Found - User not found

- `error` (string, optional)
- `message` (string, optional)
- `statusCode` (double, optional)

### 409 Conflict Error

Conflict - Profile update conflicts with existing data

- `error` (string, optional)
- `message` (string, optional)
- `details` (string, optional)
- `statusCode` (double, optional)

### 422 Unprocessable Entity Error

Unprocessable Entity - Validation error or data format issue

- `error` (string, optional)
- `message` (string, optional)
- `details` (string, optional)
- `statusCode` (double, optional)

### 500 Internal Server Error

Internal Server Error - Cache service error or unexpected system error

- `error` (string, optional)
- `message` (string, optional)
- `details` (string, optional)
- `statusCode` (double, optional)

### 503 Service Unavailable Error

Service Unavailable - Database connection issues

- `error` (string, optional)
- `message` (string, optional)
- `statusCode` (double, optional)

## Examples

**Request**

```json
{
  "firstName": "Emily",
  "lastName": "Watson",
  "gender": "FEMALE",
  "birthday": "1985-07-23T00:00:00.000Z",
  "nationality": "GB",
  "homeBase": "London, UK",
  "language": "EN",
  "appearance": "LIGHT",
  "termsAccepted": true,
  "marketingAccepted": false
}
```

**Response**

```json
{
  "success": true,
  "message": "User profile updated successfully",
  "data": {
    "firstName": "Emily",
    "lastName": "Watson",
    "gender": "FEMALE",
    "birthday": "1985-07-23T00:00:00.000Z",
    "nationality": "GB",
    "homeBase": "London, UK",
    "language": "EN",
    "appearance": "LIGHT",
    "termsAccepted": true,
    "marketingAccepted": false,
    "termsAcceptedAt": "2024-06-01T12:00:00Z",
    "marketingAcceptedAt": null
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.etera.dev/account/profile/"

payload = {
    "firstName": "Emily",
    "lastName": "Watson",
    "gender": "FEMALE",
    "birthday": "1985-07-23T00:00:00.000Z",
    "nationality": "GB",
    "homeBase": "London, UK",
    "language": "EN",
    "appearance": "LIGHT",
    "termsAccepted": True,
    "marketingAccepted": False
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.etera.dev/account/profile/';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"firstName":"Emily","lastName":"Watson","gender":"FEMALE","birthday":"1985-07-23T00:00:00.000Z","nationality":"GB","homeBase":"London, UK","language":"EN","appearance":"LIGHT","termsAccepted":true,"marketingAccepted":false}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.etera.dev/account/profile/"

	payload := strings.NewReader("{\n  \"firstName\": \"Emily\",\n  \"lastName\": \"Watson\",\n  \"gender\": \"FEMALE\",\n  \"birthday\": \"1985-07-23T00:00:00.000Z\",\n  \"nationality\": \"GB\",\n  \"homeBase\": \"London, UK\",\n  \"language\": \"EN\",\n  \"appearance\": \"LIGHT\",\n  \"termsAccepted\": true,\n  \"marketingAccepted\": false\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.etera.dev/account/profile/")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"firstName\": \"Emily\",\n  \"lastName\": \"Watson\",\n  \"gender\": \"FEMALE\",\n  \"birthday\": \"1985-07-23T00:00:00.000Z\",\n  \"nationality\": \"GB\",\n  \"homeBase\": \"London, UK\",\n  \"language\": \"EN\",\n  \"appearance\": \"LIGHT\",\n  \"termsAccepted\": true,\n  \"marketingAccepted\": false\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.etera.dev/account/profile/")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"firstName\": \"Emily\",\n  \"lastName\": \"Watson\",\n  \"gender\": \"FEMALE\",\n  \"birthday\": \"1985-07-23T00:00:00.000Z\",\n  \"nationality\": \"GB\",\n  \"homeBase\": \"London, UK\",\n  \"language\": \"EN\",\n  \"appearance\": \"LIGHT\",\n  \"termsAccepted\": true,\n  \"marketingAccepted\": false\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.etera.dev/account/profile/', [
  'body' => '{
  "firstName": "Emily",
  "lastName": "Watson",
  "gender": "FEMALE",
  "birthday": "1985-07-23T00:00:00.000Z",
  "nationality": "GB",
  "homeBase": "London, UK",
  "language": "EN",
  "appearance": "LIGHT",
  "termsAccepted": true,
  "marketingAccepted": false
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.etera.dev/account/profile/");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"firstName\": \"Emily\",\n  \"lastName\": \"Watson\",\n  \"gender\": \"FEMALE\",\n  \"birthday\": \"1985-07-23T00:00:00.000Z\",\n  \"nationality\": \"GB\",\n  \"homeBase\": \"London, UK\",\n  \"language\": \"EN\",\n  \"appearance\": \"LIGHT\",\n  \"termsAccepted\": true,\n  \"marketingAccepted\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "firstName": "Emily",
  "lastName": "Watson",
  "gender": "FEMALE",
  "birthday": "1985-07-23T00:00:00.000Z",
  "nationality": "GB",
  "homeBase": "London, UK",
  "language": "EN",
  "appearance": "LIGHT",
  "termsAccepted": true,
  "marketingAccepted": false
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.etera.dev/account/profile/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```