> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.getkard.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.getkard.com/_mcp/server.

# Create User

POST https://rewards-api.getkard.com/users/users
Content-Type: application/json

Call this endpoint to enroll a specified user into your rewards program. Learn more about the [Enrolling Users](https://github.com/kard-financial/kard-postman#a-cardholders) flow based on your use case here.
Required scopes: `user:write`

Reference: https://docs.getkard.com/legacy/api/users/create-user

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://rewards-api.getkard.com` (Production, default)
- `https://test-rewards-api.getkard.com` (Sandbox)

## Request

### Body (application/json)

This endpoint expects a CreateUserRequestBody.

- `referringPartnerUserId` (string, required) — Referring partner user ID of user from issuer. Must be a unique identifier across users
- `email` (string, optional) — Email of user; AT LEAST one of email or userName is REQUIRED. We HIGHLY RECOMMEND sending both.
- `hashedEmail` (string, optional) — Hashed email address of user (using SHA-256)
- `phoneNumber` (string, optional) — Phone number of user in E.164 format
- `birthYear` (string, optional) — Birth year of user
- `userName` (string, optional) — Username of user from issuer; AT LEAST one of email or userName is REQUIRED. We HIGHLY RECOMMEND sending both.
- `firstName` (string, optional) — First name of user. We HIGHLY RECOMMEND sending this field.
- `lastName` (string, optional) — Last name of user. We HIGHLY RECOMMEND sending this field.
- `zipCode` (string, optional) — Zipcode of user. We HIGHLY RECOMMEND sending this field as it may be required in the near future.
- `externalPartnerUserId` (string, optional) — Partner unique user id, might be equal to referringPartnerUserId
- `enrolledRewards` (list of enum, optional) — If field is not supplied, user will be automatically enrolled in all programs. Note, please do not send AFFILIATE as this field has been deprecated.
  - Allowed values: `CARDLINKED`, `AFFILIATE`
- `cards` (list of CardInfoRequest, optional) — List of User Cards Information. This is REQUIRED for matching purposes.
- `cardInfo` (CardInfoRequest, optional, deprecated) — \[Deprecated — please use 'cards' field] User Card Information
- `referringPartner` (string, optional, deprecated) — Issuer name

## Response

### 201

- `string`

## Errors

### 401 Unauthorized Error

- `message` (string, required)

### 400 Invalid Request

- `InvalidRequestUnion`

### 500 Internal Server Error

- `string`

### 404 Does Not Exist Error

- `string`

### 409 Conflict Error

- `string`

## Types

### CardInfoRequest

- `last4` (string, required) — Card last four digits. Note, this field is REQUIRED for matching purposes.
- `bin` (string, required) — Bank identification number (BIN). Must be a valid BIN of 6 digits. If over 6 digits, please send first 6.Note, this field is REQUIRED for matching purposes.
- `issuer` (string, required) — Issuer
- `network` (enum, required) — Name of card network
  - Allowed values: `VISA`, `MASTERCARD`, `AMERICAN EXPRESS`, `DISCOVER`
- `status` (enum, optional) — Status of card
  - Allowed values: `ENABLED`, `DISABLED`
- `token` (string, optional) — Card token
- `tokenSource` (string, optional) — Card token source

### RequestValidationErrorResponse

- `errors` (list of string, required)

## Examples

**Request**

```json
{
  "referringPartnerUserId": "1234567890",
  "email": "someone@email.com",
  "hashedEmail": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",
  "phoneNumber": "+12345678901",
  "birthYear": "1990",
  "userName": "some_user_name",
  "firstName": "John",
  "lastName": "Doe",
  "zipCode": "10028",
  "externalPartnerUserId": "1234567890",
  "enrolledRewards": [
    "CARDLINKED"
  ],
  "cards": [
    {
      "last4": "1234",
      "bin": "123456",
      "issuer": "Name_Of_Issuer",
      "network": "VISA"
    }
  ]
}
```

**Response**

```json
"New user event sent for processing"
```

**SDK Code**

```python
import requests

url = "https://rewards-api.getkard.com/users/users"

payload = {
    "referringPartnerUserId": "1234567890",
    "email": "someone@email.com",
    "hashedEmail": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",
    "phoneNumber": "+12345678901",
    "birthYear": "1990",
    "userName": "some_user_name",
    "firstName": "John",
    "lastName": "Doe",
    "zipCode": "10028",
    "externalPartnerUserId": "1234567890",
    "enrolledRewards": ["CARDLINKED"],
    "cards": [
        {
            "last4": "1234",
            "bin": "123456",
            "issuer": "Name_Of_Issuer",
            "network": "VISA"
        }
    ]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://rewards-api.getkard.com/users/users';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"referringPartnerUserId":"1234567890","email":"someone@email.com","hashedEmail":"a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456","phoneNumber":"+12345678901","birthYear":"1990","userName":"some_user_name","firstName":"John","lastName":"Doe","zipCode":"10028","externalPartnerUserId":"1234567890","enrolledRewards":["CARDLINKED"],"cards":[{"last4":"1234","bin":"123456","issuer":"Name_Of_Issuer","network":"VISA"}]}'
};

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

```go
package main

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

func main() {

	url := "https://rewards-api.getkard.com/users/users"

	payload := strings.NewReader("{\n  \"referringPartnerUserId\": \"1234567890\",\n  \"email\": \"someone@email.com\",\n  \"hashedEmail\": \"a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456\",\n  \"phoneNumber\": \"+12345678901\",\n  \"birthYear\": \"1990\",\n  \"userName\": \"some_user_name\",\n  \"firstName\": \"John\",\n  \"lastName\": \"Doe\",\n  \"zipCode\": \"10028\",\n  \"externalPartnerUserId\": \"1234567890\",\n  \"enrolledRewards\": [\n    \"CARDLINKED\"\n  ],\n  \"cards\": [\n    {\n      \"last4\": \"1234\",\n      \"bin\": \"123456\",\n      \"issuer\": \"Name_Of_Issuer\",\n      \"network\": \"VISA\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

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

url = URI("https://rewards-api.getkard.com/users/users")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"referringPartnerUserId\": \"1234567890\",\n  \"email\": \"someone@email.com\",\n  \"hashedEmail\": \"a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456\",\n  \"phoneNumber\": \"+12345678901\",\n  \"birthYear\": \"1990\",\n  \"userName\": \"some_user_name\",\n  \"firstName\": \"John\",\n  \"lastName\": \"Doe\",\n  \"zipCode\": \"10028\",\n  \"externalPartnerUserId\": \"1234567890\",\n  \"enrolledRewards\": [\n    \"CARDLINKED\"\n  ],\n  \"cards\": [\n    {\n      \"last4\": \"1234\",\n      \"bin\": \"123456\",\n      \"issuer\": \"Name_Of_Issuer\",\n      \"network\": \"VISA\"\n    }\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://rewards-api.getkard.com/users/users")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"referringPartnerUserId\": \"1234567890\",\n  \"email\": \"someone@email.com\",\n  \"hashedEmail\": \"a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456\",\n  \"phoneNumber\": \"+12345678901\",\n  \"birthYear\": \"1990\",\n  \"userName\": \"some_user_name\",\n  \"firstName\": \"John\",\n  \"lastName\": \"Doe\",\n  \"zipCode\": \"10028\",\n  \"externalPartnerUserId\": \"1234567890\",\n  \"enrolledRewards\": [\n    \"CARDLINKED\"\n  ],\n  \"cards\": [\n    {\n      \"last4\": \"1234\",\n      \"bin\": \"123456\",\n      \"issuer\": \"Name_Of_Issuer\",\n      \"network\": \"VISA\"\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://rewards-api.getkard.com/users/users', [
  'body' => '{
  "referringPartnerUserId": "1234567890",
  "email": "someone@email.com",
  "hashedEmail": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",
  "phoneNumber": "+12345678901",
  "birthYear": "1990",
  "userName": "some_user_name",
  "firstName": "John",
  "lastName": "Doe",
  "zipCode": "10028",
  "externalPartnerUserId": "1234567890",
  "enrolledRewards": [
    "CARDLINKED"
  ],
  "cards": [
    {
      "last4": "1234",
      "bin": "123456",
      "issuer": "Name_Of_Issuer",
      "network": "VISA"
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://rewards-api.getkard.com/users/users");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"referringPartnerUserId\": \"1234567890\",\n  \"email\": \"someone@email.com\",\n  \"hashedEmail\": \"a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456\",\n  \"phoneNumber\": \"+12345678901\",\n  \"birthYear\": \"1990\",\n  \"userName\": \"some_user_name\",\n  \"firstName\": \"John\",\n  \"lastName\": \"Doe\",\n  \"zipCode\": \"10028\",\n  \"externalPartnerUserId\": \"1234567890\",\n  \"enrolledRewards\": [\n    \"CARDLINKED\"\n  ],\n  \"cards\": [\n    {\n      \"last4\": \"1234\",\n      \"bin\": \"123456\",\n      \"issuer\": \"Name_Of_Issuer\",\n      \"network\": \"VISA\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "referringPartnerUserId": "1234567890",
  "email": "someone@email.com",
  "hashedEmail": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",
  "phoneNumber": "+12345678901",
  "birthYear": "1990",
  "userName": "some_user_name",
  "firstName": "John",
  "lastName": "Doe",
  "zipCode": "10028",
  "externalPartnerUserId": "1234567890",
  "enrolledRewards": ["CARDLINKED"],
  "cards": [
    [
      "last4": "1234",
      "bin": "123456",
      "issuer": "Name_Of_Issuer",
      "network": "VISA"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://rewards-api.getkard.com/users/users")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```