# Create CardHolder

### Create a new Cardholder

## Create a new Cardholder

<mark style="color:green;">`POST`</mark> `/`[`cardholder/create_cardholder`](https://api.coopfinnetwork.com/v1/sandbox/cardholder/create_cardholder)

\<Description of the endpoint>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

| Name             | Type   | Description                                                                                                                                    |
| ---------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| firstname        | string | Firstname of the Cardholder                                                                                                                    |
| lastname         | string | Lastname of the Cardholder                                                                                                                     |
| gender           | string | Carholder gender 'M' or 'F'                                                                                                                    |
| email            | string | Carholder email                                                                                                                                |
| phone            | string | Cardholder phone number                                                                                                                        |
| country          | string | <p><br>Customer's country. Please click <a href="https://docs.krezypay.com/card/countries-we-support">here </a>to see supported countries.</p> |
| id\_type         | string | The type of cardholder's identity documents: ID\_CARD or PASSPORT                                                                              |
| id\_number       | string | The cardholder's ID number                                                                                                                     |
| face\_id\_image  | string | The url of the selfie image of the cardholder's ID                                                                                             |
| front\_id\_image | string | The URL of the front image of the cardholder's ID document                                                                                     |
| back\_id\_image  | string | The url of the image of the back of the cardholder's ID to send if the ID type is ID\_CARD                                                     |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "status": "success",
    "carholder_id": "6a035aa58d4a21d1f0943c7afbce4",
    "message": "Cardholder registered successfully"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="JavaScript" %}

```javascript

const url = 'https://api.coopfinnetwork.com/v1/sandbox/cardholder/create_cardholder';

const data = {
    "firstname": "Michael",
    "lastname": "Johnson",
    "email": "michael.johnson@example.com",
    "phone": "+12025550189",
    "gender": "M",
    "country": "UNITED STATES",
    "id_type": "PASSPORT",
    "id_number": "P87456321",
    "front_id_image": "https://cdn.example.com/kyc/front_passport_001.png",
    "face_id_image": "https://cdn.example.com/kyc/selfie_001.png",
    "back_id_image": "https://cdn.example.com/kyc/back_passport_001.png"
};

// Bearer Token
const token = 'your_bearer_token_here';

fetch(url, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${token}`
    },
    body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
    console.log('Success:', result);
})
.catch(error => {
    console.error('Error:', error);
});


```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.coopfinnetwork.com/v1/sandbox/cardholder/create_cardholder"

payload = {
    "firstname": "Michael",
    "lastname": "Johnson",
    "email": "michael.johnson@example.com",
    "phone": "+12025550189",
    "gender": "M",
    "country": "UNITED STATES",
    "id_type": "PASSPORT",
    "id_number": "P87456321",
    "front_id_image": "https://cdn.example.com/kyc/front_passport_001.png",
    "face_id_image": "https://cdn.example.com/kyc/selfie_001.png",
    "back_id_image": "https://cdn.example.com/kyc/back_passport_001.png"
}

token = "your_bearer_token_here"

headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {token}"
}

response = requests.post(url, json=payload, headers=headers)

print(response.status_code)
print(response.json())
```

{% endtab %}

{% tab title="PHP" %}

```ruby
<?php

$url = "https://api.coopfinnetwork.com/v1/sandbox/cardholder/create_cardholder";

$data = [
    "firstname" => "Michael",
    "lastname" => "Johnson",
    "email" => "michael.johnson@example.com",
    "phone" => "+12025550189",
    "gender" => "M",
    "country" => "UNITED STATES",
    "id_type" => "PASSPORT",
    "id_number" => "P87456321",
    "front_id_image" => "https://cdn.example.com/kyc/front_passport_001.png",
    "face_id_image" => "https://cdn.example.com/kyc/selfie_001.png",
    "back_id_image" => "https://cdn.example.com/kyc/back_passport_001.png"
];

$token = "your_bearer_token_here";

$headers = [
    "Content-Type: application/json",
    "Authorization: Bearer " . $token
];

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if(curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);

?>
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        var url = "https://api.coopfinnetwork.com/v1/sandbox/cardholder/create_cardholder";

        var json = @"
        {
            ""firstname"": ""Michael"",
            ""lastname"": ""Johnson"",
            ""email"": ""michael.johnson@example.com"",
            ""phone"": ""+12025550189"",
            ""gender"": ""M"",
            ""country"": ""UNITED STATES"",
            ""id_type"": ""PASSPORT"",
            ""id_number"": ""P87456321"",
            ""front_id_image"": ""https://cdn.example.com/kyc/front_passport_001.png"",
            ""face_id_image"": ""https://cdn.example.com/kyc/selfie_001.png"",
            ""back_id_image"": ""https://cdn.example.com/kyc/back_passport_001.png""
        }";

        var token = "your_bearer_token_here";

        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token}");

            var content = new StringContent(json, Encoding.UTF8, "application/json");

            HttpResponseMessage response = await client.PostAsync(url, content);

            string result = await response.Content.ReadAsStringAsync();

            Console.WriteLine(result);
        }
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coopfinnetwork.com/card/cardholder/create-cardholder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
