Preview: the PushFleet API isn't live yet. Join the waitlist
Keys
Create a key
Section titled “Create a key”POST /v1/keys
Creates a restricted key in the environment of the key you call with. Scopes not listed are none. Needs keys: write, and a restricted key can’t grant more than its own scopes.
await fleet.keys.create({
name: "storefront-agent",
scopes: { messages: "write", devices: "read" },
});fleet.keys.create(
name="storefront-agent",
scopes={"messages": "write", "devices": "read"},
)fleet.Keys.Create(ctx, pushfleet.KeysCreateParams{
Name: "storefront-agent",
Scopes: map[string]any{"messages": "write", "devices": "read"},
})fleet
.keys()
.create()
.name("storefront-agent")
.scopes(json!({ "messages": "write", "devices": "read" }))
.await?;fleet.keys.create(
name: "storefront-agent",
scopes: { messages: "write", devices: "read" }
)curl https://api.pushfleet.com/v1/keys \
-H "Authorization: Bearer $PUSHFLEET_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"storefront-agent","scopes":{"messages":"write","devices":"read"}}'The response includes the key itself once. Store it then; it can’t be shown again.
{"id":"key_4k2q","name":"storefront-agent","token":"pf_rk_test_9s8d7f6g5h4j3k2q","scopes":{"messages":"write","devices":"read"}}Revoke a key
Section titled “Revoke a key”DELETE /v1/keys/{id}
Takes effect immediately.
await fleet.keys.delete("key_4k2q");fleet.keys.delete("key_4k2q")fleet.Keys.Delete(ctx, "key_4k2q")fleet.keys().delete("key_4k2q").await?;fleet.keys.delete("key_4k2q")curl -X DELETE https://api.pushfleet.com/v1/keys/key_4k2q \
-H "Authorization: Bearer $PUSHFLEET_SECRET_KEY"