Skip to content

Commit 9c3a3fe

Browse files
thomasballingerConvex, Inc.
authored andcommitted
Restore platform create_deploy_key endpoint (#39909)
GitOrigin-RevId: dec9b715fac12b20738519470f3f2524a958a512
1 parent c5ba52c commit 9c3a3fe

File tree

5 files changed

+144
-3
lines changed

5 files changed

+144
-3
lines changed

npm-packages/@convex-dev/platform/platform-openapi.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,50 @@
170170
]
171171
}
172172
},
173+
"/deployments/{deployment_name}/create_deploy_key": {
174+
"post": {
175+
"summary": "Create deploy key",
176+
"description": "Create a deploy key like \"dev:happy-animal-123|ey...\" which can be\nused with the Convex CLI to develop against or deploy code.\n\nWhen access to the deployment is granted through an OAuth token this\ndeploy key will use the same OAuth-granted token.\n\nWhen access to the deployment is granted any other way a new token will be\ncreated which grants access only to this deployment.",
177+
"operationId": "create deploy key",
178+
"parameters": [
179+
{
180+
"name": "deployment_name",
181+
"in": "path",
182+
"description": "Deployment name",
183+
"required": true
184+
}
185+
],
186+
"requestBody": {
187+
"content": {
188+
"application/json": {
189+
"schema": {
190+
"$ref": "#/components/schemas/PlatformCreateDeployKeyArgs"
191+
}
192+
}
193+
},
194+
"required": true
195+
},
196+
"responses": {
197+
"200": {
198+
"description": "",
199+
"content": {
200+
"application/json": {
201+
"schema": {
202+
"$ref": "#/components/schemas/PlatformCreateDeployKeyResponse"
203+
}
204+
}
205+
}
206+
}
207+
},
208+
"security": [
209+
{
210+
"OAuth Project Token": [],
211+
"OAuth Team Token": [],
212+
"Team Token": []
213+
}
214+
]
215+
}
216+
},
173217
"/token_details": {
174218
"get": {
175219
"summary": "Get token details",
@@ -199,6 +243,10 @@
199243
},
200244
"components": {
201245
"schemas": {
246+
"AdminKey": {
247+
"type": "string",
248+
"description": "Encrypted admin key"
249+
},
202250
"DeploymentType": {
203251
"type": "string",
204252
"enum": [
@@ -210,6 +258,31 @@
210258
"DeviceName": {
211259
"type": "string"
212260
},
261+
"PlatformCreateDeployKeyArgs": {
262+
"type": "object",
263+
"required": [
264+
"name"
265+
],
266+
"properties": {
267+
"name": {
268+
"type": "string",
269+
"description": "Name for the deploy key."
270+
}
271+
},
272+
"additionalProperties": false
273+
},
274+
"PlatformCreateDeployKeyResponse": {
275+
"type": "object",
276+
"required": [
277+
"deployKey"
278+
],
279+
"properties": {
280+
"deployKey": {
281+
"$ref": "#/components/schemas/AdminKey",
282+
"description": "The generated deploy key."
283+
}
284+
}
285+
},
213286
"PlatformCreateProjectArgs": {
214287
"type": "object",
215288
"required": [

npm-packages/@convex-dev/platform/src/generatedApi.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,33 @@ export interface paths {
8484
patch?: never;
8585
trace?: never;
8686
};
87+
"/deployments/{deployment_name}/create_deploy_key": {
88+
parameters: {
89+
query?: never;
90+
header?: never;
91+
path?: never;
92+
cookie?: never;
93+
};
94+
get?: never;
95+
put?: never;
96+
/**
97+
* Create deploy key
98+
* @description Create a deploy key like "dev:happy-animal-123|ey..." which can be
99+
* used with the Convex CLI to develop against or deploy code.
100+
*
101+
* When access to the deployment is granted through an OAuth token this
102+
* deploy key will use the same OAuth-granted token.
103+
*
104+
* When access to the deployment is granted any other way a new token will be
105+
* created which grants access only to this deployment.
106+
*/
107+
post: operations["create deploy key"];
108+
delete?: never;
109+
options?: never;
110+
head?: never;
111+
patch?: never;
112+
trace?: never;
113+
};
87114
"/token_details": {
88115
parameters: {
89116
query?: never;
@@ -110,9 +137,19 @@ export interface paths {
110137
export type webhooks = Record<string, never>;
111138
export interface components {
112139
schemas: {
140+
/** @description Encrypted admin key */
141+
AdminKey: string;
113142
/** @enum {string} */
114143
DeploymentType: "dev" | "prod" | "preview";
115144
DeviceName: string;
145+
PlatformCreateDeployKeyArgs: {
146+
/** @description Name for the deploy key. */
147+
name: string;
148+
};
149+
PlatformCreateDeployKeyResponse: {
150+
/** @description The generated deploy key. */
151+
deployKey: components["schemas"]["AdminKey"];
152+
};
116153
PlatformCreateProjectArgs: {
117154
/** @description Projects always include a deployment, so start this project off with a
118155
* "dev" development deployment or a "prod" production deployment. */
@@ -199,8 +236,11 @@ export interface components {
199236
headers: never;
200237
pathItems: never;
201238
}
239+
export type AdminKey = components['schemas']['AdminKey'];
202240
export type DeploymentType = components['schemas']['DeploymentType'];
203241
export type DeviceName = components['schemas']['DeviceName'];
242+
export type PlatformCreateDeployKeyArgs = components['schemas']['PlatformCreateDeployKeyArgs'];
243+
export type PlatformCreateDeployKeyResponse = components['schemas']['PlatformCreateDeployKeyResponse'];
204244
export type PlatformCreateProjectArgs = components['schemas']['PlatformCreateProjectArgs'];
205245
export type PlatformCreateProjectResponse = components['schemas']['PlatformCreateProjectResponse'];
206246
export type PlatformDeploymentResponse = components['schemas']['PlatformDeploymentResponse'];
@@ -304,6 +344,32 @@ export interface operations {
304344
};
305345
};
306346
};
347+
"create deploy key": {
348+
parameters: {
349+
query?: never;
350+
header?: never;
351+
path: {
352+
/** @description Deployment name */
353+
deployment_name: string;
354+
};
355+
cookie?: never;
356+
};
357+
requestBody: {
358+
content: {
359+
"application/json": components["schemas"]["PlatformCreateDeployKeyArgs"];
360+
};
361+
};
362+
responses: {
363+
200: {
364+
headers: {
365+
[name: string]: unknown;
366+
};
367+
content: {
368+
"application/json": components["schemas"]["PlatformCreateDeployKeyResponse"];
369+
};
370+
};
371+
};
372+
};
307373
"get token details": {
308374
parameters: {
309375
query?: never;

npm-packages/convex/scripts/build.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ def build_standalone_cli(temp_dir) -> None:
122122

123123

124124
def main() -> None:
125-
# TODO -- fix lint error below (only shows up on flake8 v7.2.0)
126-
global times # noqa: F824
127125
t0 = time.time()
128126

129127
global TEMP_DIR

npm-packages/docs/docs/platform-apis.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ The examples here assume you are working in a container with shell and file
6868
system access from which you can drive the app building process. You likely
6969
already have this if you're generating frontend code.
7070

71+
Set [`CONVEX_DEPLOY_KEY`](/docs/cli/deploy-key-types.mdx) is the value returned
72+
by the [Create deploy key](/management-api/create-deploy-key) API.
73+
7174
### Pushing code to the dev Convex backend
7275

7376
```bash

npm-packages/docs/docs/platform-apis/embedded-dashboard.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ Required information for `postMessage`:
3333
- `deploymentName`: The readable identifier for the deployment. Returned when
3434
creating the project with the
3535
[Create project API](/management-api/create-project).
36-
- `adminKey`: A deploy key scoped to the specified `deploymentName`.
36+
- `adminKey`: A deploy key scoped to the specified `deploymentName`. Can be
37+
retrieved with the [Create deploy key API](/management-api/create-deploy-key).
3738

3839
Here's an example of the Convex dashboard embedded in a React application:
3940

0 commit comments

Comments
 (0)