Cards Create a card
Create a card
Issues a virtual or physical card once the customer's application is `approved`. The first card gets the application's ID. Each further card needs a new Idempotency-Key; a customer can hold 10 cards, not counting blocked ones. Gravv sets a PIN for you; read it with `GET /v1/cards/{card_id}/pin`. Fund the card with a transfer whose destination is the card.
Api-Key
Headers
NameDescription
Idempotency-Key1 to 255 printable ASCII characters. A retry with the same key within 24 hours returns the first response. Use a new key for each new card or withdrawal, and the same key to retry a failed one.
Body parameters
NameDescription
customer_idcard_limitSpending limit in whole USD per day. Decimals are dropped.
card_typePossible values:
virtual, physicalname_on_cardshipping_addressRequired for a physical card.
address_line2 is not read.Show 7 child attributesobject
address_line1citystatepostal_codeSend it as a string, so leading zeros are kept
country_codeAlpha-2 code
phone_numbermethodPossible values:
standard, express, international, apc, uspsInternational, overnightfundingHow the card is funded.
shared joins a card group and shares its balance; without card_group_id it joins the cardholder's default group. own gives the card its own balance. Leave it out to use the application's group.Show 4 child attributesobject
modePossible values:
shared, owncard_group_idOnly with
sharedip_addressCardholder's IP address, for
own on some live cardsannual_remunerationCardholder's yearly income, for
own on some live cardsResponse
Returns 200 OK. The card is issued
NameDescription
dataShow 4 child attributesobject
messagestatusidfee_chargedAlways false
errorErrors
| Status | Meaning |
|---|---|
| 200 | The card is issued |
| 400 | Invalid field, no approved application, the card cap reached, or the card could not be created. Field errors use names such as CardLimit and CountryISOCode. |
Was this page helpful? Yes No
Previous
Next
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl --request POST \
--url 'https://api.gravv.xyz/v1/cards' \
--header 'Api-Key: <api-key>' \
--header 'Idempotency-Key: issue-card-jane-1' \
--header 'Content-Type: application/json' \
--data '{
"customer_id": "9e3cccad-e9ae-47a0-81ee-063af0159310",
"card_limit": 50,
"card_type": "virtual",
"name_on_card": "Jane Doe"
}'
const response = await fetch('https://api.gravv.xyz/v1/cards', {
method: 'POST',
headers: {
'Api-Key': '<api-key>',
'Idempotency-Key': 'issue-card-jane-1',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"customer_id": "9e3cccad-e9ae-47a0-81ee-063af0159310",
"card_limit": 50,
"card_type": "virtual",
"name_on_card": "Jane Doe"
}),
});
const data = await response.json();
console.log(response.status, data);
import requests
url = "https://api.gravv.xyz/v1/cards"
headers = {
"Api-Key": "<api-key>",
"Idempotency-Key": "issue-card-jane-1",
}
payload = {
"customer_id": "9e3cccad-e9ae-47a0-81ee-063af0159310",
"card_limit": 50,
"card_type": "virtual",
"name_on_card": "Jane Doe",
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(response.json())
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{
"customer_id": "9e3cccad-e9ae-47a0-81ee-063af0159310",
"card_limit": 50,
"card_type": "virtual",
"name_on_card": "Jane Doe"
}`)
req, err := http.NewRequest("POST", "https://api.gravv.xyz/v1/cards", bytes.NewReader(payload))
if err != nil {
panic(err)
}
req.Header.Set("Api-Key", "<api-key>")
req.Header.Set("Idempotency-Key", "issue-card-jane-1")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(res.Status)
fmt.Println(string(body))
}
require "json"
require "net/http"
require "uri"
uri = URI("https://api.gravv.xyz/v1/cards")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
request = Net::HTTP::Post.new(uri)
request["Api-Key"] = "<api-key>"
request["Idempotency-Key"] = "issue-card-jane-1"
request["Content-Type"] = "application/json"
request.body = JSON.generate({
"customer_id" => "9e3cccad-e9ae-47a0-81ee-063af0159310",
"card_limit" => 50,
"card_type" => "virtual",
"name_on_card" => "Jane Doe",
})
response = http.request(request)
puts response.code
puts response.body
<?php
$payload = [
'customer_id' => '9e3cccad-e9ae-47a0-81ee-063af0159310',
'card_limit' => 50,
'card_type' => 'virtual',
'name_on_card' => 'Jane Doe',
];
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.gravv.xyz/v1/cards',
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Api-Key: <api-key>',
'Idempotency-Key: issue-card-jane-1',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$response = curl_exec($ch);
if ($response === false) {
throw new RuntimeException(curl_error($ch));
}
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
echo $status, PHP_EOL, $response, PHP_EOL;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String payload = """
{
"customer_id": "9e3cccad-e9ae-47a0-81ee-063af0159310",
"card_limit": 50,
"card_type": "virtual",
"name_on_card": "Jane Doe"
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.gravv.xyz/v1/cards"))
.header("Api-Key", "<api-key>")
.header("Idempotency-Key", "issue-card-jane-1")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
using System.Net.Http;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.gravv.xyz/v1/cards");
request.Headers.TryAddWithoutValidation("Api-Key", "<api-key>");
request.Headers.TryAddWithoutValidation("Idempotency-Key", "issue-card-jane-1");
request.Content = new StringContent(
"""
{
"customer_id": "9e3cccad-e9ae-47a0-81ee-063af0159310",
"card_limit": 50,
"card_type": "virtual",
"name_on_card": "Jane Doe"
}
""",
Encoding.UTF8,
"application/json");
using var response = await client.SendAsync(request);
Console.WriteLine((int)response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync());
Responseapplication/json
200400OK
{
"data": {
"message": "Card creation request is processing",
"status": true,
"id": "dce0192a-9b3d-440b-9500-33dc9ac8dc20",
"fee_charged": false
},
"error": null
}
{
"data": null,
"error": "card application is not yet approved!"
}