# Business Fields

- Sandbox: `GET https://sandbox.payme.io/api/business-fields`
- Production: `GET https://live.payme.io/api/business-fields`

## Credentials

- Header `PayMe-Partner-Key` (API key)
- Query parameter `seller_payme_id` (optional): Your seller ID (MPL), as an alternative to PayMe-Partner-Key.

## Overview
Returns the list of business fields (the seller's line of business), for example when creating a seller. Each field has a numeric `code`, an international (English) name and a local name.

To get a single field, add its code to the path: `GET /business-fields/{code}`.

## Authentication
Send your own partner key (`payme_client_key`) in the `PayMe-Partner-Key` header. A seller can send its `seller_payme_id` instead. Without either, the call fails with error `1` (`status_additional_info`: `payme_client_key`).

## Response structure
- `status_code`: `0` on success.
- `page`, `items_per_page`, `items_total`: paging information.
- `language`: the language of `name_local`.
- `items`: the business fields, keyed by position; each has `code`, `name_intl` and `name_local`.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `PayMe-Partner-Key` | header | string | no | Your partner key (payme_client_key). Required unless you send seller_payme_id. |
| `seller_payme_id` | query | string | no | Your seller ID (MPL), as an alternative to PayMe-Partner-Key. |
| `sort_by` | query | string | no | Field to sort by, for example name_local. Default code. |
| `sort_direction` | query | string | no | desc for descending; any other value sorts ascending. |
| `language` | query | string | no | Language of name_local (he, en, es, ru or ar). Default Hebrew. |
| `allow_children` | query | boolean | no | Also return child business fields. |

## Code samples

### curl

```bash
curl -X GET 'https://sandbox.payme.io/api/business-fields?seller_payme_id=<seller_payme_id>' \
  -H 'PayMe-Partner-Key: <PayMe-Partner-Key>'
```

### Node.js

```javascript
const response = await fetch("https://sandbox.payme.io/api/business-fields?seller_payme_id=<seller_payme_id>", {
  method: "GET",
  headers: {
    "PayMe-Partner-Key": "<PayMe-Partner-Key>",
  },
});

console.log(await response.text());
```

### Python

```python
import requests

response = requests.get(
    "https://sandbox.payme.io/api/business-fields?seller_payme_id=<seller_payme_id>",
    headers={
        "PayMe-Partner-Key": "<PayMe-Partner-Key>",
    },
)

print(response.text)
```

### PHP

```php
<?php

$ch = curl_init('https://sandbox.payme.io/api/business-fields?seller_payme_id=<seller_payme_id>');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'PayMe-Partner-Key: <PayMe-Partner-Key>',
    ],
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
```

## Responses

### default — Default (error)

| Field | Type | Description |
| --- | --- | --- |
| `status_code` | integer |  |
| `page` | integer |  |
| `items_per_page` | integer |  |
| `items_total` | integer |  |
| `language` | string |  |
| `items` | object |  |
| `items.244` | object |  |
| `items.244.code` | integer |  |
| `items.244.name_intl` | string |  |
| `items.244.name_local` | string |  |

```json
{
  "status_code": 0,
  "page": 1,
  "items_per_page": 245,
  "items_total": 245,
  "language": "he",
  "items": {
    "244": {
      "code": 10565,
      "name_intl": "Shutters",
      "name_local": "תריסים"
    }
  }
}
```
