Lambda SSH keys API
The SSH keys API from Lambda — 2 operation(s) for ssh keys.
The SSH keys API from Lambda — 2 operation(s) for ssh keys.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/lambda-labs-ssh-keys-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Lambda Cloud SSH keys API
version: 1.10.0
description: 'The Lambda Cloud API provides a set of REST API endpoints you can use to create
and manage your Lambda Cloud resources.'
servers:
- url: https://cloud.lambda.ai/
description: Production server
- url: https://cloud.lambdalabs.com/
description: Secondary production server (deprecated)
security:
- bearerAuth: []
- basicAuth: []
tags:
- name: SSH Keys
paths:
/api/v1/ssh-keys:
get:
responses:
'200':
description: OK
content:
application/json:
schema:
additionalProperties: false
properties:
data:
type: array
items:
$ref: '#/components/schemas/SSHKey'
required:
- data
type: object
'400':
description: Bad Request
content:
application/json:
schema:
additionalProperties: false
properties:
error:
$ref: '#/components/schemas/ApiErrorInvalidParameters'
required:
- error
type: object
'401':
description: Unauthorized
content:
application/json:
schema:
additionalProperties: false
properties:
error:
$ref: '#/components/schemas/ApiErrorUnauthorized'
required:
- error
type: object
'403':
description: Forbidden
content:
application/json:
schema:
additionalProperties: false
properties:
error:
$ref: '#/components/schemas/ApiErrorAccountInactive'
required:
- error
type: object
'404':
description: Not Found
content:
application/json:
schema:
additionalProperties: false
properties:
error:
$ref: '#/components/schemas/ApiErrorNotFound'
required:
- error
type: object
tags:
- SSH Keys
summary: List your SSH keys
description: Retrieves a list of your SSH keys.
operationId: listSSHKeys
post:
responses:
'200':
description: OK
content:
application/json:
schema:
additionalProperties: false
properties:
data:
anyOf:
- $ref: '#/components/schemas/GeneratedSSHKey'
- $ref: '#/components/schemas/SSHKey'
required:
- data
type: object
'400':
description: Bad Request
content:
application/json:
schema:
additionalProperties: false
properties:
error:
$ref: '#/components/schemas/ApiErrorInvalidParameters'
required:
- error
type: object
'401':
description: Unauthorized
content:
application/json:
schema:
additionalProperties: false
properties:
error:
$ref: '#/components/schemas/ApiErrorUnauthorized'
required:
- error
type: object
'403':
description: Forbidden
content:
application/json:
schema:
additionalProperties: false
properties:
error:
$ref: '#/components/schemas/ApiErrorAccountInactive'
required:
- error
type: object
'404':
description: Not Found
content:
application/json:
schema:
additionalProperties: false
properties:
error:
$ref: '#/components/schemas/ApiErrorNotFound'
required:
- error
type: object
tags:
- SSH Keys
summary: Add an SSH key
description: 'Add an SSH key to your Lambda Cloud account. You can upload an existing public
key, or you can generate a new key pair.
- To use an existing key pair, set the `public_key` property in the request body
to your public key.
- To generate a new key pair, omit the `public_key` property from the request
body.
:::note{type="attention" title="Important"}
Lambda doesn''t store your private key after it''s been generated.
If you generate a new key pair, make sure to save the resulting private key locally.
:::
For example, to generate a new key pair and associate it with a Lambda
On-Demand Cloud instance:
1. Generate the key pair. The command provided below automatically extracts and
saves the returned private key to a new file called `key.pem`. Replace
`` with the name you want to assign to the SSH key:
```bash
curl --request POST --url ''https://cloud.lambda.ai/api/v1/ssh-keys'' \
--fail \
--user ${LAMBDA_API_KEY}: \
--data ''{"name": ""}'' \
| jq -r ''.data.private_key'' > key.pem
```
2. Next, set the private key''s permissions to read-only:
```bash
chmod 400 key.pem
```
3. Launch a new instance. Replace `` with the name you assigned
to your SSH key.
```bash
curl --request POST ''https://cloud.lambda.ai/api/v1/instance-operations/launch'' \
--fail \
--user ${LAMBDA_API_KEY}: \
--data ''{"region_name":"us-west-1","instance_type_name":"gpu_1x_a10","ssh_key_names":[""],"file_system_names":[],"quantity":1,"name":"My Instance"}''
```
4. From your local terminal, establish an SSH connection to the instance.
Replace `` with the public IP of the instance:
```bash
ssh -i key.pem
```'
operationId: addSSHKey
requestBody:
content:
application/json:
schema:
properties:
name:
type: string
minLength: 1
maxLength: 64
description: The name of the SSH key.
examples:
- my-public-key
public_key:
type: string
minLength: 1
maxLength: 4096
description: The public key to store. Omit this to generate a new key pair.
examples:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICN+lJwsONkwrdsSnQsu1ydUkIuIg5oOC+Eslvmtt60T noname
required:
- name
title: AddSSHKeyRequest
type: object
required: true
/api/v1/ssh-keys/{id}:
delete:
responses:
'200':
description: OK
content:
application/json:
schema:
additionalProperties: false
properties:
data:
$ref: '#/components/schemas/EmptyResponse'
required:
- data
type: object
'400':
description: Bad Request
content:
application/json:
schema:
additionalProperties: false
properties:
error:
$ref: '#/components/schemas/ApiErrorInvalidParameters'
required:
- error
type: object
'401':
description: Unauthorized
content:
application/json:
schema:
additionalProperties: false
properties:
error:
$ref: '#/components/schemas/ApiErrorUnauthorized'
required:
- error
type: object
'403':
description: Forbidden
content:
application/json:
schema:
additionalProperties: false
properties:
error:
$ref: '#/components/schemas/ApiErrorAccountInactive'
required:
- error
type: object
'404':
description: Not Found
content:
application/json:
schema:
additionalProperties: false
properties:
error:
$ref: '#/components/schemas/ApiErrorNotFound'
required:
- error
type: object
tags:
- SSH Keys
summary: Delete an SSH key
description: Deletes the specified SSH key.
operationId: deleteSSHKey
parameters:
- name: id
in: path
description: The unique identifier (ID) of the SSH key to delete
required: true
schema:
description: The unique identifier (ID) of the SSH key to delete
example: ddf9a910ceb744a0bb95242cbba6cb50
type: string
example: ddf9a910ceb744a0bb95242cbba6cb50
components:
schemas:
ApiErrorAccountInactive:
type: object
properties:
code:
const: global/account-inactive
type: string
description: The unique identifier for the type of error.
message:
type: string
default: Your account is inactive.
description: A description of the error.
suggestion:
type: string
default: Make sure you have verified your email address and have a valid payment method. Contact Support if problems continue.
description: One or more suggestions of possible ways to fix the error.
required:
- code
- message
- suggestion
title: ApiErrorAccountInactive
ApiErrorUnauthorized:
type: object
properties:
code:
const: global/invalid-api-key
type: string
description: The unique identifier for the type of error.
message:
type: string
default: API key was invalid, expired, or deleted.
description: A description of the error.
suggestion:
type: string
default: Check your API key or create a new one, then try again.
description: One or more suggestions of possible ways to fix the error.
required:
- code
- message
- suggestion
title: ApiErrorUnauthorized
ApiErrorNotFound:
type: object
properties:
code:
const: global/not-found
type: string
description: The unique identifier for the type of error.
message:
type: string
default: The requested resource was not found.
description: A description of the error.
suggestion:
type: string
description: One or more suggestions of possible ways to fix the error.
required:
- code
- message
title: ApiErrorNotFound
GeneratedSSHKey:
type: object
properties:
id:
type: string
description: The unique identifier (ID) of the SSH key.
examples:
- ddf9a910ceb744a0bb95242cbba6cb50
name:
type: string
minLength: 1
maxLength: 64
description: The name of the SSH key.
examples:
- my-public-key
public_key:
type: string
minLength: 1
maxLength: 4096
description: The public key for the SSH key.
examples:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICN+lJwsONkwrdsSnQsu1ydUkIuIg5oOC+Eslvmtt60T noname
private_key:
type: string
description: 'The private key generated in the SSH key pair. Store this value locally;
Lambda does not retain the private key server-side.'
examples:
- '-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----\n'
required:
- id
- name
- public_key
- private_key
title: GeneratedSSHKey
description: Information about a server-generated SSH key.
ApiErrorInvalidParameters:
type: object
properties:
code:
const: global/invalid-parameters
type: string
description: The unique identifier for the type of error.
message:
type: string
default: Invalid request data.
description: A description of the error.
suggestion:
type: string
description: One or more suggestions of possible ways to fix the error.
required:
- code
- message
title: ApiErrorInvalidParameters
EmptyResponse:
type: object
properties: {}
title: EmptyResponse
SSHKey:
type: object
properties:
id:
type: string
description: The unique identifier (ID) of the SSH key.
examples:
- ddf9a910ceb744a0bb95242cbba6cb50
name:
type: string
minLength: 1
maxLength: 64
description: The name of the SSH key.
examples:
- my-public-key
public_key:
type: string
minLength: 1
maxLength: 4096
description: The public key for the SSH key.
examples:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICN+lJwsONkwrdsSnQsu1ydUkIuIg5oOC+Eslvmtt60T noname
required:
- id
- name
- public_key
title: SSHKey
description: Information about a stored SSH key that can be used to access instances over SSH.
securitySchemes:
basicAuth:
type: http
description: 'Basic HTTP authentication. Allowed headers:
* `Authorization: Basic <base64 encoding of api_key>:`
* `Authorization: Basic <api_key>`'
scheme: basic
bearerAuth:
type: http
description: 'Bearer HTTP authentication. Allowed headers:
* `Authorization: Bearer <api_key>`'
scheme: bearer
x-lambda-api-keys-config-url: https://cloud.lambda.ai/api-keys