# List object types' record types

`GET /v4/records/{plural_slug}/types`

Lists the active types of one record type, such as Candidate and Contact for people, for `PUT /v4/records/{plural_slug}/{id}/types`. `id` is the prefixed form the record's `types` attribute uses. Requires `<plural_slug>:read`; `records:read` also covers custom types. Archived record definitions still list.

Authentication (security requirement alternatives):

```json
[
  {
    "bearer_auth": [
      "<plural_slug>:read"
    ]
  },
  {
    "oauth2_auth": [
      "<plural_slug>:read"
    ]
  },
  {
    "apikey_auth": [
      "<plural_slug>:read"
    ]
  }
]
```

- bearer_auth: http (bearer). API key or OAuth access token in Authorization header; scopes: <plural_slug>:read
- oauth2_auth: oauth2. OAuth authorization code flow with mandatory S256 PKCE.; scopes: <plural_slug>:read
- apikey_auth: apiKey, query api_key. API key in query string; scopes: <plural_slug>:read

Parameters:

- `plural_slug` (path, string, required) - Plural slug from `GET /v4/records`, such as `people`.
  Type: string

Responses:

- 200: Types

Content type: application/json

Type: object

Schema: [ObjectTypesListResponse](https://docs.searchsoftware.nl/api/models/objecttypeslistresponse.md)

- `status` (required)
  Type: string
  
  enum: ["ok"]
  
  Example:
  
  ```json
  "ok"
  ```

- `data` (required)
  Type: array
  
  Items:
    Reference: [ObjectTypeValue](https://docs.searchsoftware.nl/api/models/objecttypevalue.md); Type: object

- 401: Invalid credential

Content type: application/json

Type: unknown

Example:

```json
{
  "status": "error",
  "error": {
    "code": "INVALID_API_KEY",
    "status_code": 401,
    "message": "Invalid API key"
  }
}
```

allOf:
  Reference: [ErrorResponse](https://docs.searchsoftware.nl/api/models/errorresponse.md); Type: object

```json
{
  "status": "error",
  "error": {
    "code": "INVALID_API_KEY",
    "status_code": 401,
    "message": "Invalid API key"
  }
}
```

- 403: Missing required scope

Content type: application/json

Type: unknown

Example:

```json
{
  "status": "error",
  "error": {
    "code": "FORBIDDEN",
    "status_code": 403,
    "message": "Insufficient scope"
  }
}
```

allOf:
  Reference: [ErrorResponse](https://docs.searchsoftware.nl/api/models/errorresponse.md); Type: object

```json
{
  "status": "error",
  "error": {
    "code": "FORBIDDEN",
    "status_code": 403,
    "message": "Insufficient scope"
  }
}
```

- 404: Unknown record type

Content type: application/json

Type: unknown

Example:

```json
{
  "status": "error",
  "error": {
    "code": "NOT_FOUND",
    "status_code": 404,
    "message": "Record not found"
  }
}
```

allOf:
  Reference: [ErrorResponse](https://docs.searchsoftware.nl/api/models/errorresponse.md); Type: object

```json
{
  "status": "error",
  "error": {
    "code": "NOT_FOUND",
    "status_code": 404,
    "message": "Record not found"
  }
}
```

## Examples

### cURL

```bash
curl -X GET 'https://api.searchsoftware.nl/v4/records/string/types' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### TypeScript

```typescript
const response = await fetch('https://api.searchsoftware.nl/v4/records/string/types', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://api.searchsoftware.nl/v4/records/string/types',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```

### Ruby

```ruby
require 'net/http'
require 'json'

uri = URI('https://api.searchsoftware.nl/v4/records/string/types')
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer YOUR_TOKEN'

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') { |http| http.request(request) }
data = JSON.parse(response.body)
```

### Go

```go
package main

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

func main() {
  req, _ := http.NewRequest("GET", "https://api.searchsoftware.nl/v4/records/string/types", nil)
  req.Header.Set("Authorization", "Bearer YOUR_TOKEN")
  resp, _ := http.DefaultClient.Do(req)
  defer resp.Body.Close()
  data, _ := io.ReadAll(resp.Body)
  fmt.Println(string(data))
}
```

### PHP

```php
<?php
$ch = curl_init('https://api.searchsoftware.nl/v4/records/string/types');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_TOKEN']);

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
```

### Rust

```rust
use reqwest;

#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    let client = reqwest::Client::new();
    let response = client.get("https://api.searchsoftware.nl/v4/records/string/types")
        .header("Authorization", "Bearer YOUR_TOKEN")
        .send()
        .await?
        .text()
        .await?;
    println!("{}", response);
    Ok(())
}
```
