---
description: Instantly categorize any bank transaction descriptions.
---

# Bank Transaction Categorization

{% tabs %}
{% tab title="Python" %}
```
import requests

URL = "https://api.photoncommerce.com/api/v2/banktxn/"
params = {
  "api_key": <your_api_key>, 
  "txns": ["AMAZON PAY", "SHOPIFY TRANSFER", "CREDIT ON AMEX"]
}
response = requests.get(URL, params=params)
```
{% endtab %}

{% tab title="cURL" %}
```
curl "https://api.photoncommerce.com/api/v2/banktxn?api_key=<api_key>&txns=<txns>" 
```
{% endtab %}

{% tab title="Node.js" %}
```
var request = require('request');

var options = {
    url: 'https://api.photoncommerce.com/api/v2/banktxn?api_key=<api_key>&txns=<txns>'
};

function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}

request(options, callback);
```
{% endtab %}

{% tab title="Java" %}
```
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;

class Main {

	public static void main(String[] args) throws IOException {
		URL url = new URL("https://api.photoncommerce.com/api/v2/banktxn?api_key=<api_key>&txns=<txns>");
		HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
		httpConn.setRequestMethod("GET");

		InputStream responseStream = httpConn.getResponseCode() / 100 == 2
				? httpConn.getInputStream()
				: httpConn.getErrorStream();
		Scanner s = new Scanner(responseStream).useDelimiter("\\A");
		String response = s.hasNext() ? s.next() : "";
		System.out.println(response);
	}
}
```
{% endtab %}
{% endtabs %}

## Get Categories

<mark style="color:blue;">`GET`</mark> `https://api.photoncommerce.com/api/v2/banktxn/`

Send transactions in an array, where each transaction is a string. If there are multiple fields involved in a given transaction string, separate these by a "|" within the same string. \
\
This endpoint returns an array of categorizes, where each element corresponds to the original transactions.\
\
If you require customized categories, please send your categories and data to train and tune the machine learning to banktransactions @ photoncommerce.com&#x20;

#### Query Parameters

| Name     | Type   | Description                                                                                                                                                                                                                                                                                                     |
| -------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| api\_key | string | The api\_key provided by Photon Commerce as a string                                                                                                                                                                                                                                                            |
| txns     | array  | An array of the bank transactions, each a string. Include the description of the transaction first, then the amount and id, separated by "\|" in a string. The txns array should be a 1-D array, where each element is a string. Omit dates and any other superfluous information irrelevant to categorization. |

{% tabs %}
{% tab title="200 " %}
```
{
  "categories": ["Amazon", "Shopify", "Credit Card"]
}
```
{% endtab %}

{% tab title="500 " %}
```
{
  "message": "Error with bank transaction categorization", 
  "status": "unsuccessful"
}
```
{% endtab %}
{% endtabs %}
