zuplo 6.69.3 → 6.69.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/articles/api-key-administration.mdx +3 -3
- package/docs/articles/api-key-api.mdx +16 -6
- package/docs/articles/api-key-authentication.mdx +1 -1
- package/docs/articles/api-key-best-practices.mdx +199 -0
- package/docs/articles/api-key-buckets.mdx +1 -0
- package/docs/articles/api-key-end-users.mdx +83 -33
- package/docs/articles/api-key-management.mdx +34 -111
- package/docs/articles/api-key-react-component.mdx +19 -4
- package/docs/articles/api-key-self-serve-integration.mdx +441 -0
- package/docs/articles/api-key-service-limits.mdx +2 -1
- package/docs/articles/monetization/quickstart.md +9 -0
- package/docs/articles/monetization/stripe-integration.md +75 -0
- package/docs/articles/when-to-use-api-keys.md +191 -0
- package/docs/cli/info.mdx +37 -0
- package/docs/cli/project-info.mdx +37 -0
- package/docs/concepts/api-keys.md +45 -25
- package/docs/errors/unauthorized.mdx +2 -2
- package/docs/policies/monetization-inbound/schema.json +1 -1
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
sidebar_label:
|
|
2
|
+
title: Manage Keys in the Portal
|
|
3
|
+
sidebar_label: Manage in the Portal
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
API Key Consumers can be managed in the Zuplo Portal's **Services** section.
|
|
@@ -8,7 +8,7 @@ Each project is created with three API Key Buckets - one for production, one
|
|
|
8
8
|
shared by preview environments, and one for development (working copy)
|
|
9
9
|
environments.
|
|
10
10
|
|
|
11
|
-

|
|
12
12
|
|
|
13
13
|
You can view the buckets for each environment or for all environments using the
|
|
14
14
|
drop down.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
sidebar_label:
|
|
2
|
+
title: Use the Developer API
|
|
3
|
+
sidebar_label: Developer API
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Zuplo runs a globally distributed API Key management service that scales to
|
|
@@ -13,6 +13,16 @@ end-users in the Zuplo Developer Portal. However, all management operations
|
|
|
13
13
|
regarding API Keys can also be performed using the
|
|
14
14
|
[Zuplo Developer API](https://zuplo.com/docs/api/api-keys-keys).
|
|
15
15
|
|
|
16
|
+
:::tip{title="Building API key management into your product?"}
|
|
17
|
+
|
|
18
|
+
If you want to add self-serve API key creation, rotation, and deletion to your
|
|
19
|
+
own application's UI, see
|
|
20
|
+
[Build Self-Serve API Key Management in Your Product](./api-key-self-serve-integration.mdx)
|
|
21
|
+
for a complete implementation guide with architecture, code examples, and
|
|
22
|
+
security guidance.
|
|
23
|
+
|
|
24
|
+
:::
|
|
25
|
+
|
|
16
26
|
:::info
|
|
17
27
|
|
|
18
28
|
In order to obtain an API Key for the Developer API, go to your account settings
|
|
@@ -188,7 +198,7 @@ The response will look like this:
|
|
|
188
198
|
|
|
189
199
|
Key rotation is a critical part of API key lifecycle management. Instant
|
|
190
200
|
revocation of a key can break every system that depends on it, so Zuplo supports
|
|
191
|
-
**rolling transitions**
|
|
201
|
+
**rolling transitions** - creating a new key while keeping the old key active
|
|
192
202
|
for a defined grace period.
|
|
193
203
|
|
|
194
204
|
When you call the roll key endpoint, Zuplo:
|
|
@@ -204,13 +214,13 @@ old one stops working.
|
|
|
204
214
|
The right `expiresOn` value depends on how quickly consumers can update their
|
|
205
215
|
keys:
|
|
206
216
|
|
|
207
|
-
- **Leaked key response**
|
|
217
|
+
- **Leaked key response** - set `expiresOn` to a past date or within minutes.
|
|
208
218
|
Security incidents demand immediate action; a brief disruption is preferable
|
|
209
219
|
to continued exposure.
|
|
210
|
-
- **Routine rotation**
|
|
220
|
+
- **Routine rotation** - 24 to 72 hours gives most teams enough time to
|
|
211
221
|
propagate the new key through CI/CD pipelines, environment variables, and
|
|
212
222
|
secret managers.
|
|
213
|
-
- **Scheduled rotation**
|
|
223
|
+
- **Scheduled rotation** - for large organizations, 7 to 14 days accommodates
|
|
214
224
|
deploy freezes, multi-team coordination, and staged rollouts.
|
|
215
225
|
|
|
216
226
|
:::tip{title="Multiple keys per consumer"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: API Key Best Practices
|
|
3
|
+
sidebar_label: Best Practices
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
A well-designed API key system handles much more than authentication. It covers
|
|
7
|
+
key format, rotation, leak detection, caching, and the end-user experience. This
|
|
8
|
+
guide covers the 8 practices that define a production-grade API key
|
|
9
|
+
implementation and shows how each one works in Zuplo.
|
|
10
|
+
|
|
11
|
+
If you have already decided that API keys are the right fit for your API, these
|
|
12
|
+
are the practices that separate a production-grade implementation from a basic
|
|
13
|
+
one.
|
|
14
|
+
|
|
15
|
+
## 1. Use a structured, prefixed key format
|
|
16
|
+
|
|
17
|
+
Key format is the foundation everything else in this guide builds on. Checksum
|
|
18
|
+
validation, leak detection, and fast rejection all depend on a well-structured
|
|
19
|
+
key.
|
|
20
|
+
|
|
21
|
+
API keys should not be random strings with no structure. A good key format
|
|
22
|
+
serves multiple purposes: identification, validation, and integration with
|
|
23
|
+
security tooling.
|
|
24
|
+
|
|
25
|
+
Zuplo API keys use the format `zpka_<random>_<checksum>`:
|
|
26
|
+
|
|
27
|
+
- The **`zpka_` prefix** identifies the string as a Zuplo API key in logs,
|
|
28
|
+
config files, and security scans.
|
|
29
|
+
- The **random body** provides the cryptographic entropy.
|
|
30
|
+
- The **checksum suffix** enables instant format validation without a database
|
|
31
|
+
call.
|
|
32
|
+
- **Underscore separators** allow double-click selection of the entire key in
|
|
33
|
+
most text editors and terminals. Keys that use hyphens, dots, or mixed
|
|
34
|
+
delimiters often result in partial selection, leading to accidental truncation
|
|
35
|
+
when copying.
|
|
36
|
+
|
|
37
|
+
This structure means scanners, support teams, and automated tools can all
|
|
38
|
+
identify and validate a Zuplo key on sight.
|
|
39
|
+
|
|
40
|
+
See [API key format](../concepts/api-keys.md#api-key-format) for the full
|
|
41
|
+
breakdown of each part.
|
|
42
|
+
|
|
43
|
+
## 2. Enable checksum validation for fast rejection
|
|
44
|
+
|
|
45
|
+
Building on the structured format, every API key request should go through a
|
|
46
|
+
fast pre-check before touching any database or cache. If the key is malformed -
|
|
47
|
+
a typo, a truncated copy-paste, or random garbage - it should be rejected in
|
|
48
|
+
microseconds.
|
|
49
|
+
|
|
50
|
+
Zuplo keys include a checksum signature that can be verified mathematically at
|
|
51
|
+
the edge. This happens as part of the
|
|
52
|
+
[validation flow](./api-key-management.mdx#how-authentication-works): the format
|
|
53
|
+
and checksum are checked before any network call, rejecting invalid keys with
|
|
54
|
+
near-zero cost.
|
|
55
|
+
|
|
56
|
+
## 3. Support secret scanning and leak detection
|
|
57
|
+
|
|
58
|
+
The structured prefix from practice 1 also enables automated leak detection. API
|
|
59
|
+
keys inevitably end up in places they should not - committed to GitHub, pasted
|
|
60
|
+
in Slack, logged in plaintext. A good key format makes automated detection
|
|
61
|
+
possible.
|
|
62
|
+
|
|
63
|
+
Zuplo is an official
|
|
64
|
+
[GitHub secret scanning partner](https://github.blog/changelog/2022-07-13-zuplo-is-now-a-github-secret-scanning-partner/).
|
|
65
|
+
When a `zpka_`-prefixed key is committed to any GitHub repository, GitHub
|
|
66
|
+
detects it, verifies the checksum, and notifies Zuplo. You receive an alert with
|
|
67
|
+
the repository URL where the key was found.
|
|
68
|
+
|
|
69
|
+
This works because of the structured key format - the prefix provides a reliable
|
|
70
|
+
regex pattern, and the checksum eliminates false positives. Leak detection is
|
|
71
|
+
enabled automatically for all keys using the standard format and is available on
|
|
72
|
+
all plans, including free.
|
|
73
|
+
|
|
74
|
+
See [API Key Leak Detection](./api-key-leak-detection.mdx) for the full scan
|
|
75
|
+
flow and recommended response actions.
|
|
76
|
+
|
|
77
|
+
## 4. Support key rotation with transition periods
|
|
78
|
+
|
|
79
|
+
Rotating an API key should not be an all-or-nothing event. Without a transition
|
|
80
|
+
period, a routine key rotation becomes an incident - every system using the old
|
|
81
|
+
key breaks simultaneously. A good rotation mechanism creates a new key while
|
|
82
|
+
keeping the old one active for a defined grace period.
|
|
83
|
+
|
|
84
|
+
Zuplo's [roll-key API](./api-key-api.mdx#roll-a-consumers-keys) does exactly
|
|
85
|
+
this:
|
|
86
|
+
|
|
87
|
+
1. Creates a new key with no expiration
|
|
88
|
+
2. Sets an `expiresOn` date on existing keys that have no expiration
|
|
89
|
+
|
|
90
|
+
This gives consumers time to update their integration before the old key stops
|
|
91
|
+
working. The transition period is configurable - minutes for a leaked key
|
|
92
|
+
response, days or weeks for routine rotation.
|
|
93
|
+
|
|
94
|
+
Consumers can also manage rotation themselves by creating a second key,
|
|
95
|
+
deploying it, verifying traffic, and then deleting the old key on their own
|
|
96
|
+
schedule. Zuplo supports multiple active keys per consumer for this pattern.
|
|
97
|
+
|
|
98
|
+
## 5. Use read-through caching at the edge
|
|
99
|
+
|
|
100
|
+
Validating an API key on every request by hitting a central database adds
|
|
101
|
+
latency and creates a single point of failure. A good system caches validation
|
|
102
|
+
results close to the user.
|
|
103
|
+
|
|
104
|
+
Zuplo validates API keys at the edge across 300+ data centers. After the first
|
|
105
|
+
validation, the result is cached locally for the configured TTL (default 60
|
|
106
|
+
seconds). Subsequent requests using the same key are served from cache with
|
|
107
|
+
near-zero latency.
|
|
108
|
+
|
|
109
|
+
The `cacheTtlSeconds` option on the
|
|
110
|
+
[API Key Authentication policy](../policies/api-key-inbound.mdx) controls this
|
|
111
|
+
trade-off:
|
|
112
|
+
|
|
113
|
+
- **Higher values** reduce latency and database load but delay the effect of key
|
|
114
|
+
revocation.
|
|
115
|
+
- **Lower values** make revocation faster but increase the frequency of key
|
|
116
|
+
service lookups.
|
|
117
|
+
- **Default (60 seconds)** is a good balance for most use cases.
|
|
118
|
+
|
|
119
|
+
Because validation results are cached at the edge, repeated requests with the
|
|
120
|
+
same key - whether valid or invalid - are served from cache rather than hitting
|
|
121
|
+
the key service on every call.
|
|
122
|
+
|
|
123
|
+
## 6. Choose retrievable or irretrievable keys
|
|
124
|
+
|
|
125
|
+
This is an architectural decision with security trade-offs in both directions.
|
|
126
|
+
Irretrievable keys (shown once, stored as a hash) force consumers to save the
|
|
127
|
+
key immediately, often in locations you don't control. Retrievable keys let
|
|
128
|
+
consumers go back to the portal when they need the key again.
|
|
129
|
+
|
|
130
|
+
**Zuplo keys are retrievable.** Consumers can view their keys in the developer
|
|
131
|
+
portal or through the API. This reduces the support burden from lost keys and
|
|
132
|
+
avoids pushing consumers toward insecure storage habits.
|
|
133
|
+
|
|
134
|
+
For a deeper comparison, see
|
|
135
|
+
[retrievable vs irretrievable keys](./when-to-use-api-keys.md#retrievable-vs-irretrievable-keys).
|
|
136
|
+
|
|
137
|
+
## 7. Hide keys until needed in the UI
|
|
138
|
+
|
|
139
|
+
Even with retrievable keys, the default display state should be masked. Keys
|
|
140
|
+
should only be visible when the user explicitly asks to see them, and copying
|
|
141
|
+
should be possible without revealing the key at all.
|
|
142
|
+
|
|
143
|
+
The Zuplo Developer Portal follows this pattern - keys are masked by default,
|
|
144
|
+
with explicit actions to reveal or copy.
|
|
145
|
+
|
|
146
|
+
This protects against shoulder-surfing, screen recording, and accidental
|
|
147
|
+
exposure in screenshots or screen shares.
|
|
148
|
+
|
|
149
|
+
When building a custom integration with the
|
|
150
|
+
[Zuplo Developer API](./api-key-self-serve-integration.mdx), use the
|
|
151
|
+
`key-format=masked` parameter for list views and `key-format=visible` only
|
|
152
|
+
behind an explicit reveal action.
|
|
153
|
+
|
|
154
|
+
:::tip
|
|
155
|
+
|
|
156
|
+
Advise your API consumers to store keys in environment variables or a secrets
|
|
157
|
+
manager - never in source code or version control.
|
|
158
|
+
|
|
159
|
+
:::
|
|
160
|
+
|
|
161
|
+
## 8. Show key creation dates
|
|
162
|
+
|
|
163
|
+
Consumers and administrators need to know when a key was created to make
|
|
164
|
+
informed decisions about rotation. A key created three years ago with no
|
|
165
|
+
rotation is a different risk profile than one created last week.
|
|
166
|
+
|
|
167
|
+
Every Zuplo API key includes a `createdOn` timestamp that is visible in the
|
|
168
|
+
portal, the developer portal, and through the API. This makes it easy to
|
|
169
|
+
identify stale keys that should be rotated and to audit key age across your
|
|
170
|
+
consumer base.
|
|
171
|
+
|
|
172
|
+
## Putting it all together
|
|
173
|
+
|
|
174
|
+
These 8 practices are not independent - they reinforce each other:
|
|
175
|
+
|
|
176
|
+
- The **structured format** (practice 1) enables **checksum validation**
|
|
177
|
+
(practice 2) and **leak detection** (practice 3).
|
|
178
|
+
- **Edge caching** (practice 5) makes the **checksum pre-check** (practice 2)
|
|
179
|
+
even faster by avoiding unnecessary cache lookups for malformed keys.
|
|
180
|
+
- **Retrievable keys** (practice 6) combined with **masked display**
|
|
181
|
+
(practice 7) balance convenience with security.
|
|
182
|
+
- **Rotation with transition periods** (practice 4) combined with **creation
|
|
183
|
+
dates** (practice 8) give teams the tools to manage key lifecycle without
|
|
184
|
+
downtime.
|
|
185
|
+
|
|
186
|
+
Zuplo implements all 8 practices out of the box. There is no configuration
|
|
187
|
+
needed to enable the key format, checksum validation, leak detection, or edge
|
|
188
|
+
caching - they are built into the platform.
|
|
189
|
+
|
|
190
|
+
## Next steps
|
|
191
|
+
|
|
192
|
+
- [When to Use API Keys](./when-to-use-api-keys.md) - decide if API keys are the
|
|
193
|
+
right auth method for your API
|
|
194
|
+
- [API Keys Overview](./api-key-management.mdx) - get started with Zuplo API
|
|
195
|
+
keys
|
|
196
|
+
- [Build Self-Serve API Key Management](./api-key-self-serve-integration.mdx) -
|
|
197
|
+
add key management to your own product
|
|
198
|
+
- [API Key Leak Detection](./api-key-leak-detection.mdx) - how GitHub secret
|
|
199
|
+
scanning works with Zuplo keys
|
|
@@ -1,52 +1,102 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
sidebar_label: End
|
|
2
|
+
title: Share Keys with End Users
|
|
3
|
+
sidebar_label: End-User Access
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Once your API uses [API Key Authentication](../policies/api-key-inbound.mdx),
|
|
7
|
+
the next step is getting a key into the hands of each consumer. Zuplo offers
|
|
8
|
+
three options depending on who creates the key and where the management UI
|
|
9
|
+
lives.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
A **consumer** is the identity that owns one or more API keys (typically a
|
|
12
|
+
customer, team, or application). A **manager** is an email address assigned to a
|
|
13
|
+
consumer that grants self-serve access. When a user signs in to a Developer
|
|
14
|
+
Portal with an email matching the manager email, they see that consumer's keys
|
|
15
|
+
on their settings page.
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
the [Zuplo Management Portal](https://portal.zuplo.com). From inside the **API
|
|
13
|
-
Key Consumers** section in the **Settings** tab you can create and manage
|
|
14
|
-
consumers and their keys.
|
|
17
|
+
## Pick an option
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
| Want this experience | Use |
|
|
20
|
+
| ------------------------------------------------------------------ | ------------------------- |
|
|
21
|
+
| Quickly create a key for yourself or a teammate during development | Zuplo Portal (admin only) |
|
|
22
|
+
| Let consumers self-serve through a Zuplo-hosted UI | Zuplo Developer Portal |
|
|
23
|
+
| Build the key management UI inside your own product | Zuplo Developer API |
|
|
17
24
|
|
|
18
|
-
|
|
25
|
+
The rest of this page expands on each option.
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
:::note
|
|
28
|
+
|
|
29
|
+
The **Zuplo Portal** ([portal.zuplo.com](https://portal.zuplo.com)) is your
|
|
30
|
+
admin dashboard for building and operating your API. The **Zuplo Developer
|
|
31
|
+
Portal** is the public, customer-facing site you publish for your API consumers.
|
|
32
|
+
They are different products and serve different audiences.
|
|
33
|
+
|
|
34
|
+
:::
|
|
35
|
+
|
|
36
|
+
## Manual key creation (admin only)
|
|
37
|
+
|
|
38
|
+
:::caution
|
|
39
|
+
|
|
40
|
+
This flow is for development, testing, and ad-hoc use only. Creating keys by
|
|
41
|
+
hand in the admin portal does not scale to a production user base.
|
|
42
|
+
|
|
43
|
+
:::
|
|
21
44
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
45
|
+
For development or one-off needs, the easiest way to obtain an API key is in the
|
|
46
|
+
[Zuplo Portal](https://portal.zuplo.com). Open **Services > API Key Service**,
|
|
47
|
+
click **Configure**, and you can view existing keys or create new keys for your
|
|
48
|
+
consumers manually.
|
|
25
49
|
|
|
26
|
-
|
|
27
|
-
create new API Keys.
|
|
50
|
+

|
|
28
51
|
|
|
29
|
-
|
|
52
|
+
## Zuplo Developer Portal
|
|
53
|
+
|
|
54
|
+
If you publish a [Zuplo Developer Portal](../dev-portal/introduction.mdx) for
|
|
55
|
+
your API consumers, you can let authenticated users manage their own keys
|
|
56
|
+
without contacting your team.
|
|
30
57
|
|
|
31
|
-
|
|
58
|
+
By default, a consumer's keys are visible to any signed-in user whose email
|
|
59
|
+
matches a manager email assigned to that consumer. Consumers can copy and rotate
|
|
60
|
+
the keys they have access to from the **API Keys** section of the portal.
|
|
32
61
|
|
|
33
|
-
|
|
34
|
-
and you are building with React, Zuplo offers an
|
|
35
|
-
[open source API Key Manager component](https://github.com/zuplo/api-key-manager)
|
|
36
|
-
that makes it easy to allow your users self serve access to their keys.
|
|
62
|
+

|
|
37
63
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
sample as a starting point for building your management API using Zuplo.
|
|
64
|
+
The default Developer Portal does not include a self-serve flow for creating
|
|
65
|
+
brand-new keys. To enable that you have two options:
|
|
41
66
|
|
|
42
|
-
|
|
67
|
+
- **Roll your own self-serve flow.** Follow the
|
|
68
|
+
[Dev Portal with API Keys example](https://zuplo.com/examples/dev-portal-with-api-keys)
|
|
69
|
+
to add a "Create key" button backed by your own logic.
|
|
70
|
+
- **Use Zuplo Monetization.**
|
|
71
|
+
[Monetization](https://zuplo.com/docs/articles/monetization) bundles
|
|
72
|
+
self-serve key creation with plans, metering, and an upgrade flow in one
|
|
73
|
+
developer portal. Self-serve via Monetization works on free plans during
|
|
74
|
+
development; production use of Monetization requires a paid Zuplo plan.
|
|
43
75
|
|
|
44
76
|
## Zuplo Developer API
|
|
45
77
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
78
|
+
Use the [Zuplo Developer API](https://dev.zuplo.com/docs/) when you want
|
|
79
|
+
complete control over the experience, for example building an "API Keys" section
|
|
80
|
+
directly into your product's settings page.
|
|
81
|
+
|
|
82
|
+
This approach works with any tech stack. Your backend authenticates users with
|
|
83
|
+
your own auth system, then proxies requests to the Zuplo Developer API to
|
|
84
|
+
create, list, rotate, and delete keys on their behalf. You control the UI, the
|
|
85
|
+
access rules, and the onboarding flow.
|
|
86
|
+
|
|
87
|
+
:::caution
|
|
88
|
+
|
|
89
|
+
The Zuplo Developer API is a privileged, backend-only API. It accepts a
|
|
90
|
+
management token that grants full access to your account's consumers and keys.
|
|
91
|
+
Never call it from the browser.
|
|
92
|
+
|
|
93
|
+
:::
|
|
94
|
+
|
|
95
|
+
To get started:
|
|
49
96
|
|
|
50
|
-
|
|
51
|
-
[
|
|
52
|
-
|
|
97
|
+
1. Read the
|
|
98
|
+
[Build Self-Serve Key Management](./api-key-self-serve-integration.mdx)
|
|
99
|
+
walkthrough for architecture, code examples, and security guidance.
|
|
100
|
+
2. Refer to [Use the Developer API](./api-key-api.mdx) and the
|
|
101
|
+
[Zuplo Developer API documentation](https://dev.zuplo.com/docs/) for the raw
|
|
102
|
+
endpoint reference once you are implementing specific operations.
|
|
@@ -15,42 +15,33 @@ To start using Zuplo API Keys in only a few minutes
|
|
|
15
15
|
|
|
16
16
|
:::
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
authenticate an organization, system, or service rather than an individual user
|
|
23
|
-
acting on their own behalf (which is where OAuth excels).
|
|
24
|
-
|
|
25
|
-
Compared to JWT-based auth, API keys offer simpler developer experience — a
|
|
26
|
-
single string in a header, easy to test with curl, and no token refresh flow.
|
|
27
|
-
API keys are opaque, meaning they don't leak claim structure the way a decoded
|
|
28
|
-
JWT does. And because each key maps to a consumer identity in Zuplo, you can
|
|
29
|
-
revoke access instantly — you don't need to wait for a token to expire.
|
|
30
|
-
|
|
31
|
-
For a deeper comparison, see the Zuplo blog post on
|
|
32
|
-
[API key authentication best practices](https://zuplo.com/blog/api-key-authentication).
|
|
18
|
+
Not sure if API keys are the right auth method? See
|
|
19
|
+
[When to Use API Keys](./when-to-use-api-keys.md). For the practices that define
|
|
20
|
+
a production-grade implementation, see
|
|
21
|
+
[API Key Best Practices](./api-key-best-practices.mdx).
|
|
33
22
|
|
|
34
23
|
## What you get with Zuplo API keys
|
|
35
24
|
|
|
36
|
-
- **Thoughtful key format**
|
|
25
|
+
- **Thoughtful key format** - keys use a `zpka_` prefix, cryptographically
|
|
37
26
|
random body, and checksum signature. The prefix enables
|
|
38
27
|
[GitHub secret scanning](./api-key-leak-detection.mdx), the checksum allows
|
|
39
28
|
instant format validation without a database call, and the underscore
|
|
40
29
|
formatting means a double-click selects the entire key. See
|
|
41
30
|
[API key format](../concepts/api-keys.md#api-key-format) for the full
|
|
42
31
|
breakdown.
|
|
43
|
-
- **Leak detection**
|
|
32
|
+
- **Leak detection** - Zuplo is a
|
|
44
33
|
[GitHub secret scanning partner](./api-key-leak-detection.mdx). If a key is
|
|
45
34
|
committed to any GitHub repository, you are notified immediately.
|
|
46
|
-
- **Self-serve key management**
|
|
35
|
+
- **Self-serve key management** - give your API consumers a
|
|
47
36
|
[developer portal](./api-key-end-users.mdx) where they can create, view, roll,
|
|
48
|
-
and revoke their own keys.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
and revoke their own keys. Or
|
|
38
|
+
[build key management into your own product](./api-key-self-serve-integration.mdx).
|
|
39
|
+
- **Edge validation** - keys are validated through a multi-step process at the
|
|
40
|
+
edge: format check, checksum verification, cache lookup, then key service
|
|
41
|
+
query. See
|
|
42
|
+
[how validation works](../concepts/api-keys.md#how-validation-works) for the
|
|
43
|
+
full flow.
|
|
44
|
+
- **Key rotation with transition periods** - the
|
|
54
45
|
[roll-key API](./api-key-api.mdx#roll-a-consumers-keys) creates a new key and
|
|
55
46
|
sets an expiration on existing keys, so consumers have time to migrate without
|
|
56
47
|
downtime.
|
|
@@ -59,96 +50,28 @@ For a deeper comparison, see the Zuplo blog post on
|
|
|
59
50
|
|
|
60
51
|
Zuplo builds and manages the API key infrastructure so you don't have to. The
|
|
61
52
|
service handles key storage, global replication, edge caching, and validation at
|
|
62
|
-
scale
|
|
53
|
+
scale - supporting millions of keys and virtually unlimited throughput.
|
|
63
54
|
|
|
64
55
|
Keys replicate around the world in seconds. When a key is created, revoked, or
|
|
65
56
|
deleted, the change propagates to all 300+ edge locations within seconds,
|
|
66
57
|
ensuring your API is never open to unauthorized access for longer than the
|
|
67
58
|
configured cache TTL.
|
|
68
59
|
|
|
69
|
-
##
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
[API
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
authorization, rate limiting, and routing. See
|
|
88
|
-
[how validation works](../concepts/api-keys.md#how-validation-works) for more
|
|
89
|
-
details.
|
|
90
|
-
|
|
91
|
-
:::note
|
|
92
|
-
|
|
93
|
-
The `cacheTtlSeconds` option on the API Key Authentication policy controls how
|
|
94
|
-
long validation results are cached at each edge location. Higher values reduce
|
|
95
|
-
latency but delay the effect of key revocation. A revoked key could still be
|
|
96
|
-
accepted for up to `cacheTtlSeconds` after revocation. The default of 60 seconds
|
|
97
|
-
is a good balance for most use cases.
|
|
98
|
-
|
|
99
|
-
:::
|
|
100
|
-
|
|
101
|
-
## Key Concepts
|
|
102
|
-
|
|
103
|
-
### Consumers
|
|
104
|
-
|
|
105
|
-
An API Key Consumer is the identity that can invoke your API - typically people,
|
|
106
|
-
customers, partners or services. A consumer can have multiple API Keys
|
|
107
|
-
associated with it - but each key authorizes the same consumer (for example
|
|
108
|
-
identity)
|
|
109
|
-
|
|
110
|
-
### Consumer Metadata
|
|
111
|
-
|
|
112
|
-
Each consumer can be assigned metadata. This information (a
|
|
113
|
-
[small JSON object](./api-key-service-limits.mdx)) is made available to the
|
|
114
|
-
runtime when a user access your API using that key.
|
|
115
|
-
|
|
116
|
-
For example, a Consumer might have metadata that specifies the company they're a
|
|
117
|
-
member of and the plan for the account.
|
|
118
|
-
|
|
119
|
-
```json
|
|
120
|
-
{
|
|
121
|
-
"companyId": 123,
|
|
122
|
-
"plan": "gold"
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### Consumer Tags
|
|
127
|
-
|
|
128
|
-
Consumers can also have tags associated with them. Tags are simple key value
|
|
129
|
-
pairs. Tags are used for management purposes only (for example querying
|
|
130
|
-
consumers through the Zuplo API). Tags don't get sent to the runtime as part of
|
|
131
|
-
authorization.
|
|
132
|
-
|
|
133
|
-
For example, a Consumer might be tagged in order to track the customer
|
|
134
|
-
associated with the consumer.
|
|
135
|
-
|
|
136
|
-
```txt
|
|
137
|
-
customer=1234
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
You can see more on how to use tags in the document on
|
|
141
|
-
[managing consumers and keys using the API](./api-key-api.mdx)
|
|
142
|
-
|
|
143
|
-
### API Keys
|
|
144
|
-
|
|
145
|
-
API Keys are the actual string value used to authenticate with an API. Unlike
|
|
146
|
-
some other forms of bearer tokens, API Keys don't contain any actual data within
|
|
147
|
-
the key itself.
|
|
148
|
-
|
|
149
|
-
Zuplo API Keys use a structured format: a `zpka_` prefix, a cryptographically
|
|
150
|
-
random body, and a checksum signature. This format enables
|
|
151
|
-
[leak detection via GitHub secret scanning](./api-key-leak-detection.mdx) and
|
|
152
|
-
allows instant format validation without a database call. Zuplo's API Key
|
|
153
|
-
management service also supports custom key formats (enterprise plan required),
|
|
154
|
-
though custom formats lose leak detection support.
|
|
60
|
+
## Key concepts
|
|
61
|
+
|
|
62
|
+
The API key system has three core objects. For full details, see the
|
|
63
|
+
[API Keys concepts page](../concepts/api-keys.md).
|
|
64
|
+
|
|
65
|
+
- **Consumers** - the identities that own API keys. Each consumer has a unique
|
|
66
|
+
`name` within its bucket (used as `request.user.sub` at runtime), optional
|
|
67
|
+
[metadata](../concepts/api-keys.md#consumer-metadata) available on every
|
|
68
|
+
authenticated request, and optional
|
|
69
|
+
[tags](../concepts/api-keys.md#tags-vs-metadata) for management queries.
|
|
70
|
+
- **API Keys** - the credential strings used to authenticate. Each consumer can
|
|
71
|
+
have multiple keys. All keys for a consumer share the same identity and
|
|
72
|
+
metadata. Keys use the `zpka_` format by default; enterprise customers can use
|
|
73
|
+
[custom key formats](../concepts/api-keys.md#api-key-format), though custom
|
|
74
|
+
formats lose leak detection support.
|
|
75
|
+
- **Buckets** - group consumers for an environment. Each project has buckets for
|
|
76
|
+
production, preview, and development. See
|
|
77
|
+
[API Key Buckets](./api-key-buckets.mdx) for details.
|
|
@@ -83,8 +83,23 @@ const MyComponent = () => {
|
|
|
83
83
|
|
|
84
84
|
## Backend API
|
|
85
85
|
|
|
86
|
-
The
|
|
87
|
-
to
|
|
86
|
+
The React component does not call the Zuplo Developer API directly. Instead, it
|
|
87
|
+
talks to a backend API that you control - this backend authenticates the user
|
|
88
|
+
with your own auth system, then proxies requests to the Zuplo Developer API
|
|
89
|
+
using your Zuplo API key. This keeps your Zuplo credentials server-side and lets
|
|
90
|
+
you enforce access control (for example, ensuring users can only manage keys for
|
|
91
|
+
their own organization).
|
|
92
|
+
|
|
93
|
+
The `<BASE_URL>` in the usage example above should point to this backend API.
|
|
94
|
+
The `<ACCESS_TOKEN>` is your own auth token (session cookie, JWT, etc.) that
|
|
95
|
+
your backend uses to identify the user.
|
|
96
|
+
|
|
97
|
+
The easiest way to get started is to use the
|
|
88
98
|
[Auth Translation API](https://github.com/zuplo/sample-auth-translation-api)
|
|
89
|
-
sample and deploy it to [Zuplo](https://zuplo.com).
|
|
90
|
-
|
|
99
|
+
sample and deploy it to [Zuplo](https://zuplo.com). This sample provides the
|
|
100
|
+
backend endpoints the component expects and connects to the
|
|
101
|
+
[Zuplo API Key Management Service](./api-key-management.mdx) out of the box.
|
|
102
|
+
|
|
103
|
+
For a full walkthrough of building this backend yourself (including the
|
|
104
|
+
architecture, all API operations, and security considerations), see
|
|
105
|
+
[Build Self-Serve API Key Management in Your Product](./api-key-self-serve-integration.mdx).
|