> ## Client identification
>
> Requests to this API should include a `Client-Platform` header alongside
> `Authorization`, identifying the application, tool, or model making the
> request. This is used for integration support and analytics.
>
> Use your model or tool name, for example `claude-code` or `chatgpt`.
>
> Example:
>
> ```bash
> curl https://api.salaryboxapp.com/... \
>   -H "Authorization: Api-Key <api-key>" \
>   -H "Client-Platform: claude-code"
> ```

# List Custom Fields

GET https://api.salaryboxapp.com/v2/customer/v1/company/custom-fields

Returns your company's custom staff profile fields (extra fields such as "Shirt Size" or "Bus Route") and each active staff member's value for every one of them.

`data` has two keys:

* `fields`: the names of all custom fields, oldest first. The full list is repeated on every page.
* `employees`: one entry per staff member, ordered by `salarybox_id`, each with `salarybox_id`, `name` and `values`. `values` has one key for every name in `fields`; a field that was not filled in is `null`.

Pages and `count` are over employees, not fields. If your company has no custom fields, `fields` is empty and every `values` is `{}`.

Reference: https://docs.salarybox.in/api-reference/company/custom-fields-retrieve

## Authentication

- `Authorization` header (required) (prefixed with ` Api-Key   `) — Format: "Api-Key \{api-key}"

## Request

### Query parameters

- `salarybox_ids` (list of string, optional) — Repeatable. Limits the result to these staff members, for example `salarybox_ids=SBK7Q2M9TX&salarybox_ids=SBK3H8D1LP`.
- `page` (integer, optional) — Page number, starting at 1.
- `page_size` (integer, optional) — Results per page. Default and maximum 500.

## Response

### 200

- `message` (string, required)
- `status` (boolean, required)
- `data` (CustomFieldsData, required)
- `count` (integer, required) — Total number of matching employees across all pages.
- `prev` (string, required, nullable) — URL of the previous page, or `null` on the first page.
- `next` (string, required, nullable) — URL of the next page, or `null` on the last page.

## Types

### CustomFieldsData

- `fields` (list of string, required) — Names of all of the company's custom fields, in creation order (oldest first). Repeated on every page.
- `employees` (list of CustomFieldEmployee, required) — Active staff on this page, ordered by `salarybox_id`.

### CustomFieldEmployee

- `salarybox_id` (string, required) — SalaryBox ID of the staff member.
- `name` (string, required) — Full name of the staff member.
- `values` (map from string to string, required) — The staff member's value for each custom field, keyed by field name. Has one key for every name in `fields`. `null` when the field has not been filled in.

## Examples

**Response**

```json
{
  "message": "Success",
  "status": true,
  "data": {
    "fields": [
      "Shirt Size",
      "Bus Route"
    ],
    "employees": [
      {
        "salarybox_id": "SBK3H8D1LP",
        "name": "Priya Nair",
        "values": {
          "Bus Route": null,
          "Shirt Size": "M"
        }
      },
      {
        "salarybox_id": "SBK7Q2M9TX",
        "name": "Aarav Sharma",
        "values": {
          "Bus Route": "Route 12",
          "Shirt Size": "L"
        }
      }
    ]
  },
  "count": 2,
  "prev": null,
  "next": null
}
```

**SDK Code**

```python Example
import requests

url = "https://api.salaryboxapp.com/v2/customer/v1/company/custom-fields"

headers = {"Authorization": "Api-Key  <apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript Example
const url = 'https://api.salaryboxapp.com/v2/customer/v1/company/custom-fields';
const options = {method: 'GET', headers: {Authorization: 'Api-Key  <apiKey>'}};

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

```go Example
package main

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

func main() {

	url := "https://api.salaryboxapp.com/v2/customer/v1/company/custom-fields"

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

	req.Header.Add("Authorization", "Api-Key  <apiKey>")

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

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

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

}
```

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

url = URI("https://api.salaryboxapp.com/v2/customer/v1/company/custom-fields")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Api-Key  <apiKey>'

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

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

HttpResponse<String> response = Unirest.get("https://api.salaryboxapp.com/v2/customer/v1/company/custom-fields")
  .header("Authorization", "Api-Key  <apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.salaryboxapp.com/v2/customer/v1/company/custom-fields', [
  'headers' => [
    'Authorization' => 'Api-Key  <apiKey>',
  ],
]);

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

```csharp Example
using RestSharp;

var client = new RestClient("https://api.salaryboxapp.com/v2/customer/v1/company/custom-fields");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Api-Key  <apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Example
import Foundation

let headers = ["Authorization": "Api-Key  <apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.salaryboxapp.com/v2/customer/v1/company/custom-fields")! 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()
```