Naar de inhoud
Garanify

Keys

Secret keys (gfy_sk_…) for your server, publishable keys (gfy_pk_…) for the browser.

The API is built and tested. Hosting at api.garanify.com is in preparation; until then it runs locally. Keys are available on request.

List keys

GET /v1/shops/{shop}/keys

Key: Secret key

All keys of the shop, including revoked ones. Secrets are never shown again, only a hint with the last four characters.

Parameters

NameInTypeDescription
shoprequired path string Shop ID (shp_…).pattern ^shp_[A-Za-z0-9]{12}$

Request

curl "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/keys" \
  -H "Authorization: Bearer $GARANIFY_SECRET_KEY"
import { Garanify } from '@garanify/sdk';

const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const keys = await garanify.keys.list();
<?php
// composer require garanify/sdk guzzlehttp/guzzle
$factory = new GuzzleHttp\Psr7\HttpFactory();
$garanify = new Garanify\Garanify(getenv('GARANIFY_SECRET_KEY'), ['httpClient' => new GuzzleHttp\Client(), 'requestFactory' => $factory, 'streamFactory' => $factory]);
$keys = $garanify->keys->list();
import os, requests

res = requests.get(
    "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/keys",
    headers={"Authorization": f"Bearer {os.environ['GARANIFY_SECRET_KEY']}"},
    timeout=10,
)
res.raise_for_status()
data = res.json()

Response 200 application/json

{
  "data": [
    {
      "id": "key_9hVb2mQx7Lp1",
      "type": "secret",
      "hint": "gfy_sk_…x7Q2",
      "label": "server",
      "createdAt": "2026-11-18T10:00:00Z",
      "lastUsedDay": "2026-11-18",
      "expiresAt": null,
      "revokedAt": null
    },
    {
      "id": "key_3dLs8Fp2Kv6n",
      "type": "publishable",
      "hint": "gfy_pk_…m4R8",
      "label": "storefront",
      "createdAt": "2026-11-18T10:00:00Z",
      "lastUsedDay": "2026-11-18",
      "expiresAt": null,
      "revokedAt": null
    }
  ]
}

Responses

  • 200 Keys. · ApiKeyList
  • 401 Key missing, invalid, expired or revoked. · Problem
  • 429 Too many requests. Wait `Retry-After` seconds. · Problem

Create a key

POST /v1/shops/{shop}/keys

Key: Secret key

Creates a key for this shop. A test shop only gets test keys. Send an Idempotency-Key so that a retry does not create a second key.

Parameters

NameInTypeDescription
shoprequired path string Shop ID (shp_…).pattern ^shp_[A-Za-z0-9]{12}$
Idempotency-Key header string Any unique string (for example a UUID). The same key with the same body returns the stored response for 24 hours.1–255 chars

Body

NameTypeDescription
typerequired "secret" | "publishable"
label string ≤ 60 chars

Request

curl -X POST "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/keys" \
  -H "Authorization: Bearer $GARANIFY_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"type":"publishable","label":"staging"}'
import { Garanify } from '@garanify/sdk';

const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const key = await garanify.keys.create({
  type: 'publishable',
  label: 'staging'
});
<?php
// composer require garanify/sdk guzzlehttp/guzzle
$factory = new GuzzleHttp\Psr7\HttpFactory();
$garanify = new Garanify\Garanify(getenv('GARANIFY_SECRET_KEY'), ['httpClient' => new GuzzleHttp\Client(), 'requestFactory' => $factory, 'streamFactory' => $factory]);
$key = $garanify->keys->create([
    'type' => 'publishable',
    'label' => 'staging',
]);
import os, uuid, requests

res = requests.post(
    "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/keys",
    headers={"Authorization": f"Bearer {os.environ['GARANIFY_SECRET_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
    json={
        "type": "publishable",
        "label": "staging",
    },
    timeout=10,
)
res.raise_for_status()
data = res.json()

Response 201 application/json

{
  "id": "key_6tGh3Ws9Bn2m",
  "type": "publishable",
  "hint": "gfy_pk_…Zz91",
  "label": "staging",
  "createdAt": "2026-11-18T10:00:00Z",
  "lastUsedDay": null,
  "expiresAt": null,
  "revokedAt": null,
  "secret": "gfy_pk_4kq8Zt2mWc9x_EXAMPLEONLYZz91"
}

Responses

  • 201 Key created. `secret` is returned only in this response. · ApiKeyWithSecret
  • 401 Key missing, invalid, expired or revoked. · Problem
  • 422 The request does not match the schema. · Problem
  • 429 Too many requests. Wait `Retry-After` seconds. · Problem

Rotate a key

POST /v1/shops/{shop}/keys/{key}/rotate

Key: Secret key

Creates a new key of the same type. The old key keeps working for graceSeconds (default one day, at most seven days), then it expires. Send an Idempotency-Key so that a retry does not rotate twice.

Parameters

NameInTypeDescription
shoprequired path string Shop ID (shp_…).pattern ^shp_[A-Za-z0-9]{12}$
keyrequired path string Key ID (key_…), not the secret.pattern ^key_[A-Za-z0-9]{12}$
Idempotency-Key header string Any unique string (for example a UUID). The same key with the same body returns the stored response for 24 hours.1–255 chars

Body (optional)

NameTypeDescription
graceSeconds integer ≥ 0, ≤ 604800, default 86400

Request

curl -X POST "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/keys/key_9hVb2mQx7Lp1/rotate" \
  -H "Authorization: Bearer $GARANIFY_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"graceSeconds":3600}'
import { Garanify } from '@garanify/sdk';

const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const key = await garanify.keys.rotate('key_9hVb2mQx7Lp1', {
  graceSeconds: 3600
});
<?php
// composer require garanify/sdk guzzlehttp/guzzle
$factory = new GuzzleHttp\Psr7\HttpFactory();
$garanify = new Garanify\Garanify(getenv('GARANIFY_SECRET_KEY'), ['httpClient' => new GuzzleHttp\Client(), 'requestFactory' => $factory, 'streamFactory' => $factory]);
$key = $garanify->keys->rotate('key_9hVb2mQx7Lp1', [
    'graceSeconds' => 3600,
]);
import os, uuid, requests

res = requests.post(
    "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/keys/key_9hVb2mQx7Lp1/rotate",
    headers={"Authorization": f"Bearer {os.environ['GARANIFY_SECRET_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
    json={
        "graceSeconds": 3600,
    },
    timeout=10,
)
res.raise_for_status()
data = res.json()

Responses

  • 201 The new key with its secret. · ApiKeyWithSecret
  • 401 Key missing, invalid, expired or revoked. · Problem
  • 404 Not found. · Problem
  • 422 The request does not match the schema. · Problem
  • 429 Too many requests. Wait `Retry-After` seconds. · Problem

Revoke a key

DELETE /v1/shops/{shop}/keys/{key}

Key: Secret key

Revokes the key immediately. The last active secret key of a shop cannot be revoked; create a new one first.

Parameters

NameInTypeDescription
shoprequired path string Shop ID (shp_…).pattern ^shp_[A-Za-z0-9]{12}$
keyrequired path string Key ID (key_…), not the secret.pattern ^key_[A-Za-z0-9]{12}$

Request

curl -X DELETE "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/keys/key_9hVb2mQx7Lp1" \
  -H "Authorization: Bearer $GARANIFY_SECRET_KEY"
import { Garanify } from '@garanify/sdk';

const garanify = new Garanify({ apiKey: process.env.GARANIFY_SECRET_KEY });
const key = await garanify.keys.revoke('key_9hVb2mQx7Lp1');
<?php
// composer require garanify/sdk guzzlehttp/guzzle
$factory = new GuzzleHttp\Psr7\HttpFactory();
$garanify = new Garanify\Garanify(getenv('GARANIFY_SECRET_KEY'), ['httpClient' => new GuzzleHttp\Client(), 'requestFactory' => $factory, 'streamFactory' => $factory]);
$key = $garanify->keys->revoke('key_9hVb2mQx7Lp1');
import os, requests

res = requests.delete(
    "https://api.garanify.com/v1/shops/shp_4kq8Zt2mWc9x/keys/key_9hVb2mQx7Lp1",
    headers={"Authorization": f"Bearer {os.environ['GARANIFY_SECRET_KEY']}"},
    timeout=10,
)
res.raise_for_status()
data = res.json()

Responses

  • 200 The revoked key. · ApiKey
  • 401 Key missing, invalid, expired or revoked. · Problem
  • 404 Not found. · Problem
  • 409 The request conflicts with the current state. · Problem
  • 429 Too many requests. Wait `Retry-After` seconds. · Problem

Next: Products