Skip to main content
POST
/
v1
/
agent-credentials
Request a sandbox-only agent credential
curl --request POST \
  --url https://api.example.com/v1/agent-credentials \
  --header 'Content-Type: application/json' \
  --data '
{
  "agent": "claude-code",
  "client": "cli",
  "organization_name": "Example Energy Co",
  "user_name": "Avery Developer",
  "assignment": "Prototype bill impact calculations for a customer dashboard",
  "tech_stack": [
    "typescript",
    "node"
  ],
  "use_case": "Evaluate WattShift bill impact endpoints in sandbox",
  "user_email": "[email protected]",
  "company": "Example Energy Co",
  "requested_scopes": [
    "calculate",
    "homes"
  ],
  "requested_environment": "sandbox",
  "requested_ttl_seconds": 86400
}
'
import requests

url = "https://api.example.com/v1/agent-credentials"

payload = {
"agent": "claude-code",
"client": "cli",
"organization_name": "Example Energy Co",
"user_name": "Avery Developer",
"assignment": "Prototype bill impact calculations for a customer dashboard",
"tech_stack": ["typescript", "node"],
"use_case": "Evaluate WattShift bill impact endpoints in sandbox",
"user_email": "[email protected]",
"company": "Example Energy Co",
"requested_scopes": ["calculate", "homes"],
"requested_environment": "sandbox",
"requested_ttl_seconds": 86400
}
headers = {"Content-Type": "application/json"}

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

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
agent: 'claude-code',
client: 'cli',
organization_name: 'Example Energy Co',
user_name: 'Avery Developer',
assignment: 'Prototype bill impact calculations for a customer dashboard',
tech_stack: ['typescript', 'node'],
use_case: 'Evaluate WattShift bill impact endpoints in sandbox',
user_email: '[email protected]',
company: 'Example Energy Co',
requested_scopes: ['calculate', 'homes'],
requested_environment: 'sandbox',
requested_ttl_seconds: 86400
})
};

fetch('https://api.example.com/v1/agent-credentials', 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/v1/agent-credentials",
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([
'agent' => 'claude-code',
'client' => 'cli',
'organization_name' => 'Example Energy Co',
'user_name' => 'Avery Developer',
'assignment' => 'Prototype bill impact calculations for a customer dashboard',
'tech_stack' => [
'typescript',
'node'
],
'use_case' => 'Evaluate WattShift bill impact endpoints in sandbox',
'user_email' => '[email protected]',
'company' => 'Example Energy Co',
'requested_scopes' => [
'calculate',
'homes'
],
'requested_environment' => 'sandbox',
'requested_ttl_seconds' => 86400
]),
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.example.com/v1/agent-credentials"

payload := strings.NewReader("{\n \"agent\": \"claude-code\",\n \"client\": \"cli\",\n \"organization_name\": \"Example Energy Co\",\n \"user_name\": \"Avery Developer\",\n \"assignment\": \"Prototype bill impact calculations for a customer dashboard\",\n \"tech_stack\": [\n \"typescript\",\n \"node\"\n ],\n \"use_case\": \"Evaluate WattShift bill impact endpoints in sandbox\",\n \"user_email\": \"[email protected]\",\n \"company\": \"Example Energy Co\",\n \"requested_scopes\": [\n \"calculate\",\n \"homes\"\n ],\n \"requested_environment\": \"sandbox\",\n \"requested_ttl_seconds\": 86400\n}")

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

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.example.com/v1/agent-credentials")
.header("Content-Type", "application/json")
.body("{\n \"agent\": \"claude-code\",\n \"client\": \"cli\",\n \"organization_name\": \"Example Energy Co\",\n \"user_name\": \"Avery Developer\",\n \"assignment\": \"Prototype bill impact calculations for a customer dashboard\",\n \"tech_stack\": [\n \"typescript\",\n \"node\"\n ],\n \"use_case\": \"Evaluate WattShift bill impact endpoints in sandbox\",\n \"user_email\": \"[email protected]\",\n \"company\": \"Example Energy Co\",\n \"requested_scopes\": [\n \"calculate\",\n \"homes\"\n ],\n \"requested_environment\": \"sandbox\",\n \"requested_ttl_seconds\": 86400\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/agent-credentials")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent\": \"claude-code\",\n \"client\": \"cli\",\n \"organization_name\": \"Example Energy Co\",\n \"user_name\": \"Avery Developer\",\n \"assignment\": \"Prototype bill impact calculations for a customer dashboard\",\n \"tech_stack\": [\n \"typescript\",\n \"node\"\n ],\n \"use_case\": \"Evaluate WattShift bill impact endpoints in sandbox\",\n \"user_email\": \"[email protected]\",\n \"company\": \"Example Energy Co\",\n \"requested_scopes\": [\n \"calculate\",\n \"homes\"\n ],\n \"requested_environment\": \"sandbox\",\n \"requested_ttl_seconds\": 86400\n}"

response = http.request(request)
puts response.read_body
{
  "outcome": "issued",
  "credential": "wsk_agent_example_token",
  "credential_id": "ws_agent_cred_123456789",
  "key_prefix": "wsk_agent",
  "request_id": "ws_request_123456789",
  "credential_request_id": "ws_cred_request_123456789",
  "expires_at": "2025-01-03T12:00:00.000Z",
  "scopes": [
    "calculate",
    "homes"
  ],
  "environment": "sandbox",
  "production_access": false,
  "revocation_method": "POST",
  "revocation_path": "/v1/agent-credentials/ws_agent_cred_123456789/revoke",
  "next_steps": "Store the credential securely and send it as the x-ws-api-key header on sandbox requests."
}

Body

application/json
organization_name
string
required
Required string length: 1 - 255
user_name
string
required
Required string length: 1 - 255
assignment
string
required
Required string length: 10 - 4000
requested_scopes
string[]
required
Required array length: 1 - 20 elements
Maximum string length: 128
agent
string
Maximum string length: 128
client
string
Maximum string length: 128
tech_stack
string[]
Maximum array length: 20
Maximum string length: 64
use_case
string
Maximum string length: 128
device_segment
string
Maximum string length: 128
project
string
Maximum string length: 128
user_email
string<email>
company
string
Maximum string length: 255
requested_environment
enum<string>
default:sandbox
Available options:
sandbox,
production
requested_ttl_seconds
integer
Required range: x > 0
docs_context
string<uri>
Maximum string length: 2048

Response

200 - application/json

Sandbox credential issuance outcome.

outcome
enum<string>
required
Available options:
issued,
needs_more_info,
rate_limited,
production_denied
request_id
string
required
credential_request_id
string
required
environment
enum<string>
required
Available options:
sandbox
production_access
boolean
required
next_steps
string
required
credential
string
credential_id
string
key_prefix
string
expires_at
string<date-time>
scopes
string[]
revocation_method
enum<string>
Available options:
POST
revocation_path
string
retry_after_seconds
integer
Required range: x > 0