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

# Authenticate

POST https://one.mtxsci.com/api/1.1/wf/authenticate-v2
Content-Type: application/json

## Authenticate

Exchange a Matrix Customer Portal user's email and password for a Bearer token.

**Request:** `POST https://one.mtxsci.com/api/1.1/wf/authenticate-v2`

**Authentication:** No existing token is required.

**Headers:** `Content-Type: application/json` and `Accept: application/json`.

### Request fields

| Field      | Type   | Requirement                           |
| ---------- | ------ | ------------------------------------- |
| `email`    | String | Required. User's login email address. |
| `password` | String | Required. User's password.            |

### Response fields

`200 OK` returns JSON with `Content-Type: application/json`.

| Field              | Type    | Description                                     |
| ------------------ | ------- | ----------------------------------------------- |
| `status`           | String  | `"success"` in the saved example.               |
| `response.token`   | String  | Bearer token for all subsequent API requests.   |
| `response.user_id` | String  | Authenticated user identifier.                  |
| `response.expires` | Integer | Token lifetime in seconds. `86400` is 24 hours. |

Pass `Authorization: Bearer <token>` using `response.token`. Authenticate again when the token expires. In Postman, supply it as the collection's private local `token` value. Customer selection follows authentication; this request does not take `customer_id`.

Reference: https://docs.one.mtxsci.com/ms-cp-customer-api/authenticate

## Request

### Body (application/json)

This endpoint expects an object.

- `email` (string, required) — Required. User's login email address.
- `password` (string, required) — Required. User's password.

## Response

### 200

OK

- `status` (string, optional) — `"success"` in the saved example.
- `response` (AuthenticateV2PostResponsesContentApplicationJsonSchemaResponse, optional)

## Types

### AuthenticateV2PostResponsesContentApplicationJsonSchemaResponse

- `token` (string, optional) — Bearer token for all subsequent API requests.
- `user_id` (string, optional) — Authenticated user identifier.
- `expires` (integer, optional) — Token lifetime in seconds. `86400` is 24 hours.

## Examples

**Request**

```json
{
  "email": "user@example.com",
  "password": "your-password"
}
```

**Response**

```json
{
  "status": "success",
  "response": {
    "token": "string",
    "user_id": "string",
    "expires": 86400
  }
}
```

**SDK Code**

```python authenticate_example
import requests

url = "https://one.mtxsci.com/api/1.1/wf/authenticate-v2"

payload = {
    "email": "user@example.com",
    "password": "your-password"
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript authenticate_example
const url = 'https://one.mtxsci.com/api/1.1/wf/authenticate-v2';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"email":"user@example.com","password":"your-password"}'
};

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

```go authenticate_example
package main

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

func main() {

	url := "https://one.mtxsci.com/api/1.1/wf/authenticate-v2"

	payload := strings.NewReader("{\n  \"email\": \"user@example.com\",\n  \"password\": \"your-password\"\n}")

	req, _ := http.NewRequest("POST", 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 authenticate_example
require 'uri'
require 'net/http'

url = URI("https://one.mtxsci.com/api/1.1/wf/authenticate-v2")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"email\": \"user@example.com\",\n  \"password\": \"your-password\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://one.mtxsci.com/api/1.1/wf/authenticate-v2")
  .header("Content-Type", "application/json")
  .body("{\n  \"email\": \"user@example.com\",\n  \"password\": \"your-password\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://one.mtxsci.com/api/1.1/wf/authenticate-v2', [
  'body' => '{
  "email": "user@example.com",
  "password": "your-password"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp authenticate_example
using RestSharp;

var client = new RestClient("https://one.mtxsci.com/api/1.1/wf/authenticate-v2");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"email\": \"user@example.com\",\n  \"password\": \"your-password\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift authenticate_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "email": "user@example.com",
  "password": "your-password"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://one.mtxsci.com/api/1.1/wf/authenticate-v2")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```