Crear API key
curl --request POST \
--url https://api.example.com/api-keysimport requests
url = "https://api.example.com/api-keys"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api-keys"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api-keys")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"id": "ak_1a2b3c4d",
"key": "vp_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
"active": true,
"environment": "production"
}
API Keys
Crear API key
Crea una nueva API key. La key completa solo se muestra una vez en la respuesta.
POST
/
api-keys
Crear API key
curl --request POST \
--url https://api.example.com/api-keysimport requests
url = "https://api.example.com/api-keys"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api-keys"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api-keys")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api-keys")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"id": "ak_1a2b3c4d",
"key": "vp_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
"active": true,
"environment": "production"
}
Requiere autenticación con Bearer token.
La API key completa solo se muestra en la respuesta de creación. Asegúrate de copiarla y almacenarla de forma segura.
Respuesta
string
Identificador único de la API key.
string
API key completa. Solo se muestra una vez al momento de la creación.
boolean
Indica si la API key está activa. Por defecto es
true.string
Entorno de la API key:
sandbox o production.{
"id": "ak_1a2b3c4d",
"key": "vp_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
"active": true,
"environment": "production"
}
⌘I