POST
/
api
/
keys
Mint an API key (owner-only)
curl --request POST \
  --url https://api.jinbatrail.indx.jp/api/keys \
  --header 'Content-Type: application/json' \
  --cookie jt_session= \
  --data '
{
  "name": "prod-integration",
  "mode": "live",
  "scopes": [
    "get-order-status"
  ]
}
'
import requests

url = "https://api.jinbatrail.indx.jp/api/keys"

payload = {
"name": "prod-integration",
"mode": "live",
"scopes": ["get-order-status"]
}
headers = {
"cookie": "jt_session=",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {cookie: 'jt_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'prod-integration', mode: 'live', scopes: ['get-order-status']})
};

fetch('https://api.jinbatrail.indx.jp/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.jinbatrail.indx.jp/api/keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'prod-integration',
'mode' => 'live',
'scopes' => [
'get-order-status'
]
]),
CURLOPT_COOKIE => "jt_session=",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.jinbatrail.indx.jp/api/keys"

payload := strings.NewReader("{\n \"name\": \"prod-integration\",\n \"mode\": \"live\",\n \"scopes\": [\n \"get-order-status\"\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("cookie", "jt_session=")
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))

}
HttpResponse<String> response = Unirest.post("https://api.jinbatrail.indx.jp/api/keys")
.header("cookie", "jt_session=")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"prod-integration\",\n \"mode\": \"live\",\n \"scopes\": [\n \"get-order-status\"\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.jinbatrail.indx.jp/api/keys")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["cookie"] = 'jt_session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"prod-integration\",\n \"mode\": \"live\",\n \"scopes\": [\n \"get-order-status\"\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "name": "<string>",
  "prefix": "jbt_test_a1b",
  "created_at": "<string>",
  "plaintext": "jbt_live_9f2c7b1a4e6d8053a1b2c3d4",
  "scopes": [
    "<string>"
  ],
  "last_used_at": "<string>",
  "revoked_at": "<string>"
}
{
"error": "<string>",
"issues": [
{}
]
}
{
"error": "<string>",
"message": "<string>"
}
{
"error": "<string>",
"message": "<string>"
}
{
"error": "<string>",
"message": "<string>"
}

承認

jt_session
string
cookie
必須

The dashboard's signed, HttpOnly session cookie (packages/service/src/auth.ts): base64url(payload).base64url(hmac-sha256), absolute 30-day lifetime, SameSite=Lax, Secure on any TLS deployment. Minted by POST /api/auth/signup or POST /api/auth/login (or, outside production, auto-provisioned by GET /api/session). Because it is HttpOnly, it cannot be read or attached by a browser-based API-reference "Try it" panel across origins — exercise these routes with a real logged-in browser session or a cookie-jar HTTP client.

ボディ

application/json
name
string
必須

A human label for the key.

Required string length: 1 - 120
mode
enum<string>
デフォルト:test
利用可能なオプション:
live,
test
scopes
string[] | null

Automation-name allowlist. Omitted, null, or [] all mean unscoped.

Maximum array length: 200
Required string length: 1 - 120

レスポンス

Key minted; plaintext is shown here and nowhere else.

The response of POST /api/keys — the ONLY time the plaintext key is ever returned.

id
string
必須
name
string
必須
prefix
string
必須
:

"jbt_test_a1b"

mode
enum<string>
必須
利用可能なオプション:
live,
test
created_at
string
必須
plaintext
string
必須
:

"jbt_live_9f2c7b1a4e6d8053a1b2c3d4"

scopes
string[]

Automation-name allowlist. Absent ⇒ unscoped (every published automation in the org).

last_used_at
string
revoked_at
string