Create an API key
curl --request POST \
--url https://api.metal.ai/v1/keys \
--header 'Content-Type: application/json' \
--header 'x-metal-api-key: <api-key>' \
--header 'x-metal-client-id: <api-key>' \
--data '
{
"name": "Data sync (production)"
}
'import requests
url = "https://api.metal.ai/v1/keys"
payload = { "name": "Data sync (production)" }
headers = {
"x-metal-client-id": "<api-key>",
"x-metal-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-metal-client-id': '<api-key>',
'x-metal-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({name: 'Data sync (production)'})
};
fetch('https://api.metal.ai/v1/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.metal.ai/v1/keys"
payload := strings.NewReader("{\n \"name\": \"Data sync (production)\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-metal-client-id", "<api-key>")
req.Header.Add("x-metal-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"data": {
"id": "<string>",
"name": "Production sync",
"key": "pk_your_api_key_here",
"keyLastFour": "here",
"clientId": "ci_your_client_id_here"
}
}{
"error": "invalid api key or clientId"
}{
"error": "Key limit reached"
}Create an API key
Creates a new API key. The secret key is returned only once in this response, so store it securely.
POST
/
v1
/
keys
Create an API key
curl --request POST \
--url https://api.metal.ai/v1/keys \
--header 'Content-Type: application/json' \
--header 'x-metal-api-key: <api-key>' \
--header 'x-metal-client-id: <api-key>' \
--data '
{
"name": "Data sync (production)"
}
'import requests
url = "https://api.metal.ai/v1/keys"
payload = { "name": "Data sync (production)" }
headers = {
"x-metal-client-id": "<api-key>",
"x-metal-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-metal-client-id': '<api-key>',
'x-metal-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({name: 'Data sync (production)'})
};
fetch('https://api.metal.ai/v1/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.metal.ai/v1/keys"
payload := strings.NewReader("{\n \"name\": \"Data sync (production)\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-metal-client-id", "<api-key>")
req.Header.Add("x-metal-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"data": {
"id": "<string>",
"name": "Production sync",
"key": "pk_your_api_key_here",
"keyLastFour": "here",
"clientId": "ci_your_client_id_here"
}
}{
"error": "invalid api key or clientId"
}{
"error": "Key limit reached"
}Authorizations
The Client ID of your API key.
The secret value of your API key.
Body
application/json
A descriptive name for the key.
Example:
"Data sync (production)"
Response
The created API key, including the one-time secret.
A newly created API key. The secret key is returned only once.
Show child attributes
Show child attributes

