> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.getkard.com/legacy/api/users/create-user-card/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.getkard.com/_mcp/server. # Create User Card POST https://rewards-api.getkard.com/users/users/{id}/cards Content-Type: application/json Call this endpoint to create a card that a specified user enrolled in rewards will use to make purchases and earn rewards. Required scopes: `user:write` Reference: https://docs.getkard.com/legacy/api/users/create-user-card ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Servers - `https://rewards-api.getkard.com` (Production, default) - `https://test-rewards-api.getkard.com` (Sandbox) ## Request ### Path parameters - `id` (string, required) — Referring partner user ID from issuer that specifies user ### Body (application/json) This endpoint expects a CreateUserCardRequestBody. - `referringPartnerUserId` (string, required) — Referring partner user ID from issuer - `cards` (list of CardInfoRequest, optional) — List of User Cards Information to add - `cardInfo` (CardInfoRequest, optional, deprecated) — \[Deprecated -- please use "cards" field] User Card Information ## Response ### 201 - `_id` (string, required) — Unique user ID of user in Kard's system - `referringPartner` (string, required) — Issuer name - `referringPartnerUserId` (string, required) — Referring partner user ID of user from issuer - `cards` (list of CardInfoResponse, required) — List of User Cards Information (this will include the newly added cards added). - `createdDate` (datetime, required) — Created date of user in Kard's system (UTC) - `lastModified` (datetime, required) — Last modified date of user in Kard's system (UTC) - `__v` (integer, required) — Version of user in Kard's system - `email` (string, optional) — Email of user if available - `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 if available - `firstName` (string, optional) — First name of user if available - `lastName` (string, optional) — Last name of user if available - `zipCode` (string, optional) — Zipcode of user if available - `externalPartnerUserId` (string, optional) — Partner unique user id, might be equal to referringPartnerUserId, if available - `enrolledRewards` (list of enum, optional) — List of enrolled rewards - Allowed values: `CARDLINKED`, `AFFILIATE` ## 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 ### CardInfoResponse Credit Card Information - `_id` (string, required) — Card ID in Kard's system - `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 name - `network` (enum, required) — Name of card network - Allowed values: `VISA`, `MASTERCARD`, `AMERICAN EXPRESS`, `DISCOVER` - `status` (enum, required) — Status of the 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", "cards": [ { "last4": "1234", "bin": "123456", "issuer": "Name_Of_Issuer", "network": "VISA", "status": "ENABLED" } ] } ``` **Response** ```json { "_id": "5e135a5a2b1f4c0008c9df79", "referringPartner": "Name_Of_Issuer", "referringPartnerUserId": "1234567890", "cards": [ { "_id": "5e135a5a2b1f4c0008c9df80", "last4": "1234", "bin": "123456", "issuer": "Name_Of_Issuer", "network": "VISA", "status": "ENABLED" } ], "createdDate": "2020-10-27T17:34:49.964Z", "lastModified": "2020-10-27T17:34:49.964Z", "__v": 0, "email": "someone@email.com", "hashedEmail": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456", "phoneNumber": "+12345678901", "birthYear": "1990", "userName": "some_user_name", "firstName": "John", "lastName": "Doe", "zipCode": "10028", "externalPartnerUserId": "67890123", "enrolledRewards": [ "CARDLINKED" ] } ``` **SDK Code** ```python import requests url = "https://rewards-api.getkard.com/users/users/%7Bid%7D/cards" payload = { "referringPartnerUserId": "1234567890", "cards": [ { "last4": "1234", "bin": "123456", "issuer": "Name_Of_Issuer", "network": "VISA", "status": "ENABLED" } ] } headers = { "Authorization": "Bearer ", "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/%7Bid%7D/cards'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"referringPartnerUserId":"1234567890","cards":[{"last4":"1234","bin":"123456","issuer":"Name_Of_Issuer","network":"VISA","status":"ENABLED"}]}' }; 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/%7Bid%7D/cards" payload := strings.NewReader("{\n \"referringPartnerUserId\": \"1234567890\",\n \"cards\": [\n {\n \"last4\": \"1234\",\n \"bin\": \"123456\",\n \"issuer\": \"Name_Of_Issuer\",\n \"network\": \"VISA\",\n \"status\": \"ENABLED\"\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") 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/%7Bid%7D/cards") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"referringPartnerUserId\": \"1234567890\",\n \"cards\": [\n {\n \"last4\": \"1234\",\n \"bin\": \"123456\",\n \"issuer\": \"Name_Of_Issuer\",\n \"network\": \"VISA\",\n \"status\": \"ENABLED\"\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 response = Unirest.post("https://rewards-api.getkard.com/users/users/%7Bid%7D/cards") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"referringPartnerUserId\": \"1234567890\",\n \"cards\": [\n {\n \"last4\": \"1234\",\n \"bin\": \"123456\",\n \"issuer\": \"Name_Of_Issuer\",\n \"network\": \"VISA\",\n \"status\": \"ENABLED\"\n }\n ]\n}") .asString(); ``` ```php request('POST', 'https://rewards-api.getkard.com/users/users/%7Bid%7D/cards', [ 'body' => '{ "referringPartnerUserId": "1234567890", "cards": [ { "last4": "1234", "bin": "123456", "issuer": "Name_Of_Issuer", "network": "VISA", "status": "ENABLED" } ] }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://rewards-api.getkard.com/users/users/%7Bid%7D/cards"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"referringPartnerUserId\": \"1234567890\",\n \"cards\": [\n {\n \"last4\": \"1234\",\n \"bin\": \"123456\",\n \"issuer\": \"Name_Of_Issuer\",\n \"network\": \"VISA\",\n \"status\": \"ENABLED\"\n }\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "referringPartnerUserId": "1234567890", "cards": [ [ "last4": "1234", "bin": "123456", "issuer": "Name_Of_Issuer", "network": "VISA", "status": "ENABLED" ] ] ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://rewards-api.getkard.com/users/users/%7Bid%7D/cards")! 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() ```