> This page is for North America.

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

# Get user

GET https://sandbox.trustly.one/api/v1/transactions/{transactionId}/user

Retrieve the User object associated with the Trustly ID authorization transaction.

Reference: https://trustly.ferndocs.com/api-reference/api/identity/get-trustly-id-user-data

## Authentication

- `Authorization` header (basic auth, required) — Basic authentication of the form `Basic <base64(username:password)>`.

## Request

### Path parameters

- `transactionId` (string, required) — Transaction ID retrieved from a Trustly Authorization transaction.

### Query parameters

- `expand` (list of enum, optional) — A field in the API response to be expanded in order for more details to be provided. Supported values: * `segmentedName`: returns a segmented version of the name field returned in the response.
  - Allowed values: `segmentedName`

## Response

### 200

OK

- `name` (string, optional) — The full name of the user
- `address` (list of schemas-Address, optional) — Array of addresses associated with the user.
- `phone` (list of string, optional) — Array of phone numbers associated with the user.
- `email` (list of string, optional) — Array of e-mail addresses associated with the user.
- `dateOfBirth` (string, optional) — The date of birth of the user in the format YYYY-MM-DD
- `taxId` (string, optional) — The user's government issued tax ID e.g. SSN (US) or SIN (CA)
- `deceased` (boolean, optional) — If `true`, then the user is deceased.
- `driverLicense` (schemas-DriverLicense, optional) — A driver's license.
- `eligible` (boolean, optional) — Indicates if the user has got a successful result in all verifications and is eligible.
- `createdAt` (integer, optional) — Timestamp representing the time the User Object was created.
- `updatedAt` (integer, optional) — Timestamp representing the time the User Object was last updated.
- `segmentedName` (SegmentedName, optional) — The segmented version of a given name.

## Errors

### 400 Bad Request Error

Bad Request

- `errors` (list of TransactionsTransactionIdUserGetResponsesContentApplicationJsonSchemaErrorsItems, required)

## Types

### schemas-Address

- `country` (enum, required) — 2 character ISO Country code. Currently only the US is supported.
  - Allowed values: `US`
- `address1` (string, optional) — Address Line 1.
- `address2` (string, optional) — Address Line 2.
- `city` (string, optional) — Address City.
- `state` (string, optional) — 2 character ISO State code.
- `zip` (string, optional) — 5 character US Zip Code.

### schemas-DriverLicense

A driver's license.

- `number` (string, optional) — The driver's license number. Even though this field is called 'number', it may contain non-numeric characters if the country allows that.
- `state` (string, optional) — 2 character ISO State code.

### SegmentedName

The segmented version of a given name.

- `title` (string, optional) — The title of a given full name.
- `firstName` (string, optional) — The first name of a given full name.
- `middleName` (list of string, optional) — The list of middle names of a given full name.
- `lastName` (string, optional) — The last name of a given full name.
- `suffix` (string, optional) — The suffix of a given full name.

### TransactionsTransactionIdUserGetResponsesContentApplicationJsonSchemaErrorsItems

- `domain` (string, required)
- `code` (double, required)
- `location` (string, required)
- `message` (string, required)
- `occurredAt` (double, required)

## Examples

### User

**Response**

```json
{
  "user": {
    "name": "Robert Allen Brown",
    "address": [
      {
        "address1": "567 Cedar St",
        "city": "Denver",
        "state": "Colorado",
        "zip": "80201",
        "country": "United States"
      }
    ],
    "phone": [
      "+1 210-987-6543"
    ],
    "email": [
      "robert.brown@example.com"
    ],
    "dateOfBirth": "1989-12-21",
    "taxId": "301456789",
    "driverLicense": {
      "number": "124ABC",
      "state": "CA"
    },
    "eligible": true
  }
}
```

**SDK Code**

```python User
import requests

url = "https://sandbox.trustly.one/api/v1/transactions/transactionId/user"

response = requests.get(url, auth=("<username>", "<password>"))

print(response.json())
```

```javascript User
const url = 'https://sandbox.trustly.one/api/v1/transactions/transactionId/user';
const credentials = btoa("<username>:<password>");

const options = {method: 'GET', headers: {Authorization: `Basic ${credentials}`}};

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

```go User
package main

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

func main() {

	url := "https://sandbox.trustly.one/api/v1/transactions/transactionId/user"

	req, _ := http.NewRequest("GET", url, nil)

	req.SetBasicAuth("<username>", "<password>")

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

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

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

}
```

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

url = URI("https://sandbox.trustly.one/api/v1/transactions/transactionId/user")

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

request = Net::HTTP::Get.new(url)
request.basic_auth("<username>", "<password>")

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

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

HttpResponse<String> response = Unirest.get("https://sandbox.trustly.one/api/v1/transactions/transactionId/user")
  .basicAuth("<username>", "<password>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://sandbox.trustly.one/api/v1/transactions/transactionId/user', [
  'headers' => [
  ],
    'auth' => ['<username>', '<password>'],
]);

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

```csharp User
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://sandbox.trustly.one/api/v1/transactions/transactionId/user");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.GET);

IRestResponse response = client.Execute(request);
```

```swift User
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = ["Authorization": "Basic \(credentials)"]

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox.trustly.one/api/v1/transactions/transactionId/user")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```

### User - With Segmented Name

**Response**

```json
{
  "user": {
    "name": "Robert Allen Brown",
    "address": [
      {
        "address1": "567 Cedar St",
        "city": "Denver",
        "state": "Colorado",
        "zip": "80201",
        "country": "United States"
      }
    ],
    "phone": [
      "+1 210-987-6543"
    ],
    "email": [
      "robert.brown@example.com"
    ],
    "dateOfBirth": "1989-12-21",
    "taxId": "301456789",
    "driverLicense": {
      "number": "124ABC",
      "state": "CA"
    },
    "eligible": true,
    "segmentedName": {
      "firstName": "Robert",
      "middleName": [
        "Allen"
      ],
      "lastName": "Brown"
    }
  }
}
```

**SDK Code**

```python User - With Segmented Name
import requests

url = "https://sandbox.trustly.one/api/v1/transactions/transactionId/user"

response = requests.get(url, auth=("<username>", "<password>"))

print(response.json())
```

```javascript User - With Segmented Name
const url = 'https://sandbox.trustly.one/api/v1/transactions/transactionId/user';
const credentials = btoa("<username>:<password>");

const options = {method: 'GET', headers: {Authorization: `Basic ${credentials}`}};

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

```go User - With Segmented Name
package main

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

func main() {

	url := "https://sandbox.trustly.one/api/v1/transactions/transactionId/user"

	req, _ := http.NewRequest("GET", url, nil)

	req.SetBasicAuth("<username>", "<password>")

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

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

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

}
```

```ruby User - With Segmented Name
require 'uri'
require 'net/http'

url = URI("https://sandbox.trustly.one/api/v1/transactions/transactionId/user")

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

request = Net::HTTP::Get.new(url)
request.basic_auth("<username>", "<password>")

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

```java User - With Segmented Name
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://sandbox.trustly.one/api/v1/transactions/transactionId/user")
  .basicAuth("<username>", "<password>")
  .asString();
```

```php User - With Segmented Name
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://sandbox.trustly.one/api/v1/transactions/transactionId/user', [
  'headers' => [
  ],
    'auth' => ['<username>', '<password>'],
]);

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

```csharp User - With Segmented Name
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://sandbox.trustly.one/api/v1/transactions/transactionId/user");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.GET);

IRestResponse response = client.Execute(request);
```

```swift User - With Segmented Name
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = ["Authorization": "Basic \(credentials)"]

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox.trustly.one/api/v1/transactions/transactionId/user")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```