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.
Responses
201Successful Response422Validation Error
curl -X POST 'https://spideriq.ai/api/gate/v1/interactive/key-lease' \
-H 'Authorization: Bearer ' \
-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 ", "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 ", "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 ")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}
Request body
{"ttl_s":300,"consumer":"my-agent","provider":"groq"}
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
string
path
required
Responses
200Successful Response422Validation Error
curl -X DELETE 'https://spideriq.ai/api/gate/v1/interactive/key-lease/{lease_id}' \
-H 'Authorization: Bearer '
import httpx
resp = httpx.delete(
"https://spideriq.ai/api/gate/v1/interactive/key-lease/{lease_id}",
headers={"Authorization": "Bearer "},
)
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 " }
});
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 ")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}