Copy-paste examples for the Partner API. Two complete walkthroughs, then one call per endpoint.
Copy-paste-Beispiele fuer die Partner API. Zwei komplette Walkthroughs, danach ein Aufruf je Endpunkt.
Exemples a copier-coller pour la Partner API. Deux walkthroughs complets, puis un appel par endpoint.
Checking the response. On success the JSON has "success":"ok" (and "ok":true) and no error; on failure it has "error":"<reason>" (and "ok":false) and no success. So: error present means it failed, success present means it worked.
Antwort pruefen. Bei Erfolg hat das JSON "success":"ok" (und "ok":true) ohne error; bei Fehler "error":"<grund>" (und "ok":false) ohne success. Also: error da heisst Fehler, success da heisst es hat geklappt.
Verifier la reponse. En cas de succes, le JSON contient "success":"ok" (et "ok":true) sans error ; en cas d'echec, "error":"<raison>" (et "ok":false) sans success. Donc : error present signifie echec, success present signifie reussite.
Set your key once
Key einmal setzen
Definir ta cle une fois
Use a partner key (nsk_p_…) for everything, or a user key (nsk_u_…) for self-service on one account.
Nimm einen Partner-Key (nsk_p_…) fuer alles, oder einen User-Key (nsk_u_…) fuer Self-Service auf einem Konto.
Utilise une cle partenaire (nsk_p_…) pour tout, ou une cle utilisateur (nsk_u_…) pour le self-service sur un seul compte.
export KEY='nsk_p_xxxxxxxxxxxxxxxx' export BASE='https://ns.10be.de/partner/v1'
Walkthrough A: an instance managed for an end-user
Walkthrough A: eine Instanz fuer einen Endnutzer
Walkthrough A : une instance geree pour un utilisateur final
The partner creates the end-user and the instance in one call, then hands the end-user their own key. Use this when each instance belongs to one of your customers.
Der Partner legt Endnutzer und Instanz in einem Aufruf an und gibt dem Endnutzer dann seinen eigenen Key. Dafuer, wenn jede Instanz einem deiner Kunden gehoert.
Le partenaire cree l'utilisateur final et l'instance en un seul appel, puis remet a l'utilisateur final sa propre cle. A utiliser quand chaque instance appartient a l'un de tes clients.
- Create the instance and the end-user (by
email). The reply holds, once:api_secret, a readyuser_key, and the newuser(uid,email, firstpassword). Save them. - Anlegen: Instanz + Endnutzer (per
email). Die Antwort enthaelt einmalig:api_secret, einen fertigenuser_keyund den neuenuser(uid,email, erstespassword). Speichern. - Creer l'instance et l'utilisateur final (par
email). La reponse contient, une seule fois :api_secret, uneuser_keyprete, et le nouveluser(uid,email, premierpassword). Enregistre-les.
curl -fsS -X POST "$BASE/instances" \
-H "Authorization: Bearer $KEY" \
-H 'Content-Type: application/json' \
-d '{ "terms": "accept", "email": "customer@example.org", "name_user": "Jane Doe", "lang": "en", "country": "US",
"name": "my-cgm", "units": "mg/dl", "display": "My CGM" }'
terms is required on every create with a partner key. Send "accept" only after the end-user actively accepted the Terms, Privacy Policy, health-data consent and age confirmation, which you must show them first (see Legal texts). Without it the call fails with 422 terms_required.
terms ist bei jedem Anlegen mit einem Partner-Key Pflicht. Sende "accept" erst, nachdem der Endnutzer AGB, Datenschutz, Gesundheitsdaten-Einwilligung und Altersbestaetigung aktiv akzeptiert hat, die du ihm vorher zeigst (s. Rechtstexte). Ohne das Feld scheitert der Aufruf mit 422 terms_required.
terms est obligatoire a chaque creation avec une cle partenaire. N'envoie "accept" qu'apres que l'utilisateur final a activement accepte les Conditions generales, la Politique de confidentialite, le consentement aux donnees de sante et la confirmation d'age, que tu dois lui afficher avant (voir Textes juridiques). Sans ce champ, l'appel echoue avec 422 terms_required.
name_user (name of the new end-user, alias owner_name), lang and country are optional and only used together with email.
name_user (Name des neuen Endnutzers, Alias owner_name), lang und country sind optional und werden nur zusammen mit email genutzt.
name_user (nom du nouvel utilisateur final, alias owner_name), lang et country sont optionnels et ne sont utilises qu'avec email.
{ "ok": true, "success": "ok", "id": 678, "name": "my-cgm", "status": "creating",
"url": "https://my-cgm.10be.de/", "api_secret": "…once…", "user_key": "nsk_u_…once…",
"billing_model": "partner", "user": { "uid": 12345, "email": "customer@example.org", "password": "…once…" } }
- Hand the
user_keyto the customer's app. From then on the app uses that key for this customer (it is scoped to their instance). - Gib den
user_keyan die App des Kunden. Die App nutzt ab dann diesen Key fuer diesen Kunden (auf seine Instanz begrenzt). - Remets la
user_keya l'application du client. Des lors, l'application utilise cette cle pour ce client (elle est limitee a son instance). - Check when it is live (status
running): - Pruefen, wann sie live ist (Status
running): - Verifier quand elle est en ligne (statut
running) :
curl -fsS "$BASE/instances/678" -H "Authorization: Bearer $KEY"
- Change a setting any time (only the fields you send change):
- Aendern jederzeit (nur die geschickten Felder aendern sich):
- Modifier un parametre a tout moment (seuls les champs que tu envoies changent) :
curl -fsS -X PATCH "$BASE/instances/678" \
-H "Authorization: Bearer $KEY" \
-H 'Content-Type: application/json' \
-d '{ "display": "New title", "bghigh": 200 }'
The customer can also log in at the instance with the returned password, or your app drives everything with the user_key.
Der Kunde kann sich an der Instanz mit dem zurueckgegebenen Passwort einloggen, oder deine App steuert alles ueber den user_key.
Le client peut aussi se connecter a l'instance avec le mot de passe renvoye, ou ton application pilote tout avec la user_key.
Walkthrough B: an instance only you (the partner) manage
Walkthrough B: eine Instanz, die nur du (der Partner) verwaltest
Walkthrough B : une instance que toi seul (le partenaire) geres
Leave out both uid and email. The instance then belongs to your own partner account: there is no end-user and no user_key, and only your partner key controls it.
Lass uid UND email weg. Die Instanz gehoert dann deinem eigenen Partner-Konto: es gibt keinen Endnutzer und keinen user_key, und nur dein Partner-Key steuert sie.
Omets a la fois uid et email. L'instance appartient alors a ton propre compte partenaire : il n'y a pas d'utilisateur final ni de user_key, et seule ta cle partenaire la controle.
- Create with just a
name(and optionallyapi_secret). The reply holdsapi_secretonce; there is nouserblock and nouser_key. - Anlegen nur mit
name(optionalapi_secret). Die Antwort enthaeltapi_secreteinmalig; keinuser-Block, keinuser_key. - Creer avec seulement un
name(et optionnellementapi_secret). La reponse contientapi_secretune seule fois ; il n'y a pas de blocuserni deuser_key.
curl -fsS -X POST "$BASE/instances" \
-H "Authorization: Bearer $KEY" \
-H 'Content-Type: application/json' \
-d '{ "terms": "accept", "name": "internal-demo", "units": "mmol" }'
terms is required here too (every create with a partner key).
terms ist auch hier Pflicht (jedes Anlegen mit Partner-Key).
terms est aussi obligatoire ici (toute creation avec une cle partenaire).
{ "ok": true, "success": "ok", "id": 679, "name": "internal-demo", "status": "creating",
"url": "https://internal-demo.10be.de/", "api_secret": "…once…", "billing_model": "partner" }
- Manage it with your partner key: read status, change settings, stop/start, delete.
- Verwalten mit deinem Partner-Key: Status lesen, Einstellungen aendern, stop/start, loeschen.
- Gerer avec ta cle partenaire : lire le statut, modifier les parametres, stop/start, supprimer.
curl -fsS "$BASE/instances/679" -H "Authorization: Bearer $KEY"
curl -fsS -X PATCH "$BASE/instances/679" \
-H "Authorization: Bearer $KEY" \
-H 'Content-Type: application/json' \
-d '{ "action": "stop" }'
{ "ok": true, "success": "ok" }
Reference: one call per endpoint
Referenz: ein Aufruf je Endpunkt
Reference : un appel par endpoint
GET /legalpublic, no key
Legal texts to show the end-user in their language before they accept; then send "terms": "accept" on create. doc is terms, health, age or all; lang is one of the 42 site languages (default en); format is html (default) or pdf.
Rechtstexte, die du dem Endnutzer in seiner Sprache vor dem Akzeptieren zeigst; danach beim Anlegen "terms": "accept" senden. doc ist terms, health, age oder all; lang eine der 42 Sprachen (Default en); format ist html (Default) oder pdf.
Textes juridiques a afficher a l'utilisateur final dans sa langue avant qu'il accepte ; ensuite envoie "terms": "accept" a la creation. doc vaut terms, health, age ou all ; lang est l'une des 42 langues du site (par defaut en) ; format vaut html (par defaut) ou pdf.
# what is available (documents, languages, formats) curl -fsS "$BASE/legal" # Terms + Privacy as HTML in German curl -fsS "$BASE/legal/terms?lang=de&format=html" # health-data consent as PDF in French curl -fsS "$BASE/legal/health?lang=fr&format=pdf" -o health-fr.pdf # everything in one document (HTML, Arabic, RTL) curl -fsS "$BASE/legal/all?lang=ar&format=html"
GET /instanceslist
curl -fsS "$BASE/instances" -H "Authorization: Bearer $KEY"
GET /instances/{id}
curl -fsS "$BASE/instances/678" -H "Authorization: Bearer $KEY"
PATCH (or PUT) /instances/{id}
PUT is accepted as an alias of PATCH (for clients that cannot send PATCH).
PUT wird als Alias von PATCH akzeptiert (fuer Clients, die kein PATCH koennen).
PUT est accepte comme alias de PATCH (pour les clients qui ne peuvent pas envoyer PATCH).
# change settings curl -fsS -X PATCH "$BASE/instances/678" \ -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \ -d '{ "display": "New title", "bglow": 70 }' # same via PUT curl -fsS -X PUT "$BASE/instances/678" \ -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \ -d '{ "display": "New title" }' # an action (stop | start | restart | redeploy | delete | rotate_secret | activate | deactivate) curl -fsS -X PATCH "$BASE/instances/678" \ -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \ -d '{ "action": "rotate_secret" }' # turn an instance off / on (owner-checked). active:0 = off, active:1 = on. # "active" is the English name for the internal "aktiv"; both work. curl -fsS -X PATCH "$BASE/instances/678" \ -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \ -d '{ "active": 0 }'
Custom domains
Eigene Domains
Domaines personnalises
# list curl -fsS "$BASE/instances/678/domains" -H "Authorization: Bearer $KEY" # add (the reply gives the DNS record to set) curl -fsS -X POST "$BASE/instances/678/domains" \ -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \ -d '{ "domain": "cgm.example.org" }' # reply · Antwort: # { "ok": true, "success": "ok", "id": 9, "domain": "cgm.example.org", # "verify_token": "ns-verify-…", "dns_hint": "_ns-verify.cgm.example.org TXT ns-verify-…" } # verify the DNS record now (domain id 9) curl -fsS -X POST "$BASE/instances/678/domains/9/verify" -H "Authorization: Bearer $KEY" # remove curl -fsS -X DELETE "$BASE/instances/678/domains/9" -H "Authorization: Bearer $KEY"
Wildcard domain partner key
Wildcard-Domain Partner-Key
Domaine wildcard cle partenaire
curl -fsS "$BASE/wildcard" -H "Authorization: Bearer $KEY"
curl -fsS -X POST "$BASE/wildcard" \
-H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \
-d '{ "domain": "ns.example.net" }'
curl -fsS -X POST "$BASE/wildcard/verify" -H "Authorization: Bearer $KEY"
POST /user-keyspartner key
# for all of a user's instances curl -fsS -X POST "$BASE/user-keys" \ -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \ -d '{ "uid": 12345, "label": "mobile app" }' # tied to one instance only curl -fsS -X POST "$BASE/user-keys" \ -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \ -d '{ "uid": 12345, "instance_id": 678 }' # with an expiry (Unix time) · mit Ablauf (Unix-Zeit) curl -fsS -X POST "$BASE/user-keys" \ -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \ -d '{ "uid": 12345, "label": "temporary", "expires_at": 1767225600 }' # rename a user key (give it a friendly name), key id 42 · PUT works the same as PATCH curl -fsS -X PATCH "$BASE/user-keys/42" \ -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \ -d '{ "label": "User Manfred" }'