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

# Assign a transaction to an account holder

POST https://api.ntropy.com/v3/transactions/{id}/assign
Content-Type: application/json

Changes the account holder associated with the transaction. The old and new account holder must share the same `type`.

Reference: https://docs.ntropy.com/documentation/api/transactions/set-transaction-ah-v-3-transactions-id-assign-post

## Authentication

- `X-Api-Key` header (required) — API Key authentication via header

## Request

### Path parameters

- `id` (string, required)

### Body (application/json)

This endpoint expects a Body_set_transaction_ah_v3_transactions__id__assign_post.

- `account_holder_id` (string, required)

## Response

### 200

Successful Response

- `id` (string, required) — A unique identifier of the transaction
- `description` (string, required) — The description string of the transaction
- `date` (date, required) — The date that the transaction was posted. Uses ISO 8601 format (YYYY-MM-DD)
- `amount` (double, required) — The amount of the transaction in the `currency`. Must be a positive value. For example, if the `currency` is USD, then it's the amount in dollars.
- `entry_type` (enum, required) — The direction of the flow of the money from the perspective of the account holder. `outgoing` to represent money leaving the account, such as purchases or fees, while `incoming` represents money entering the account, such as income or refunds.
  - Allowed values: `incoming`, `outgoing`
- `currency` (enum, required) — The currency of the transaction in ISO 4217 format
  - Allowed values: `EUR`, `AED`, `AFN`, `XCD`, `ALL`, `AMD`, `AOA`, `ARS`, `USD`, `AUD`, `AWG`, `AZN`, `BAM`, `BBD`, `BDT`, `XOF`, `BGN`, `BHD`, `BIF`, `BMD`, `BND`, `BOB`, `BRL`, `BSD`, `INR`, `NOK`, `BWP`, `BYR`, `BZD`, `CAD`, `CDF`, `XAF`, `CHF`, `NZD`, `CLP`, `CNY`, `COP`, `CRC`, `CUP`, `CVE`, `ANG`, `CZK`, `DJF`, `DKK`, `DOP`, `DZD`, `EGP`, `MAD`, `ERN`, `ETB`, `FJD`, `FKP`, `GBP`, `GEL`, `GHS`, `GIP`, `GMD`, `GNF`, `GTQ`, `GYD`, `HKD`, `HNL`, `HUF`, `IDR`, `ILS`, `IQD`, `IRR`, `ISK`, `JMD`, `JOD`, `JPY`, `KES`, `KGS`, `KHR`, `KMF`, `KPW`, `KRW`, `KWD`, `KYD`, `KZT`, `LAK`, `LBP`, `LKR`, `LRD`, `ZAR`, `LYD`, `MDL`, `MGA`, `MKD`, `MMK`, `MNT`, `MOP`, `MRO`, `MUR`, `MVR`, `MWK`, `MXN`, `MYR`, `MZN`, `XPF`, `NGN`, `NIO`, `NPR`, `OMR`, `PEN`, `PGK`, `PHP`, `PKR`, `PLN`, `PYG`, `QAR`, `RON`, `RSD`, `RUB`, `RWF`, `SAR`, `SBD`, `SCR`, `SDG`, `SEK`, `SGD`, `SHP`, `SLL`, `SOS`, `SRD`, `SSP`, `STD`, `SYP`, `SZL`, `THB`, `TJS`, `TMT`, `TND`, `TOP`, `TRY`, `TTD`, `TWD`, `TZS`, `UAH`, `UGX`, `UYU`, `UZS`, `VEF`, `VND`, `VUV`, `WST`, `YER`, `ZMW`, `ZWL`, `HRK`
- `created_at` (datetime, required) — The timestamp of when the account holder was created.
- `entities` (Entities, optional, nullable) — Entities found by identity identification
- `categories` (Categories, optional, nullable)
- `location` (Location, optional, nullable)
- `error` (TransactionError, optional, nullable)
- `account_holder_id` (string, optional, nullable) — The unique ID of the account holder of the transaction

## Errors

### 404 Not Found Error

Transaction or account holder with the provided id not found.

- `any`

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### Entities

Entities found by identity identification

- `counterparty` (Counterparty, optional, nullable)
- `intermediaries` (list of Intermediary, optional)

### Categories

- `general` (string, required, nullable) — The category of the transaction. View the valid set of categories for your key [here](../../../categories).
- `accounting` (enum, optional, nullable) — The corresponding accounting category. Only available for `business` transactions.
  - Allowed values: `operational expenses`, `cost of goods sold`, `revenue`, `financing`, `taxes`, `investing`, `not enough information`

### Location

- `raw_address` (string, optional, nullable) — An unstructured string containing the address
- `structured` (LocationStructured, optional, nullable) — When raw is set, a structured representation of it.

### TransactionError

- `code` (enum, required)
  - Allowed values: `account_holder_not_found`, `internal_error`
- `message` (string, required)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### Counterparty

- `type` (enum, required)
  - Allowed values: `person`, `organization`
- `id` (string, optional, nullable) — The unique UUID identifier of the entity
- `name` (string, optional, nullable) — The name of the entity
- `website` (string, optional, nullable) — The website URL of the entity
- `phone_number` (string, optional, nullable) — The phone number of the entity. This is a premium feature, please contact support to enable it.
- `tax_number` (string, optional, nullable) — The tax number of the entity. This is a premium feature, please contact support to enable it.
- `naics2017` (string, optional, nullable) — The 2017 NAICS code of the entity. This is a premium feature, please contact support to enable it.
- `logo` (string, optional, nullable) — Logo's URL
- `mccs` (list of integer, optional) — A list of [Merchant Category Codes](https://en.wikipedia.org/wiki/Merchant_category_code)
- `parent` (EntityParent, optional, nullable) — The parent entity

### Intermediary

- `id` (string, optional, nullable) — The unique UUID identifier of the entity
- `name` (string, optional, nullable) — The name of the entity
- `website` (string, optional, nullable) — The website URL of the entity
- `phone_number` (string, optional, nullable) — The phone number of the entity. This is a premium feature, please contact support to enable it.
- `tax_number` (string, optional, nullable) — The tax number of the entity. This is a premium feature, please contact support to enable it.
- `naics2017` (string, optional, nullable) — The 2017 NAICS code of the entity. This is a premium feature, please contact support to enable it.
- `logo` (string, optional, nullable) — Logo's URL
- `mccs` (list of integer, optional) — A list of [Merchant Category Codes](https://en.wikipedia.org/wiki/Merchant_category_code)
- `parent` (EntityParent, optional, nullable) — The parent entity

### LocationStructured

- `street` (string, optional, nullable) — The street name of the location
- `city` (string, optional, nullable) — The city where the location is situated
- `state` (string, optional, nullable) — The state or region of the location
- `postcode` (string, optional, nullable) — The postal code or ZIP code of the location
- `country_code` (string, optional, nullable) — The country code of the location in ISO 3166-2 format
- `country` (string, optional, nullable) — The full name of the country
- `house_number` (string, optional, nullable) — The house number if, applicable
- `latitude` (double, optional, nullable) — The latitude coordinate of the location
- `longitude` (double, optional, nullable) — The longitude coordinate of the location
- `google_maps_url` (string, optional, nullable) — A URL link to view the location on Google Maps
- `apple_maps_url` (string, optional, nullable) — A URL link to view the location on Apple Maps
- `store_number` (string, optional, nullable) — A unique identifier for a specific store or branch, if applicable

### ValidationErrorLocItems

### EntityParent

- `id` (string, optional, nullable) — The unique UUID identifier of the entity
- `name` (string, optional, nullable) — The name of the entity
- `website` (string, optional, nullable) — The website URL of the entity
- `phone_number` (string, optional, nullable) — The phone number of the entity. This is a premium feature, please contact support to enable it.
- `tax_number` (string, optional, nullable) — The tax number of the entity. This is a premium feature, please contact support to enable it.
- `naics2017` (string, optional, nullable) — The 2017 NAICS code of the entity. This is a premium feature, please contact support to enable it.

## Examples

**Request**

```json
{
  "account_holder_id": "string"
}
```

**Response**

```json
{
  "id": "xbx8YP14g565Xk",
  "description": "SQ* STARBUCKS 10 Union Sq",
  "date": "2024-03-30",
  "amount": 10,
  "entry_type": "outgoing",
  "currency": "USD",
  "created_at": "2024-03-30T00:00:00",
  "entities": {
    "counterparty": {
      "type": "organization",
      "id": "d4bc3c80-ec1a-3da2-836e-2a4ca4758be5",
      "name": "Starbucks",
      "website": "starbucks.com",
      "phone_number": "+1 4153753176",
      "tax_number": "80-0429876",
      "naics2017": "541519",
      "logo": "https://logos.ntropy.com/starbucks.com",
      "mccs": [
        5814
      ]
    },
    "intermediaries": [
      {
        "id": "916bc837-55ef-3106-88f6-5a8269ca9f2a",
        "name": "Square, Inc.",
        "website": "squareup.com",
        "logo": "https://logos.ntropy.com/squareup.com",
        "mccs": []
      }
    ]
  },
  "categories": {
    "general": "coffee shop"
  },
  "location": {
    "raw_address": "10 Union Square E, New York, New York 10003, United States",
    "structured": {
      "street": "Union Square East",
      "city": "New York",
      "state": "New York",
      "postcode": "10003",
      "country_code": "US",
      "country": "United States",
      "house_number": "10",
      "latitude": 40.734834,
      "longitude": -73.989782,
      "google_maps_url": "https://www.google.com/maps/search/?api=1&query=40.734834,-73.989782",
      "apple_maps_url": "https://maps.apple.com/?q=40.734834,-73.989782"
    }
  },
  "account_holder_id": "35b927b6-6fda-40aa-93b8-95b47c2b2cad"
}
```

**SDK Code**

```python Python SDK
from ntropy_sdk import SDK

sdk = SDK("cd1H...Wmhl")
sdk.transactions.assign(
    transaction_id="xbx8YP14g565Xk",
    account_holder_id="35b927b6-6fda-40aa-93b8-95b47c2b2cad",
)
```

```javascript
const url = 'https://api.ntropy.com/v3/transactions/id/assign';
const options = {
  method: 'POST',
  headers: {'X-Api-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"account_holder_id":"string"}'
};

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.ntropy.com/v3/transactions/id/assign"

	payload := strings.NewReader("{\n  \"account_holder_id\": \"string\"\n}")

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

	req.Header.Add("X-Api-Key", "<apiKey>")
	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.ntropy.com/v3/transactions/id/assign")

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

request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"account_holder_id\": \"string\"\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.post("https://api.ntropy.com/v3/transactions/id/assign")
  .header("X-Api-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"account_holder_id\": \"string\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.ntropy.com/v3/transactions/id/assign', [
  'body' => '{
  "account_holder_id": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-Api-Key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.ntropy.com/v3/transactions/id/assign");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Api-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"account_holder_id\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Api-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["account_holder_id": "string"] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.ntropy.com/v3/transactions/id/assign")! 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()
```