curl --request POST \
--url https://sandbox.apocor.ai/v1/cards \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"program_id": "prog_abc123",
"account_id": "acct_abc123",
"cardholder_id": "ch_abc123",
"form_factor": "VIRTUAL",
"spend_limit_cents": 50000,
"reference_id": "andx-user-42-card-1"
}
'import requests
url = "https://sandbox.apocor.ai/v1/cards"
payload = {
"program_id": "prog_abc123",
"account_id": "acct_abc123",
"cardholder_id": "ch_abc123",
"form_factor": "VIRTUAL",
"spend_limit_cents": 50000,
"reference_id": "andx-user-42-card-1"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
program_id: 'prog_abc123',
account_id: 'acct_abc123',
cardholder_id: 'ch_abc123',
form_factor: 'VIRTUAL',
spend_limit_cents: 50000,
reference_id: 'andx-user-42-card-1'
})
};
fetch('https://sandbox.apocor.ai/v1/cards', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.apocor.ai/v1/cards",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'program_id' => 'prog_abc123',
'account_id' => 'acct_abc123',
'cardholder_id' => 'ch_abc123',
'form_factor' => 'VIRTUAL',
'spend_limit_cents' => 50000,
'reference_id' => 'andx-user-42-card-1'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.apocor.ai/v1/cards"
payload := strings.NewReader("{\n \"program_id\": \"prog_abc123\",\n \"account_id\": \"acct_abc123\",\n \"cardholder_id\": \"ch_abc123\",\n \"form_factor\": \"VIRTUAL\",\n \"spend_limit_cents\": 50000,\n \"reference_id\": \"andx-user-42-card-1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.apocor.ai/v1/cards")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"program_id\": \"prog_abc123\",\n \"account_id\": \"acct_abc123\",\n \"cardholder_id\": \"ch_abc123\",\n \"form_factor\": \"VIRTUAL\",\n \"spend_limit_cents\": 50000,\n \"reference_id\": \"andx-user-42-card-1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.apocor.ai/v1/cards")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"program_id\": \"prog_abc123\",\n \"account_id\": \"acct_abc123\",\n \"cardholder_id\": \"ch_abc123\",\n \"form_factor\": \"VIRTUAL\",\n \"spend_limit_cents\": 50000,\n \"reference_id\": \"andx-user-42-card-1\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"issuance_id": "<string>",
"status": "PENDING",
"card_id": "<string>",
"error": "<string>",
"card": {
"id": "<string>",
"programId": "<string>",
"accountId": "<string>",
"cardholderId": "<string>",
"formFactor": "VIRTUAL",
"status": "INACTIVE",
"lastFour": "4242",
"expiry": "12/29",
"createdAt": "2023-11-07T05:31:56Z",
"referenceId": "<string>"
}
}
}{
"data": {
"issuance_id": "<string>",
"status": "PENDING",
"card_id": "<string>",
"error": "<string>",
"card": {
"id": "<string>",
"programId": "<string>",
"accountId": "<string>",
"cardholderId": "<string>",
"formFactor": "VIRTUAL",
"status": "INACTIVE",
"lastFour": "4242",
"expiry": "12/29",
"createdAt": "2023-11-07T05:31:56Z",
"referenceId": "<string>"
}
}
}{
"error": {
"code": "INVALID_REQUEST",
"message": "Applicant must be approved"
}
}{
"error": {
"code": "INSUFFICIENT_CREDIT",
"message": "Top up your balance to issue cards"
}
}{
"error": {
"code": "IDEMPOTENCY_CONFLICT",
"message": "<string>",
"issuance_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Issue a card
Async card issuance (202 + issuance_id). Requires Idempotency-Key. Optional reference_id (unique per program + environment). Poll GET /v1/cards/issuances/.
curl --request POST \
--url https://sandbox.apocor.ai/v1/cards \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"program_id": "prog_abc123",
"account_id": "acct_abc123",
"cardholder_id": "ch_abc123",
"form_factor": "VIRTUAL",
"spend_limit_cents": 50000,
"reference_id": "andx-user-42-card-1"
}
'import requests
url = "https://sandbox.apocor.ai/v1/cards"
payload = {
"program_id": "prog_abc123",
"account_id": "acct_abc123",
"cardholder_id": "ch_abc123",
"form_factor": "VIRTUAL",
"spend_limit_cents": 50000,
"reference_id": "andx-user-42-card-1"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
program_id: 'prog_abc123',
account_id: 'acct_abc123',
cardholder_id: 'ch_abc123',
form_factor: 'VIRTUAL',
spend_limit_cents: 50000,
reference_id: 'andx-user-42-card-1'
})
};
fetch('https://sandbox.apocor.ai/v1/cards', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.apocor.ai/v1/cards",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'program_id' => 'prog_abc123',
'account_id' => 'acct_abc123',
'cardholder_id' => 'ch_abc123',
'form_factor' => 'VIRTUAL',
'spend_limit_cents' => 50000,
'reference_id' => 'andx-user-42-card-1'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.apocor.ai/v1/cards"
payload := strings.NewReader("{\n \"program_id\": \"prog_abc123\",\n \"account_id\": \"acct_abc123\",\n \"cardholder_id\": \"ch_abc123\",\n \"form_factor\": \"VIRTUAL\",\n \"spend_limit_cents\": 50000,\n \"reference_id\": \"andx-user-42-card-1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.apocor.ai/v1/cards")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"program_id\": \"prog_abc123\",\n \"account_id\": \"acct_abc123\",\n \"cardholder_id\": \"ch_abc123\",\n \"form_factor\": \"VIRTUAL\",\n \"spend_limit_cents\": 50000,\n \"reference_id\": \"andx-user-42-card-1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.apocor.ai/v1/cards")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"program_id\": \"prog_abc123\",\n \"account_id\": \"acct_abc123\",\n \"cardholder_id\": \"ch_abc123\",\n \"form_factor\": \"VIRTUAL\",\n \"spend_limit_cents\": 50000,\n \"reference_id\": \"andx-user-42-card-1\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"issuance_id": "<string>",
"status": "PENDING",
"card_id": "<string>",
"error": "<string>",
"card": {
"id": "<string>",
"programId": "<string>",
"accountId": "<string>",
"cardholderId": "<string>",
"formFactor": "VIRTUAL",
"status": "INACTIVE",
"lastFour": "4242",
"expiry": "12/29",
"createdAt": "2023-11-07T05:31:56Z",
"referenceId": "<string>"
}
}
}{
"data": {
"issuance_id": "<string>",
"status": "PENDING",
"card_id": "<string>",
"error": "<string>",
"card": {
"id": "<string>",
"programId": "<string>",
"accountId": "<string>",
"cardholderId": "<string>",
"formFactor": "VIRTUAL",
"status": "INACTIVE",
"lastFour": "4242",
"expiry": "12/29",
"createdAt": "2023-11-07T05:31:56Z",
"referenceId": "<string>"
}
}
}{
"error": {
"code": "INVALID_REQUEST",
"message": "Applicant must be approved"
}
}{
"error": {
"code": "INSUFFICIENT_CREDIT",
"message": "Top up your balance to issue cards"
}
}{
"error": {
"code": "IDEMPOTENCY_CONFLICT",
"message": "<string>",
"issuance_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
Bearer access token obtained from POST /v1/oauth/token using your Apocor API key.
Headers
Required unique key. Retries with the same key + body replay the original response for 72 hours. In-flight duplicates return 409 with issuance_id for POST /v1/cards.
255Body
VIRTUAL, PHYSICAL Optional monthly spend cap in cents.
Tenant-unique issuance reference. Generated if omitted. Query via GET /v1/cards?reference_id=.
Bind the card to a specific budget (spending pot). Defaults to the applicant's default budget.
Response
Issuance already resolved (idempotent replay or synchronous completion). SUCCEEDED includes the card; FAILED includes error.
Show child attributes
Show child attributes