Zum Inhalt springen
Garanify

Schlüssel

Secret Keys (gfy_sk_…) für Ihren Server, Publishable Keys (gfy_pk_…) für den Browser.

Die API ist gebaut und getestet. Das Hosting unter api.garanify.com ist in Vorbereitung; bis dahin läuft sie lokal. Schlüssel gibt es auf Anfrage.

Feldbeschreibungen auf Englisch, direkt aus der OpenAPI-Datei.

Schlüssel auflisten

GET /v1/shops/{shop}/keys

Schlüssel: Secret Key

Alle Schlüssel des Shops, auch gesperrte. Das Geheimnis sehen Sie nie wieder, nur einen Hinweis mit den letzten vier Zeichen.

Parameter

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

Anfrage

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

Antwort 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
    }
  ]
}

Antworten

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

Schlüssel anlegen

POST /v1/shops/{shop}/keys

Schlüssel: Secret Key

Parameter

NameOrtTypBeschreibung
shopPflicht 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

NameTypBeschreibung
typePflicht "secret" | "publishable"
label string ≤ 60 chars

Anfrage

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

Antwort 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"
}

Antworten

  • 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

Schlüssel rotieren

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

Schlüssel: Secret Key

Legt einen neuen Schlüssel derselben Art an. Der alte gilt noch graceSeconds lang (Standard ein Tag, höchstens sieben Tage).

Parameter

NameOrtTypBeschreibung
shopPflicht path string Shop ID (shp_…).pattern ^shp_[A-Za-z0-9]{12}$
keyPflicht 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)

NameTypBeschreibung
graceSeconds integer ≥ 0, ≤ 604800, default 86400

Anfrage

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

Antworten

  • 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

Schlüssel sperren

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

Schlüssel: Secret Key

Sperrt den Schlüssel sofort. Den letzten aktiven Secret Key können Sie nicht sperren; legen Sie vorher einen neuen an.

Parameter

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

Anfrage

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

Antworten

  • 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

Weiter: Produkte