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

# Set New Password (via Reset Token)

PATCH https://api.customerhub.com/web_api/password
Content-Type: application/json

Set a new password using a password reset token. Also used after email confirmation to set the initial password.

**Authentication:** Public — token-based.

**Request body:**
- `token` (required) — Password reset token from the reset email or confirmation flow
- `password` (required) — New password
- `password_confirmation` (required) — Must match the new password

**Response:** Same as a successful login:
- `token` — JWT auth token (user is auto-logged in)
- `location` — Redirect URL
- the member's profile fields at the top level of `data` (`id`, `first_name`, `last_name`, `name`, `initials`, `email`, `avatar_url`, `status`, `bio`, `phone`, `website`, social handles, `otp_enabled`, `passkey_registered`, `last_seen_at`, `created_at`, `updated_at`, ...) — there is no nested `user` object

**Side effects:**
- Updates the user's password
- Sets user status to "active"
- Clears the `reset_password` flag
- Triggers a `UserLogin` event
- Creates a new session

**Errors:**
- `401` — Invalid or expired reset token
- `422` — Password validation failed (e.g. too short, confirmation mismatch)

Reference: https://customerhub.com/api/api-reference/passwords/set-new-password-via-reset-token

## Request

### Body (application/json)

This endpoint expects an object.

- `token` (string, optional)
- `password` (string, optional)
- `password_confirmation` (string, optional)

## Response

### 200

OK

## Examples

**Request**

```json
{
  "token": "",
  "password": "new_password",
  "password_confirmation": "new_password"
}
```

**Response**

```json
{
  "data": {
    "alert": null,
    "avatar_media_id": null,
    "avatar_url": null,
    "bio": "Community member",
    "cdata": {},
    "cover_image_url": null,
    "created_at": "2026-09-16T15:32:12Z",
    "email": "user@example.com",
    "engagement_score": 0,
    "facebook": null,
    "first_name": "John",
    "goal": null,
    "goal_author": null,
    "goal_highlights": [],
    "goal_history": [],
    "goal_updated_at": null,
    "id": "c7358892-5f29-47db-a705-2c53d10da4bd",
    "initials": "JD",
    "instagram": null,
    "keap_custom_fields": {},
    "last_name": "Doe",
    "last_seen_at": null,
    "linkedin": null,
    "location": "/dashboard",
    "metadata": {},
    "name": "John Doe",
    "otp_enabled": false,
    "passkey_registered": false,
    "phone": "+1 555 0100",
    "settings": {},
    "status": "active",
    "suspended_until": null,
    "token": "eyJhbGciOiJIUzI1NiJ9...",
    "updated_at": "2026-09-16T15:32:12Z",
    "website": "https://example.com",
    "x_twitter": null
  }
}
```

**SDK Code**

```python Passwords_setNewPasswordViaResetToken_example
import requests

url = "https://api.customerhub.com/web_api/password"

payload = {
    "token": "",
    "password": "new_password",
    "password_confirmation": "new_password"
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Passwords_setNewPasswordViaResetToken_example
const url = 'https://api.customerhub.com/web_api/password';
const options = {
  method: 'PATCH',
  headers: {'Content-Type': 'application/json'},
  body: '{"token":"","password":"new_password","password_confirmation":"new_password"}'
};

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

```go Passwords_setNewPasswordViaResetToken_example
package main

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

func main() {

	url := "https://api.customerhub.com/web_api/password"

	payload := strings.NewReader("{\n  \"token\": \"\",\n  \"password\": \"new_password\",\n  \"password_confirmation\": \"new_password\"\n}")

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

	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 Passwords_setNewPasswordViaResetToken_example
require 'uri'
require 'net/http'

url = URI("https://api.customerhub.com/web_api/password")

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

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"token\": \"\",\n  \"password\": \"new_password\",\n  \"password_confirmation\": \"new_password\"\n}"

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

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

HttpResponse<String> response = Unirest.patch("https://api.customerhub.com/web_api/password")
  .header("Content-Type", "application/json")
  .body("{\n  \"token\": \"\",\n  \"password\": \"new_password\",\n  \"password_confirmation\": \"new_password\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.customerhub.com/web_api/password', [
  'body' => '{
  "token": "",
  "password": "new_password",
  "password_confirmation": "new_password"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Passwords_setNewPasswordViaResetToken_example
using RestSharp;

var client = new RestClient("https://api.customerhub.com/web_api/password");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"token\": \"\",\n  \"password\": \"new_password\",\n  \"password_confirmation\": \"new_password\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Passwords_setNewPasswordViaResetToken_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "token": "",
  "password": "new_password",
  "password_confirmation": "new_password"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.customerhub.com/web_api/password")! 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()
```