Criar nova chave pública para uso no client-side
curl --request POST \
--url https://api.malga.io/v1/auth \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Client-Id: <api-key>' \
--data '
{
"scope": [
"tokens"
],
"expires": 31104000
}
'const options = {
method: 'POST',
headers: {
'X-Client-Id': '<api-key>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({scope: ['tokens'], expires: 31104000})
};
fetch('https://api.malga.io/v1/auth', 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.malga.io/v1/auth"
payload := strings.NewReader("{\n \"scope\": [\n \"tokens\"\n ],\n \"expires\": 31104000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-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))
}{
"clientId": "cc0b1e41-2936-45c5-947f-93995ffcdc00",
"publicKey": "<YOUR_PUBLIC_KEY>",
"scope": [
"tokens"
],
"expires": 31104000,
"createdAt": "20200110 00:00:00"
}{
"error": {
"type": "api_error",
"code": 123,
"declinedCode": "<string>",
"key": "<string>",
"businessCode": "<string>",
"message": "<string>",
"details": "<array>"
}
}{
"error": {
"type": "api_error",
"code": 123,
"declinedCode": "<string>",
"key": "<string>",
"businessCode": "<string>",
"message": "<string>",
"details": "<array>"
}
}Client-token
Criar nova chave pública para uso no client-side
POST
/
v1
/
auth
Criar nova chave pública para uso no client-side
curl --request POST \
--url https://api.malga.io/v1/auth \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Client-Id: <api-key>' \
--data '
{
"scope": [
"tokens"
],
"expires": 31104000
}
'const options = {
method: 'POST',
headers: {
'X-Client-Id': '<api-key>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({scope: ['tokens'], expires: 31104000})
};
fetch('https://api.malga.io/v1/auth', 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.malga.io/v1/auth"
payload := strings.NewReader("{\n \"scope\": [\n \"tokens\"\n ],\n \"expires\": 31104000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Client-Id", "<api-key>")
req.Header.Add("X-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))
}{
"clientId": "cc0b1e41-2936-45c5-947f-93995ffcdc00",
"publicKey": "<YOUR_PUBLIC_KEY>",
"scope": [
"tokens"
],
"expires": 31104000,
"createdAt": "20200110 00:00:00"
}{
"error": {
"type": "api_error",
"code": 123,
"declinedCode": "<string>",
"key": "<string>",
"businessCode": "<string>",
"message": "<string>",
"details": "<array>"
}
}{
"error": {
"type": "api_error",
"code": 123,
"declinedCode": "<string>",
"key": "<string>",
"businessCode": "<string>",
"message": "<string>",
"details": "<array>"
}
}Body
application/json
Creat authentication token
Response
Created
Determina o escopo de endpoints que a chave terá acesso
Available options:
customers, cards, tokens, charges, webhooks, sessions, auth, reports, flows, sellers, providers, subscriptions Prazo de validade da chave em segundos a partir da criação, zero para não expirar
Identificador do cliente na Malga
Chave pública criada
Was this page helpful?