NAV Navbar
shell python go

Introduction

Welcome to the Lambda Store API! You can use the API to create and manage your databases.

We have language bindings in Shell, Python, and Go. You can view code examples in the dark area at the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

To authorize, use this code:

    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://lambda.store/v1/databases", nil)
    if err != nil {
        log.Fatal(err)
    }
    req.SetBasicAuth("EMAIL", "API_KEY")
    resp, err := client.Do(req)
    if err != nil {
        log.Fatal(err)
    }
    bodyText, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("%s\n", bodyText)
import requests

response = requests.get('https://lambda.store/v1/databases', auth=('EMAIL', 'API_KEY'))

# With shell, you can just pass the correct header with each request
curl "https://lambda.store/v1/databases"
  -u EMAIL:API_KEY

Make sure to replace EMAIL and API_KEY with your email and API key.

Lambda Store API requires API keys to authenticate requests. You can view and manage API keys at the Lambda Store Console.

Lambda Store API uses HTTP Basic authentication. You should pass EMAIL and API_KEY as basic authentication username and password respectively.

With a client such as curl, you can pass your credentials with the -u option, as the following example shows:

curl https://api.lambda.store/v1/databases -u EMAIL:API_KEY

Databases

Endpoints to create, manage and monitor databases.

All endpoints return responses encoded as JSON.

Create Database

import requests

data = '{\n"database_name":"myredis",\n"region":"eu-west-1",\n"type":"free"\n}'

response = requests.post('https://api.lambda.store/v1/database', data=data, auth=('EMAIL', 'API_KEY'))

curl -X POST \
  https://api.lambda.store/v1/database \
  -u 'EMAIL:API_KEY' \
  -d '{
"database_name":"myredis",
"region":"eu-west-1",
"type":"free"
}'
client := &http.Client{}
var data = strings.NewReader(`{
    "database_name":"myredis",
    "region":"eu-west-1",
    "type":"free"
}`)
req, err := http.NewRequest("POST", "https://api.lambda.store/v1/database", data)
if err != nil {
    log.Fatal(err)
}
req.SetBasicAuth("username", "password")
resp, err := client.Do(req)
if err != nil {
    log.Fatal(err)
}
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)ttn');

Make sure to replace EMAIL and API_KEY with your email and API key. The above command returns a JSON structured like this:

{
    "database_id": "92130612-329f-45a3-b858-dada583ed06c",
    "database_name": "myredisdb",
    "region": "eu-west-1",
    "type": "free",
    "port": 30140,
    "creation_time": 1589036113,
    "state": "active",
    "password": "e12cf384fdf9419fbae726cc5a2cd3b0",
    "user_email": "example@lambda.store",
    "endpoint": "eu1-selected-goat-30138.lambda.store",
    "tls": false
}

This endpoint creates a new Redis database.

Request parameters should be encoded as JSON.

HTTP Request

POST https://api.lambda.store/v1/database

Request Parameters

Parameter Description
database_name Name of the database
region Region of the database. (eu-west-1 or us-east-1)
type Type of the database. (free or standard)

Response Parameters

Parameter Description
database_id ID of the created database
database_name Name of the database
region The region where database is hosted
port Database port for clients to connect
creation_time Creation time of the database as Unix time
state State of database (active or deleted)
password Password of the database
user_email User email
endpoint Endpoint URL of the database
tls TLS/SSL is enabled or not

Upgrade Database

import requests

data = '{\n"type":"standard"\n}'

response = requests.post('https://api.lambda.store/v1/database/:id/upgrade', data=data, auth=('EMAIL', 'API_KEY'))
curl -X POST \
  https://api.lambda.store/v1/database/:id/upgrade \
  -u 'EMAIL:API_KEY' \
  -d '{
"type":"standard"
}'
client := &http.Client{}
var data = strings.NewReader(`{"type":"standard"}`)
req, err := http.NewRequest("POST", "https://api.lambda.store/v1/database/:id/upgrade", data)
if err != nil {
    log.Fatal(err)
}
req.SetBasicAuth("EMAIL", "API_KEY")
resp, err := client.Do(req)
if err != nil {
    log.Fatal(err)
}
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)

Make sure to replace EMAIL and API_KEY with your email and API key. The above command returns JSON structured like this:

{
    "database_id": "92130636-329f-45e3-b858-dada583ed06c",
    "database_name": "myredisdb",
    "region": "eu-west-1",
    "type": "free",
    "port": 30140,
    "creation_time": 1589036113,
    "state": "active",
    "user_email": "example@lambda.store",
    "endpoint": "eu1-selected-foal-30140.lambda.store",
    "tls": false
}

This endpoint upgrades a free database to a standard database.

HTTP Request

POST https://api.lambda.store/v1/database/:id/upgrade

URL Parameters

Parameter Description
ID The ID of the database to upgrade

Request Parameters

Parameter Description
type New type of the database. (standard)

Response Parameters

Parameter Description
database_id ID of the created new database
database_name Name of the database
region The region where the database is deployed
port Port of the database
creation_time Creation time of the database as Unix time
state State of the database (active or deleted)
user_email User email
endpoint Endpoint URL of the database
tls TLS/SSL is enabled or not

Get Database

import requests

response = requests.get('https://api.lambda.store/v1/database/:id', auth=('EMAIL', 'API_KEY'))

curl -X GET \
  https://api.lambda.store/v1/database/:id \
  -u 'EMAIL:API_KEY'
client := &http.Client{}
req, err := http.NewRequest("GET", "https://api.lambda.store/v1/database/:id", nil)
if err != nil {
    log.Fatal(err)
}
req.SetBasicAuth("EMAIL", "API_KEY")
resp, err := client.Do(req)
if err != nil {
    log.Fatal(err)
}
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)

Make sure to replace EMAIL and API_KEY with your email and API key. The above command returns JSON structured like this:

{
    "database_id": "92130636-329f-45e3-b858-dada583ed06c",
    "database_name": "myredisdb",
    "region": "eu-west-1",
    "type": "free",
    "port": 30140,
    "creation_time": 1589036113,
    "state": "active",
    "user_email": "example@lambda.store",
    "endpoint": "eu1-selected-foal-30140.lambda.store",
    "tls": false
}

This API request gets information about a database.

The password is not included in the response of this API request. If you need it, save the password when you first created the database.

HTTP Request

GET https://api.lambda.store/v1/database/:id

URL Parameters

Parameter Description
ID The ID of the database to retrieve

Response Parameters

Parameter Description
database_id ID of the created new database
database_name Name of the database.
region The region where database is deployed
port Port of the database
creation_time Creation time of the database as Unix time
state State of the database (active or deleted)
user_email User email
endpoint Endpoint URL of the database
tls SSL is enabled or not

Get All Databases

import requests

response = requests.get('https://api.lambda.store/v1/databases', auth=('EMAIL', 'API_KEY'))

curl -X GET \
  https://api.lambda.store/v1/databases \
  -u 'EMAIL:API_KEY'
client := &http.Client{}
req, err := http.NewRequest("GET", "https://api.lambda.store/v1/databases", nil)
if err != nil {
    log.Fatal(err)
}
req.SetBasicAuth("EMAIL", "API_KEY")
resp, err := client.Do(req)
if err != nil {
    log.Fatal(err)
}
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)

Make sure to replace EMAIL and API_KEY with your email and API key. The above command returns JSON structured like this:

[
    {
        "database_id": "10436fd0-4b9a-439e-a638-0781e987627b",
        "database_name": "anotherdb",
        "region": "eu-west-1"
    },
    {
        "database_id": "fdc9c824-cfec-4b5b-9fb7-1e4cd8190675",
        "database_name": "freedb",
        "region": "eu-west-1"
    }
]

This endpoint retrieves all databases.

HTTP Request

GET https://api.lambda.store/v1/databases

Response Parameters

Parameter Description
database_id ID of the created new database
database_name Name of the database.
region The region where the database is deployed

Delete Database

import requests

response = requests.delete('https://api.lambda.store/v1/database/:id', auth=('EMAIL', 'API_KEY'))

curl -X DELETE \
  https://api.lambda.store/v1/database/:id \
  -u 'EMAIL:API_KEY'
    client := &http.Client{}
    req, err := http.NewRequest("DELETE", "https://lambda.store/v1/database/:id", nil)
    if err != nil {
        log.Fatal(err)
    }
    req.SetBasicAuth("EMAIL", "API_KEY")
    resp, err := client.Do(req)
    if err != nil {
        log.Fatal(err)
    }
    bodyText, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("%s\n", bodyText)

This endpoint deletes a specific database.

HTTP Request

DELETE https://api.lambda.store/v1/database/:id

URL Parameters

Parameter Description
ID The ID of the database to delete

Get Database Billing

import requests

response = requests.get('https://api.lambda.store/v1/database/:id/billing', auth=('EMAIL', 'API_KEY'))
curl -X GET \
  https://api.lambda.store/v1/database/:id/billing \
  -u 'EMAIL:API_KEY'
client := &http.Client{}
req, err := http.NewRequest("GET", "https://api.lambda.store/v1/database/:id/billing", nil)
if err != nil {
    log.Fatal(err)
}
req.SetBasicAuth("EMAIL", "API_KEY")
resp, err := client.Do(req)
if err != nil {
    log.Fatal(err)
}
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)

The above command returns JSON structured like this:

{
    "current_month_cost": 0.1,
    "current_month_storage": 1000,
    "current_month_request": 25000
}

This endpoint gets billing of the database for the current month.

HTTP Request

GET https://api.lambda.store/v1/database/:id/billing

URL Parameters

Parameter Description
ID The ID of the database to retrieve billing details for the current month.

Response Parameters

Parameter Description
current_month_cost Cost in USD for the current month
current_month_storage Average storage for the current month
current_month_request Total number of requests for the current month

Get Database Stats

import requests

response = requests.get('https://api.lambda.store/v1/database/:id/stats', auth=('EMAIL', 'API_KEY'))
curl -X GET \
  https://api.lambda.store/v1/database/:id/stats \
  -u 'EMAIL:API_KEY'
client := &http.Client{}
req, err := http.NewRequest("GET", "https://api.lambda.store/v1/database/:id/stats", nil)
if err != nil {
    log.Fatal(err)
}
req.SetBasicAuth("EMAIL", "API_KEY")
resp, err := client.Do(req)
if err != nil {
    log.Fatal(err)
}
bodyText, err := ioutil.ReadAll(resp.Body)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("%s\n", bodyText)

The above command returns JSON structured like this:

{
    "total_request": 7,
    "daily_request": 7,
    "key_space": 5,
    "data_size": 181,
    "max_data_size": "10737418240",
    "hits": 0,
    "misses": 5,
    "active_client": 0,
    "max_client_allowed": "1000",
    "health_status": true
}

This endpoint retrieves stats of a specific database.

HTTP Request

GET https://api.lambda.store/v1/database/:id/stats

URL Parameters

Parameter Description
ID The ID of the database

Response Parameters

Parameter Description
total_request The total requests for the database since the database creation
daily_request Number of requests for today. It is calculated based on GMT.
key_space Current number of keys in database
data_size Current total data size of the database in bytes
max_data_size Max data size allowed for the database in bytes
hits Total hits for specific database
misses Total misses for specific database
active_client Current active client count
max_client_allowed Max client allowed for the database
health_status Health status of the the database

HTTP Status Codes

The Lambda Store API uses the following HTTP Status codes:

Error Code Meaning
200 OK -- Indicates that a request completed successfully and the response contains data.
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The kitten requested is hidden for administrators only.
404 Not Found -- The specified kitten could not be found.
405 Method Not Allowed -- You tried to access a kitten with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.