Key Leasing
POST /api/gate/v1/interactive/key-lease
Post Key Lease
Lease a short-lived subscription credential for the tenant's own CLI.
Authorization (all must hold, else fail closed): the caller is a scoped PAT with the `interactive scope; its bound consumer is on the key's allowed_consumers; interactive_cli is on the key's allowed_activities`; and the PAT's brand owns the key. Returns 201 with the leased token + inject recipe; 403/400/409/503 on a failed gate.
Request body
curl -X POST 'https://spideriq.ai/api/gate/v1/interactive/key-lease' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
-d '{
"provider": "groq",
"ttl_s": 300,
"consumer": "my-agent"
}'import httpx
resp = httpx.post(
"https://spideriq.ai/api/gate/v1/interactive/key-lease",
headers={"Authorization": "Bearer <token>", "Content-Type": "application/json"},
json={"provider": "groq", "ttl_s": 300, "consumer": "my-agent"},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch("https://spideriq.ai/api/gate/v1/interactive/key-lease", {
method: "POST",
headers: { "Authorization": "Bearer <token>", "Content-Type": "application/json" },
body: JSON.stringify({"provider": "groq", "ttl_s": 300, "consumer": "my-agent"})
});
const data = await resp.json();
console.log(data);package main
import (
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{"provider": "groq", "ttl_s": 300, "consumer": "my-agent"}`)
req, _ := http.NewRequest("POST", "https://spideriq.ai/api/gate/v1/interactive/key-lease", body)
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}Responses
201— Successful Response422— Validation Error
DELETE /api/gate/v1/interactive/key-lease/{lease_id}
Delete Key Lease
Release an active lease early so the (brand, provider, consumer) slot frees.
Idempotent — releasing an unknown/expired lease returns `released=false`, not an error, so a runner's on-exit cleanup is always safe.
Parameters
lease_id(path, string, required)
curl -X DELETE 'https://spideriq.ai/api/gate/v1/interactive/key-lease/{lease_id}' \
-H 'Authorization: Bearer <token>'import httpx
resp = httpx.delete(
"https://spideriq.ai/api/gate/v1/interactive/key-lease/{lease_id}",
headers={"Authorization": "Bearer <token>"},
)
resp.raise_for_status()
print(resp.json())const resp = await fetch("https://spideriq.ai/api/gate/v1/interactive/key-lease/{lease_id}", {
method: "DELETE",
headers: { "Authorization": "Bearer <token>" }
});
const data = await resp.json();
console.log(data);package main
import (
"net/http"
)
func main() {
req, _ := http.NewRequest("DELETE", "https://spideriq.ai/api/gate/v1/interactive/key-lease/{lease_id}", nil)
req.Header.Set("Authorization", "Bearer <token>")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}Responses
200— Successful Response422— Validation Error