# Weft API Reference

Agent onboarding flows, optimized for automated clients.

## Quickstart

1. Create an account and confirm email
2. Sign in to get a session token
3. Create an API key via the dashboard or `POST /api/v1/api_keys`
4. Use your API key as a Bearer token to access the API
5. List your payments, agents, and manage API keys

## Base URLs

- `https://weft.network`
- `https://staging.weft.network`
- `http://localhost:3000`

## Authentication

**Auth endpoints** (sign up, sign in, etc.) do not require authentication.

**All other endpoints** require a Bearer token via `Authorization: Bearer <token>`. Use an API key (`ax_live_*`) obtained from the dashboard or the Create API Key endpoint.

## SDKs

Install the SDK for your language:

```bash
# TypeScript / JavaScript
npm install @weft-labs/sdk

# Python
pip install weft-sdk

# Ruby
gem install weft-sdk

# Go
go get github.com/weft-labs/weft-sdk/go
```

### TypeScript

```ts
import { Configuration, AuthApi, PaymentsApi, AgentsApi, APIKeysApi, AccountApi } from "@weft-labs/sdk";

// Auth endpoints (no token needed)
const auth = new AuthApi();

// Authenticated endpoints (API key required)
const config = new Configuration({
  accessToken: "ax_live_your_api_key_here",
});
const payments = new PaymentsApi(config);
const agents = new AgentsApi(config);
const apiKeys = new APIKeysApi(config);
const account = new AccountApi(config);
```

### Python

```python
import weft_sdk.generated
from weft_sdk.generated.api import payments_api, agents_api

configuration = weft_sdk.generated.Configuration(
    access_token = "ax_live_your_api_key_here"
)

with weft_sdk.generated.ApiClient(configuration) as api_client:
    payments = payments_api.PaymentsApi(api_client)
    agents = agents_api.AgentsApi(api_client)
```

### Ruby

```ruby
require 'weft-sdk'

Weft.configure do |config|
  config.access_token = 'ax_live_your_api_key_here'
end

payments = Weft::PaymentsApi.new
agents = Weft::AgentsApi.new
```

### Go

```go
import openapiclient "github.com/weft-labs/weft-sdk/go/generated"

configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
```

SDK examples are shown alongside each endpoint below. Use the language tabs to switch between implementations.



The Weft API is the buyer-runtime surface that powers the `weft` CLI,
the hosted MCP server (`weft.network/mcp`), and any third-party agent
that wants to discover and pay for paid resources on Weft. v1 covers
five buyer concerns:

  1. Account onboarding (`/api/v1/auth/*`, `/api/v1/me`)
  2. CLI authentication (`/api/v1/api_keys`)
  3. Wallet visibility (`/api/v1/balance`)
  4. Discovery (`/api/v1/search`)
  5. Paid execution (`/api/v1/fetch`)
  6. Purchase history (`/api/v1/payments`)

Seller-side concerns (agent management, payout analytics, webhook
delivery, the public storefront for `data_api` resources) live in the
dashboard and are intentionally not documented here. They will be
split out into a separate, dashboard-scoped spec when they need to be
SDK-consumable.

All errors share the envelope defined by `ErrorResponse`, except the
buyer-runtime endpoints (`/search`, `/fetch`) which use bespoke
envelopes carrying additional context — see `SearchErrorResponse` and
`FetchErrorResponse`.

<h1 id="weft-api-auth">Auth</h1>

Account creation and authentication flows.

## Create an account

`POST /api/v1/auth/sign_up`

**Request body**

```json
{
  "email": "user@example.com",
  "password": "string",
  "password_confirmation": "string"
}
```

<h3 id="create-an-account-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[SignUpRequest](#schemasignuprequest)|true|none|

**200 Response**

```json
{
  "data": {
    "user": {
      "id": 0,
      "email": "user@example.com",
      "status": "string"
    },
    "token": "string",
    "confirmation_required": true
  }
}
```

<h3 id="create-an-account-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Account created|[AuthResponse](#schemaauthresponse)|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|Validation error|[ErrorResponse](#schemaerrorresponse)|

<p class="auth-note">No authentication required</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>AuthResponse signUp(signUpRequest)</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  AuthApi,
} from '@weft-labs/sdk';
import type { SignUpOperationRequest } from '@weft-labs/sdk';

const api = new AuthApi();

const body = {
  // SignUpRequest
  signUpRequest: ...,
} satisfies SignUpOperationRequest;

const data = await api.signUp(body);
console.log(data);</code></pre>
<p><strong>Parameters:</strong></p>
<table class="sdk-params"><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>signUpRequest</td><td><code>SignUpRequest</code></td><td></td><td></td></tr></tbody></table>
<p><strong>Returns:</strong> <code>AuthResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>AuthResponse sign_up(sign_up_request)</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.auth_response import AuthResponse
from weft_sdk.generated.models.sign_up_request import SignUpRequest
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)


# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.AuthApi(api_client)
    sign_up_request = weft_sdk.generated.SignUpRequest() # SignUpRequest | 

    try:
        # Create an account
        api_response = api_instance.sign_up(sign_up_request)
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling AuthApi-&gt;sign_up: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> sign_up(sign_up_request)</code></p>
<pre><code class="language-ruby">require 'weft-sdk'

api_instance = Weft::AuthApi.new
sign_up_request = Weft::SignUpRequest.new({email: 'email_example', password: 'password_example', password_confirmation: 'password_confirmation_example'}) # SignUpRequest | 

begin
  # Create an account
  result = api_instance.sign_up(sign_up_request)
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling AuthApi-&gt;sign_up: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>AuthResponse SignUp(ctx).SignUpRequest(signUpRequest).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {
	signUpRequest := *openapiclient.NewSignUpRequest(&quot;Email_example&quot;, &quot;Password_example&quot;, &quot;PasswordConfirmation_example&quot;) // SignUpRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.AuthAPI.SignUp(context.Background()).SignUpRequest(signUpRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `AuthAPI.SignUp``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `SignUp`: AuthResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `AuthAPI.SignUp`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


## Confirm an account

`POST /api/v1/auth/confirm`

**Request body**

```json
{
  "confirmation_token": "string"
}
```

<h3 id="confirm-an-account-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[ConfirmRequest](#schemaconfirmrequest)|true|none|

**200 Response**

```json
{
  "data": {
    "user": {
      "id": 0,
      "email": "user@example.com",
      "status": "string"
    },
    "token": "string",
    "confirmation_required": true
  }
}
```

<h3 id="confirm-an-account-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Account confirmed|[AuthResponse](#schemaauthresponse)|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|Invalid token|[ErrorResponse](#schemaerrorresponse)|

<p class="auth-note">No authentication required</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>AuthResponse confirmAccount(confirmRequest)</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  AuthApi,
} from '@weft-labs/sdk';
import type { ConfirmAccountRequest } from '@weft-labs/sdk';

const api = new AuthApi();

const body = {
  // ConfirmRequest
  confirmRequest: ...,
} satisfies ConfirmAccountRequest;

const data = await api.confirmAccount(body);
console.log(data);</code></pre>
<p><strong>Parameters:</strong></p>
<table class="sdk-params"><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>confirmRequest</td><td><code>ConfirmRequest</code></td><td></td><td></td></tr></tbody></table>
<p><strong>Returns:</strong> <code>AuthResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>AuthResponse confirm_account(confirm_request)</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.auth_response import AuthResponse
from weft_sdk.generated.models.confirm_request import ConfirmRequest
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)


# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.AuthApi(api_client)
    confirm_request = weft_sdk.generated.ConfirmRequest() # ConfirmRequest | 

    try:
        # Confirm an account
        api_response = api_instance.confirm_account(confirm_request)
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling AuthApi-&gt;confirm_account: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> confirm_account(confirm_request)</code></p>
<pre><code class="language-ruby">require 'weft-sdk'

api_instance = Weft::AuthApi.new
confirm_request = Weft::ConfirmRequest.new({confirmation_token: 'confirmation_token_example'}) # ConfirmRequest | 

begin
  # Confirm an account
  result = api_instance.confirm_account(confirm_request)
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling AuthApi-&gt;confirm_account: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>AuthResponse ConfirmAccount(ctx).ConfirmRequest(confirmRequest).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {
	confirmRequest := *openapiclient.NewConfirmRequest(&quot;ConfirmationToken_example&quot;) // ConfirmRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.AuthAPI.ConfirmAccount(context.Background()).ConfirmRequest(confirmRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `AuthAPI.ConfirmAccount``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `ConfirmAccount`: AuthResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `AuthAPI.ConfirmAccount`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


## Resend confirmation email

`POST /api/v1/auth/resend-confirmation`

**Request body**

```json
{
  "email": "user@example.com"
}
```

<h3 id="resend-confirmation-email-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[ResendConfirmationRequest](#schemaresendconfirmationrequest)|true|none|

**200 Response**

```json
{
  "data": {
    "message": "string"
  }
}
```

<h3 id="resend-confirmation-email-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Confirmation sent|[MessageResponse](#schemamessageresponse)|

<p class="auth-note">No authentication required</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>MessageResponse resendConfirmation(resendConfirmationRequest)</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  AuthApi,
} from '@weft-labs/sdk';
import type { ResendConfirmationOperationRequest } from '@weft-labs/sdk';

const api = new AuthApi();

const body = {
  // ResendConfirmationRequest
  resendConfirmationRequest: ...,
} satisfies ResendConfirmationOperationRequest;

const data = await api.resendConfirmation(body);
console.log(data);</code></pre>
<p><strong>Parameters:</strong></p>
<table class="sdk-params"><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>resendConfirmationRequest</td><td><code>ResendConfirmationRequest</code></td><td></td><td></td></tr></tbody></table>
<p><strong>Returns:</strong> <code>MessageResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>MessageResponse resend_confirmation(resend_confirmation_request)</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.message_response import MessageResponse
from weft_sdk.generated.models.resend_confirmation_request import ResendConfirmationRequest
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)


# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.AuthApi(api_client)
    resend_confirmation_request = weft_sdk.generated.ResendConfirmationRequest() # ResendConfirmationRequest | 

    try:
        # Resend confirmation email
        api_response = api_instance.resend_confirmation(resend_confirmation_request)
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling AuthApi-&gt;resend_confirmation: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> resend_confirmation(resend_confirmation_request)</code></p>
<pre><code class="language-ruby">require 'weft-sdk'

api_instance = Weft::AuthApi.new
resend_confirmation_request = Weft::ResendConfirmationRequest.new({email: 'email_example'}) # ResendConfirmationRequest | 

begin
  # Resend confirmation email
  result = api_instance.resend_confirmation(resend_confirmation_request)
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling AuthApi-&gt;resend_confirmation: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>MessageResponse ResendConfirmation(ctx).ResendConfirmationRequest(resendConfirmationRequest).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {
	resendConfirmationRequest := *openapiclient.NewResendConfirmationRequest(&quot;Email_example&quot;) // ResendConfirmationRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.AuthAPI.ResendConfirmation(context.Background()).ResendConfirmationRequest(resendConfirmationRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `AuthAPI.ResendConfirmation``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `ResendConfirmation`: MessageResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `AuthAPI.ResendConfirmation`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


## Sign in with email and password

`POST /api/v1/auth/sign_in`

**Request body**

```json
{
  "email": "user@example.com",
  "password": "string"
}
```

<h3 id="sign-in-with-email-and-password-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[SignInRequest](#schemasigninrequest)|true|none|

**200 Response**

```json
{
  "data": {
    "user": {
      "id": 0,
      "email": "user@example.com",
      "status": "string"
    },
    "token": "string",
    "confirmation_required": true
  }
}
```

<h3 id="sign-in-with-email-and-password-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Signed in|[AuthResponse](#schemaauthresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Invalid credentials|[ErrorResponse](#schemaerrorresponse)|

<p class="auth-note">No authentication required</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>AuthResponse signIn(signInRequest)</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  AuthApi,
} from '@weft-labs/sdk';
import type { SignInOperationRequest } from '@weft-labs/sdk';

const api = new AuthApi();

const body = {
  // SignInRequest
  signInRequest: ...,
} satisfies SignInOperationRequest;

const data = await api.signIn(body);
console.log(data);</code></pre>
<p><strong>Parameters:</strong></p>
<table class="sdk-params"><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>signInRequest</td><td><code>SignInRequest</code></td><td></td><td></td></tr></tbody></table>
<p><strong>Returns:</strong> <code>AuthResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>AuthResponse sign_in(sign_in_request)</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.auth_response import AuthResponse
from weft_sdk.generated.models.sign_in_request import SignInRequest
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)


# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.AuthApi(api_client)
    sign_in_request = weft_sdk.generated.SignInRequest() # SignInRequest | 

    try:
        # Sign in with email and password
        api_response = api_instance.sign_in(sign_in_request)
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling AuthApi-&gt;sign_in: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> sign_in(sign_in_request)</code></p>
<pre><code class="language-ruby">require 'weft-sdk'

api_instance = Weft::AuthApi.new
sign_in_request = Weft::SignInRequest.new({email: 'email_example', password: 'password_example'}) # SignInRequest | 

begin
  # Sign in with email and password
  result = api_instance.sign_in(sign_in_request)
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling AuthApi-&gt;sign_in: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>AuthResponse SignIn(ctx).SignInRequest(signInRequest).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {
	signInRequest := *openapiclient.NewSignInRequest(&quot;Email_example&quot;, &quot;Password_example&quot;) // SignInRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.AuthAPI.SignIn(context.Background()).SignInRequest(signInRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `AuthAPI.SignIn``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `SignIn`: AuthResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `AuthAPI.SignIn`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


## Request password reset

`POST /api/v1/auth/password/reset`

**Request body**

```json
{
  "email": "user@example.com"
}
```

<h3 id="request-password-reset-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[PasswordResetRequest](#schemapasswordresetrequest)|true|none|

**200 Response**

```json
{
  "data": {
    "message": "string"
  }
}
```

<h3 id="request-password-reset-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Reset email sent|[MessageResponse](#schemamessageresponse)|

<p class="auth-note">No authentication required</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>MessageResponse requestPasswordReset(passwordResetRequest)</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  AuthApi,
} from '@weft-labs/sdk';
import type { RequestPasswordResetRequest } from '@weft-labs/sdk';

const api = new AuthApi();

const body = {
  // PasswordResetRequest
  passwordResetRequest: ...,
} satisfies RequestPasswordResetRequest;

const data = await api.requestPasswordReset(body);
console.log(data);</code></pre>
<p><strong>Parameters:</strong></p>
<table class="sdk-params"><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>passwordResetRequest</td><td><code>PasswordResetRequest</code></td><td></td><td></td></tr></tbody></table>
<p><strong>Returns:</strong> <code>MessageResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>MessageResponse request_password_reset(password_reset_request)</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.message_response import MessageResponse
from weft_sdk.generated.models.password_reset_request import PasswordResetRequest
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)


# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.AuthApi(api_client)
    password_reset_request = weft_sdk.generated.PasswordResetRequest() # PasswordResetRequest | 

    try:
        # Request password reset
        api_response = api_instance.request_password_reset(password_reset_request)
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling AuthApi-&gt;request_password_reset: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> request_password_reset(password_reset_request)</code></p>
<pre><code class="language-ruby">require 'weft-sdk'

api_instance = Weft::AuthApi.new
password_reset_request = Weft::PasswordResetRequest.new({email: 'email_example'}) # PasswordResetRequest | 

begin
  # Request password reset
  result = api_instance.request_password_reset(password_reset_request)
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling AuthApi-&gt;request_password_reset: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>MessageResponse RequestPasswordReset(ctx).PasswordResetRequest(passwordResetRequest).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {
	passwordResetRequest := *openapiclient.NewPasswordResetRequest(&quot;Email_example&quot;) // PasswordResetRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.AuthAPI.RequestPasswordReset(context.Background()).PasswordResetRequest(passwordResetRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `AuthAPI.RequestPasswordReset``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `RequestPasswordReset`: MessageResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `AuthAPI.RequestPasswordReset`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


## Update password with reset token

`POST /api/v1/auth/password/update`

**Request body**

```json
{
  "reset_password_token": "string",
  "password": "string",
  "password_confirmation": "string"
}
```

<h3 id="update-password-with-reset-token-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[PasswordUpdateRequest](#schemapasswordupdaterequest)|true|none|

**200 Response**

```json
{
  "data": {
    "message": "string"
  }
}
```

<h3 id="update-password-with-reset-token-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Password updated|[MessageResponse](#schemamessageresponse)|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|Invalid or expired reset token|[ErrorResponse](#schemaerrorresponse)|

<p class="auth-note">No authentication required</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>MessageResponse updatePassword(passwordUpdateRequest)</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  AuthApi,
} from '@weft-labs/sdk';
import type { UpdatePasswordRequest } from '@weft-labs/sdk';

const api = new AuthApi();

const body = {
  // PasswordUpdateRequest
  passwordUpdateRequest: ...,
} satisfies UpdatePasswordRequest;

const data = await api.updatePassword(body);
console.log(data);</code></pre>
<p><strong>Parameters:</strong></p>
<table class="sdk-params"><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>passwordUpdateRequest</td><td><code>PasswordUpdateRequest</code></td><td></td><td></td></tr></tbody></table>
<p><strong>Returns:</strong> <code>MessageResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>MessageResponse update_password(password_update_request)</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.message_response import MessageResponse
from weft_sdk.generated.models.password_update_request import PasswordUpdateRequest
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)


# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.AuthApi(api_client)
    password_update_request = weft_sdk.generated.PasswordUpdateRequest() # PasswordUpdateRequest | 

    try:
        # Update password with reset token
        api_response = api_instance.update_password(password_update_request)
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling AuthApi-&gt;update_password: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> update_password(password_update_request)</code></p>
<pre><code class="language-ruby">require 'weft-sdk'

api_instance = Weft::AuthApi.new
password_update_request = Weft::PasswordUpdateRequest.new({reset_password_token: 'reset_password_token_example', password: 'password_example', password_confirmation: 'password_confirmation_example'}) # PasswordUpdateRequest | 

begin
  # Update password with reset token
  result = api_instance.update_password(password_update_request)
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling AuthApi-&gt;update_password: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>MessageResponse UpdatePassword(ctx).PasswordUpdateRequest(passwordUpdateRequest).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {
	passwordUpdateRequest := *openapiclient.NewPasswordUpdateRequest(&quot;ResetPasswordToken_example&quot;, &quot;Password_example&quot;, &quot;PasswordConfirmation_example&quot;) // PasswordUpdateRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.AuthAPI.UpdatePassword(context.Background()).PasswordUpdateRequest(passwordUpdateRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `AuthAPI.UpdatePassword``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `UpdatePassword`: MessageResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `AuthAPI.UpdatePassword`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


<h1 id="weft-api-account">Account</h1>

Current user account information.

## Get current account

`GET /api/v1/me`

**200 Response**

```json
{
  "data": {
    "id": 0,
    "name": "string",
    "slug": "string",
    "kind": "string",
    "api_key": {
      "id": 0,
      "name": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "last_used_at": "2019-08-24T14:15:22Z",
      "created_by": {
        "id": 0,
        "email": "user@example.com",
        "display_name": "string"
      }
    }
  }
}
```

<h3 id="get-current-account-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Current user account|[MeResponse](#schemameresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized|[ErrorResponse](#schemaerrorresponse)|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|The credential authenticated but has no organization context
(`ORGANIZATION_REQUIRED`). Account-scoped (buyer) keys cannot read
this org-scoped endpoint.|[ErrorResponse](#schemaerrorresponse)|

<p class="auth-note auth-required">Requires authentication: Bearer token</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>MeResponse getMe()</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  AccountApi,
} from '@weft-labs/sdk';
import type { GetMeRequest } from '@weft-labs/sdk';

const config = new Configuration({ 
  // Configure HTTP bearer authorization: bearerAuth
  accessToken: &quot;YOUR BEARER TOKEN&quot;,
});
const api = new AccountApi(config);

const data = await api.getMe();
console.log(data);</code></pre>
<p><strong>Parameters:</strong> This endpoint does not need any parameter.</p>
<p><strong>Returns:</strong> <code>MeResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>MeResponse get_me()</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.me_response import MeResponse
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)

# Configure Bearer authorization (APIKey): bearerAuth
configuration = weft_sdk.generated.Configuration(
    access_token = os.environ[&quot;BEARER_TOKEN&quot;]
)

# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.AccountApi(api_client)

    try:
        # Get current account
        api_response = api_instance.get_me()
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling AccountApi-&gt;get_me: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> get_me</code></p>
<pre><code class="language-ruby">require 'weft-sdk'
# setup authorization
Weft.configure do |config|
  # Configure Bearer authorization (APIKey): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Weft::AccountApi.new

begin
  # Get current account
  result = api_instance.get_me
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling AccountApi-&gt;get_me: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>MeResponse GetMe(ctx).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.AccountAPI.GetMe(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `AccountAPI.GetMe``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `GetMe`: MeResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `AccountAPI.GetMe`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


<h1 id="weft-api-api-keys">API Keys</h1>

Manage API keys used by the CLI and any direct HTTP caller.

## List API keys

`GET /api/v1/api_keys`

**200 Response**

```json
{
  "data": [
    {
      "id": 0,
      "name": "string",
      "key_prefix": "string",
      "last_used_at": "2019-08-24T14:15:22Z",
      "revoked_at": "2019-08-24T14:15:22Z",
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "pagination": {
    "page": 0,
    "per_page": 0,
    "total": 0,
    "total_pages": 0
  }
}
```

<h3 id="list-api-keys-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|List of API keys|[ApiKeyListResponse](#schemaapikeylistresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized|[ErrorResponse](#schemaerrorresponse)|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|The credential authenticated but has no organization context
(`ORGANIZATION_REQUIRED`). Account-scoped (buyer) keys cannot read
this org-scoped endpoint.|[ErrorResponse](#schemaerrorresponse)|

<p class="auth-note auth-required">Requires authentication: Bearer token</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>ApiKeyListResponse listApiKeys()</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  APIKeysApi,
} from '@weft-labs/sdk';
import type { ListApiKeysRequest } from '@weft-labs/sdk';

const config = new Configuration({ 
  // Configure HTTP bearer authorization: bearerAuth
  accessToken: &quot;YOUR BEARER TOKEN&quot;,
});
const api = new APIKeysApi(config);

const data = await api.listApiKeys();
console.log(data);</code></pre>
<p><strong>Parameters:</strong> This endpoint does not need any parameter.</p>
<p><strong>Returns:</strong> <code>ApiKeyListResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>ApiKeyListResponse list_api_keys()</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.api_key_list_response import ApiKeyListResponse
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)

# Configure Bearer authorization (APIKey): bearerAuth
configuration = weft_sdk.generated.Configuration(
    access_token = os.environ[&quot;BEARER_TOKEN&quot;]
)

# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.APIKeysApi(api_client)

    try:
        # List API keys
        api_response = api_instance.list_api_keys()
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling APIKeysApi-&gt;list_api_keys: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> list_api_keys</code></p>
<pre><code class="language-ruby">require 'weft-sdk'
# setup authorization
Weft.configure do |config|
  # Configure Bearer authorization (APIKey): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Weft::APIKeysApi.new

begin
  # List API keys
  result = api_instance.list_api_keys
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling APIKeysApi-&gt;list_api_keys: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>ApiKeyListResponse ListApiKeys(ctx).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.APIKeysAPI.ListApiKeys(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `APIKeysAPI.ListApiKeys``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `ListApiKeys`: ApiKeyListResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `APIKeysAPI.ListApiKeys`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


## Create an API key

`POST /api/v1/api_keys`

**Request body**

```json
{
  "name": "string"
}
```

<h3 id="create-an-api-key-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[CreateApiKeyRequest](#schemacreateapikeyrequest)|true|none|

**201 Response**

```json
{
  "data": {
    "id": 0,
    "name": "string",
    "key_prefix": "string",
    "raw_key": "string",
    "created_at": "2019-08-24T14:15:22Z"
  }
}
```

<h3 id="create-an-api-key-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|API key created (includes raw key, shown only once)|[ApiKeyCreatedResponse](#schemaapikeycreatedresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized|[ErrorResponse](#schemaerrorresponse)|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|Validation error|[ErrorResponse](#schemaerrorresponse)|

<p class="auth-note auth-required">Requires authentication: Bearer token</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>ApiKeyCreatedResponse createApiKey(createApiKeyRequest)</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  APIKeysApi,
} from '@weft-labs/sdk';
import type { CreateApiKeyOperationRequest } from '@weft-labs/sdk';

const config = new Configuration({ 
  // Configure HTTP bearer authorization: bearerAuth
  accessToken: &quot;YOUR BEARER TOKEN&quot;,
});
const api = new APIKeysApi(config);

const body = {
  // CreateApiKeyRequest
  createApiKeyRequest: ...,
} satisfies CreateApiKeyOperationRequest;

const data = await api.createApiKey(body);
console.log(data);</code></pre>
<p><strong>Parameters:</strong></p>
<table class="sdk-params"><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>createApiKeyRequest</td><td><code>CreateApiKeyRequest</code></td><td></td><td></td></tr></tbody></table>
<p><strong>Returns:</strong> <code>ApiKeyCreatedResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>ApiKeyCreatedResponse create_api_key(create_api_key_request)</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.api_key_created_response import ApiKeyCreatedResponse
from weft_sdk.generated.models.create_api_key_request import CreateApiKeyRequest
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)

# Configure Bearer authorization (APIKey): bearerAuth
configuration = weft_sdk.generated.Configuration(
    access_token = os.environ[&quot;BEARER_TOKEN&quot;]
)

# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.APIKeysApi(api_client)
    create_api_key_request = weft_sdk.generated.CreateApiKeyRequest() # CreateApiKeyRequest | 

    try:
        # Create an API key
        api_response = api_instance.create_api_key(create_api_key_request)
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling APIKeysApi-&gt;create_api_key: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> create_api_key(create_api_key_request)</code></p>
<pre><code class="language-ruby">require 'weft-sdk'
# setup authorization
Weft.configure do |config|
  # Configure Bearer authorization (APIKey): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Weft::APIKeysApi.new
create_api_key_request = Weft::CreateApiKeyRequest.new # CreateApiKeyRequest | 

begin
  # Create an API key
  result = api_instance.create_api_key(create_api_key_request)
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling APIKeysApi-&gt;create_api_key: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>ApiKeyCreatedResponse CreateApiKey(ctx).CreateApiKeyRequest(createApiKeyRequest).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {
	createApiKeyRequest := *openapiclient.NewCreateApiKeyRequest() // CreateApiKeyRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.APIKeysAPI.CreateApiKey(context.Background()).CreateApiKeyRequest(createApiKeyRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `APIKeysAPI.CreateApiKey``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `CreateApiKey`: ApiKeyCreatedResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `APIKeysAPI.CreateApiKey`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


## Revoke an API key

`DELETE /api/v1/api_keys/{id}`

<h3 id="revoke-an-api-key-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|id|path|integer|true|API key ID|

**200 Response**

```json
{
  "data": {
    "message": "string"
  }
}
```

<h3 id="revoke-an-api-key-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|API key revoked|[MessageResponse](#schemamessageresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized|[ErrorResponse](#schemaerrorresponse)|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|API key not found|[ErrorResponse](#schemaerrorresponse)|

<p class="auth-note auth-required">Requires authentication: Bearer token</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>MessageResponse revokeApiKey(id)</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  APIKeysApi,
} from '@weft-labs/sdk';
import type { RevokeApiKeyRequest } from '@weft-labs/sdk';

const config = new Configuration({ 
  // Configure HTTP bearer authorization: bearerAuth
  accessToken: &quot;YOUR BEARER TOKEN&quot;,
});
const api = new APIKeysApi(config);

const body = {
  // number | API key ID
  id: 56,
} satisfies RevokeApiKeyRequest;

const data = await api.revokeApiKey(body);
console.log(data);</code></pre>
<p><strong>Parameters:</strong></p>
<table class="sdk-params"><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>id</td><td><code>number</code></td><td>API key ID</td><td>[Defaults to <code>undefined</code>]</td></tr></tbody></table>
<p><strong>Returns:</strong> <code>MessageResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>MessageResponse revoke_api_key(id)</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.message_response import MessageResponse
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)

# Configure Bearer authorization (APIKey): bearerAuth
configuration = weft_sdk.generated.Configuration(
    access_token = os.environ[&quot;BEARER_TOKEN&quot;]
)

# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.APIKeysApi(api_client)
    id = 56 # int | API key ID

    try:
        # Revoke an API key
        api_response = api_instance.revoke_api_key(id)
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling APIKeysApi-&gt;revoke_api_key: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> revoke_api_key(id)</code></p>
<pre><code class="language-ruby">require 'weft-sdk'
# setup authorization
Weft.configure do |config|
  # Configure Bearer authorization (APIKey): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Weft::APIKeysApi.new
id = 56 # Integer | API key ID

begin
  # Revoke an API key
  result = api_instance.revoke_api_key(id)
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling APIKeysApi-&gt;revoke_api_key: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>MessageResponse RevokeApiKey(ctx, id).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {
	id := int32(56) // int32 | API key ID

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.APIKeysAPI.RevokeApiKey(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `APIKeysAPI.RevokeApiKey``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `RevokeApiKey`: MessageResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `APIKeysAPI.RevokeApiKey`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


<h1 id="weft-api-balance">Balance</h1>

Read-only snapshot of the buyer's wallet, spending policy, and
current-window spend (today / this week).

## Get wallet, spending policy, and current-window spend

`GET /api/v1/balance`

Read-only snapshot for the buyer behind the bearer token. The
response always includes a `promo` block — values are zero in v1
and fill in once the freemium promo ledger ships, without a
shape change. `wallet.balance_usdc` is fetched live from Privy;
if Privy is unreachable the field returns `"0.00"` rather than
erroring the whole call.

Account-scoped: the bearer must be a buyer-scoped API key.

**200 Response**

```json
{
  "promo": {
    "balance_usd": "0.00",
    "scope": "weft-search",
    "expires_at": "2019-08-24T14:15:22Z"
  },
  "wallet": {
    "address": "string",
    "balance_usdc": "12.34",
    "tempo_usd": "3.00",
    "total_usd": "15.34",
    "network": "string"
  },
  "spent_today_usd": "0.42",
  "spent_week_usd": "3.10",
  "policy": {
    "max_tx_usd": "1.00",
    "daily_limit_usd": "10.00",
    "weekly_limit_usd": "50.00"
  }
}
```

<h3 id="get-wallet,-spending-policy,-and-current-window-spend-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Wallet + policy + spend snapshot|[BalanceResponse](#schemabalanceresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized — missing or non-buyer-scoped API key|[ErrorResponse](#schemaerrorresponse)|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|The OAuth access token authenticated but lacks the `balance`
scope (RFC 6750 `insufficient_scope`). Carries a
`WWW-Authenticate: Bearer error="insufficient_scope", scope="balance"`
header. `wk_` API keys are unscoped and never see this.|[InsufficientScopeResponse](#schemainsufficientscoperesponse)|

<p class="auth-note auth-required">Requires authentication: Bearer token</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>BalanceResponse getBalance()</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  BalanceApi,
} from '@weft-labs/sdk';
import type { GetBalanceRequest } from '@weft-labs/sdk';

const config = new Configuration({ 
  // Configure HTTP bearer authorization: bearerAuth
  accessToken: &quot;YOUR BEARER TOKEN&quot;,
});
const api = new BalanceApi(config);

const data = await api.getBalance();
console.log(data);</code></pre>
<p><strong>Parameters:</strong> This endpoint does not need any parameter.</p>
<p><strong>Returns:</strong> <code>BalanceResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>BalanceResponse get_balance()</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.balance_response import BalanceResponse
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)

# Configure Bearer authorization (APIKey): bearerAuth
configuration = weft_sdk.generated.Configuration(
    access_token = os.environ[&quot;BEARER_TOKEN&quot;]
)

# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.BalanceApi(api_client)

    try:
        # Get wallet, spending policy, and current-window spend
        api_response = api_instance.get_balance()
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling BalanceApi-&gt;get_balance: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> get_balance</code></p>
<pre><code class="language-ruby">require 'weft-sdk'
# setup authorization
Weft.configure do |config|
  # Configure Bearer authorization (APIKey): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Weft::BalanceApi.new

begin
  # Get wallet, spending policy, and current-window spend
  result = api_instance.get_balance
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling BalanceApi-&gt;get_balance: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>BalanceResponse GetBalance(ctx).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.BalanceAPI.GetBalance(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `BalanceAPI.GetBalance``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `GetBalance`: BalanceResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `BalanceAPI.GetBalance`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


<h1 id="weft-api-search">Search</h1>

Semantic search across the Weft index of paid agent resources.
Returns A2A-shaped AgentCards with pricing, skills, ranking, and
endpoints. The mock backend (default while the search-platform is
unshipped) reads YAML fixtures from `db/seeds/mock-search/`; the
platform backend proxies to the upstream search service. Both share
the same response envelope.

## Search the Weft index

`POST /api/v1/search`

Semantic search over the Weft index of paid agent resources. The
request body carries a free-text `query`, an optional `limit`, and
an optional `filters` object that narrows by price band, payment
protocol, agent protocol, or domain tag. Filters are applied as a
post-filter after the embedding score is computed.

Backend selection is server-side via the `SEARCH_BACKEND` env var:
`mock` (default, reads YAML fixtures and sets `_mock: true` in the
response) or `platform` (proxies to the upstream search service).
Both backends return the same envelope.

Account-scoped: the bearer token must be a buyer-scoped API key.
Free for authenticated buyers in v1; billing is planned for a later
release.

Response negotiation: `Accept: application/json` (default) returns
the structured envelope; `Accept: text/markdown` returns a rendered
Markdown digest of the same results — useful for piping into a chat
UI or LLM prompt.

**Request body**

```json
{
  "query": "send email from an agent",
  "limit": 10,
  "filters": {
    "min_price_usd": "0.01",
    "max_price_usd": "0.10",
    "payment_protocol": "x402",
    "agent_protocol": "a2a",
    "domain": "string"
  }
}
```

<h3 id="search-the-weft-index-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[SearchRequest](#schemasearchrequest)|true|none|

**200 Response**

```json
{
  "results": [
    {
      "id": "string",
      "score": 1,
      "protocol": "a2a",
      "domain": [
        "string"
      ],
      "reseller": "string",
      "upstream": "string",
      "agent_card": {
        "name": "string",
        "description": "string",
        "url": "http://example.com",
        "version": "string",
        "protocolVersion": "string",
        "capabilities": {},
        "defaultInputModes": [
          "string"
        ],
        "defaultOutputModes": [
          "string"
        ],
        "skills": [
          {
            "id": "string",
            "name": "string",
            "description": "string",
            "tags": [
              "string"
            ],
            "examples": [
              "string"
            ],
            "inputModes": [
              "string"
            ],
            "outputModes": [
              "string"
            ],
            "streaming": true,
            "endpoint": {
              "method": "string",
              "path": "string"
            },
            "price_usd": "string"
          }
        ]
      },
      "pricing": {
        "protocol": "x402",
        "scheme": "per_call",
        "amount_usd": "string",
        "network": "string"
      },
      "ranking": {
        "popularity_score": 1,
        "settlement_count_30d": 0,
        "success_rate_30d": 1,
        "p50_latency_ms": 0,
        "first_seen_at": "2019-08-24T14:15:22Z"
      },
      "endpoints": {
        "a2a": "http://example.com",
        "mcp": "http://example.com",
        "openapi": "http://example.com",
        "weft_fetch_target": "http://example.com"
      }
    }
  ],
  "paid_usd": "string",
  "tx_hash": "string",
  "artifact_id": "string",
  "_mock": true
}
```

<h3 id="search-the-weft-index-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Search results|string|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized — missing or non-buyer-scoped API key|[ErrorResponse](#schemaerrorresponse)|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|The OAuth access token authenticated but lacks the `search`
scope (RFC 6750 `insufficient_scope`). Carries a
`WWW-Authenticate: Bearer error="insufficient_scope", scope="search"`
header. `wk_` API keys are unscoped and never see this.|[InsufficientScopeResponse](#schemainsufficientscoperesponse)|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|Invalid query (empty/missing)|[SearchErrorResponse](#schemasearcherrorresponse)|
|500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|Backend misconfigured (`SEARCH_BACKEND` unset or unknown)|[SearchErrorResponse](#schemasearcherrorresponse)|
|502|[Bad Gateway](https://tools.ietf.org/html/rfc7231#section-6.6.3)|Upstream search backend error (platform backend only)|[SearchErrorResponse](#schemasearcherrorresponse)|

<p class="auth-note auth-required">Requires authentication: Bearer token</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>SearchResponse search(searchRequest)</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  SearchApi,
} from '@weft-labs/sdk';
import type { SearchOperationRequest } from '@weft-labs/sdk';

const config = new Configuration({ 
  // Configure HTTP bearer authorization: bearerAuth
  accessToken: &quot;YOUR BEARER TOKEN&quot;,
});
const api = new SearchApi(config);

const body = {
  // SearchRequest
  searchRequest: ...,
} satisfies SearchOperationRequest;

const data = await api.search(body);
console.log(data);</code></pre>
<p><strong>Parameters:</strong></p>
<table class="sdk-params"><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>searchRequest</td><td><code>SearchRequest</code></td><td></td><td></td></tr></tbody></table>
<p><strong>Returns:</strong> <code>SearchResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>SearchResponse search(search_request)</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.search_request import SearchRequest
from weft_sdk.generated.models.search_response import SearchResponse
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)

# Configure Bearer authorization (APIKey): bearerAuth
configuration = weft_sdk.generated.Configuration(
    access_token = os.environ[&quot;BEARER_TOKEN&quot;]
)

# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.SearchApi(api_client)
    search_request = weft_sdk.generated.SearchRequest() # SearchRequest | 

    try:
        # Search the Weft index
        api_response = api_instance.search(search_request)
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling SearchApi-&gt;search: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> search(search_request)</code></p>
<pre><code class="language-ruby">require 'weft-sdk'
# setup authorization
Weft.configure do |config|
  # Configure Bearer authorization (APIKey): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Weft::SearchApi.new
search_request = Weft::SearchRequest.new({query: 'send email from an agent'}) # SearchRequest | 

begin
  # Search the Weft index
  result = api_instance.search(search_request)
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling SearchApi-&gt;search: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>SearchResponse Search(ctx).SearchRequest(searchRequest).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {
	searchRequest := *openapiclient.NewSearchRequest(&quot;send email from an agent&quot;) // SearchRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.SearchAPI.Search(context.Background()).SearchRequest(searchRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `SearchAPI.Search``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `Search`: SearchResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `SearchAPI.Search`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


<h1 id="weft-api-fetch">Fetch</h1>

The universal x402 fetch proxy. POST any URL the agent wants to
reach, with a `max_cost_usd` ceiling; Weft handles the `402 Payment
Required` challenge, signs the EIP-3009 payment from the buyer's
wallet, replays the request, and streams the upstream artifact
back base64-encoded. Errors always carry the buyer's current
policy + balance + dashboard URL so the caller can surface "what
changed?" without a second round-trip.

## Pay-and-fetch any URL (x402 proxy)

`POST /api/v1/fetch`

Universal x402 fetch proxy. The caller provides a target `url`,
a hard `max_cost_usd` ceiling, and optional `method` / `body` /
`headers`. Weft:

  1. Issues the request.
  2. On `402 Payment Required`, parses the merchant's challenge.
  3. Compares the asking price to `max_cost_usd` and the
     buyer's policy (`max_tx_usd`, daily/weekly limits).
  4. Signs an EIP-3009 transfer from the buyer's wallet.
  5. Replays the request with the `X-Payment` header.
  6. Streams the upstream artifact back, base64-encoded under
     `body_base64`, with `paid_usd`, `tx_hash`, and the
     merchant's reputation snapshot.

Errors are structured with a stable `error` code, and each error
response carries the buyer's `policy`, `balance`, and a
`dashboard_url` so a CLI can render an actionable message without
a second round-trip.

Account-scoped: the bearer must be a buyer-scoped API key.

**Forwarded headers:** the caller's `headers` are passed through
to the upstream, except a denylist of hop-by-hop and
Weft-internal headers (`host`, `authorization`, `cookie`,
`proxy-authorization`, `x-forwarded-*`, `x-real-ip`,
`x-payment`, `connection`, `upgrade`). Up to 32 headers, 4 KB of
combined value bytes.

**Request body**

```json
{
  "url": "https://x402.api.agentmail.to/v0/inboxes",
  "max_cost_usd": "0.05",
  "method": "GET",
  "body": "string",
  "headers": {
    "Accept": "application/json",
    "User-Agent": "my-agent/1.0"
  }
}
```

<h3 id="pay-and-fetch-any-url-(x402-proxy)-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[FetchRequest](#schemafetchrequest)|true|none|

**200 Response**

```json
{
  "status": 200,
  "headers": {
    "property1": "string",
    "property2": "string"
  },
  "body_base64": "string",
  "paid_usd": "0.002",
  "tx_hash": "string",
  "artifact_id": 0,
  "merchant": {
    "address": "string",
    "settlement_count": 0,
    "first_seen_at": "2019-08-24T14:15:22Z",
    "dispute_count": 0
  }
}
```

<h3 id="pay-and-fetch-any-url-(x402-proxy)-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Fetch succeeded (or upstream was free); artifact streamed back base64-encoded.|[FetchResponse](#schemafetchresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized — missing or non-buyer-scoped API key|[ErrorResponse](#schemaerrorresponse)|
|402|[Payment Required](https://tools.ietf.org/html/rfc7231#section-6.5.2)|Payment refused. `EXCEEDED_MAX_COST` (over the caller cap) or
`INSUFFICIENT_BALANCE` (the buyer is genuinely short). Also
`CONVERSION_UNAVAILABLE` — a cross-chain provision route is down
while the buyer's funds are intact (`details.venue`,
`details.retryable: true`); retry later, do NOT top up. All use
`FetchErrorResponse`.|[FetchErrorResponse](#schemafetcherrorresponse)|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|Policy violation, denylisted recipient, or a merchant challenge on a
chain outside the wallet's own environment — a testnet wallet may
not pay a mainnet challenge, nor the reverse
(`WALLET_ENVIRONMENT_MISMATCH`; terminal, not retryable). All three
use `FetchErrorResponse`. Alternatively an OAuth access token
lacking the `fetch` scope (`InsufficientScopeResponse`, RFC 6750
`insufficient_scope`, with a `WWW-Authenticate` challenge). The two
envelopes are disjoint; branch on the `error` value.|Inline|
|413|[Payload Too Large](https://tools.ietf.org/html/rfc7231#section-6.5.11)|Upstream artifact exceeded the proxy's size cap.|[FetchErrorResponse](#schemafetcherrorresponse)|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|Invalid request URL, or the merchant advertised a payment method Weft cannot sign.|[FetchErrorResponse](#schemafetcherrorresponse)|
|424|[Failed Dependency](https://tools.ietf.org/html/rfc2518#section-10.5)|`MERCHANT_RETURNED_NON_402` — the upstream merchant is at fault: it
did not return a 402, or its 402 challenge was invalid. A 4xx (not
5xx) because Weft behaved correctly and the caller should act on
`details.reason` (e.g. pick another merchant); it also keeps the
error envelope intact through CDNs that replace 5xx bodies.|[FetchErrorResponse](#schemafetcherrorresponse)|
|502|[Bad Gateway](https://tools.ietf.org/html/rfc7231#section-6.6.3)|Settlement signing failed on Weft's side (`SETTLEMENT_FAILED`).|[FetchErrorResponse](#schemafetcherrorresponse)|

<h3 id="pay-and-fetch-any-url-(x402-proxy)-responseschema">Response Schema</h3>

#### Enumerated Values

|Property|Value|
|---|---|
|error|INVALID_URL|
|error|EXCEEDED_MAX_COST|
|error|INSUFFICIENT_BALANCE|
|error|CONVERSION_UNAVAILABLE|
|error|MERCHANT_RETURNED_NON_402|
|error|ARTIFACT_TOO_LARGE|
|error|DENYLISTED_RECIPIENT|
|error|WALLET_ENVIRONMENT_MISMATCH|
|error|SETTLEMENT_FAILED|
|error|UNSUPPORTED_PAYMENT_METHOD|
|error|POLICY_VIOLATION_MAX_TX|
|error|POLICY_VIOLATION_DAILY|
|error|POLICY_VIOLATION_WEEKLY|
|error|insufficient_scope|

<p class="auth-note auth-required">Requires authentication: Bearer token</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>FetchResponse fetch(fetchRequest)</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  FetchApi,
} from '@weft-labs/sdk';
import type { FetchOperationRequest } from '@weft-labs/sdk';

const config = new Configuration({ 
  // Configure HTTP bearer authorization: bearerAuth
  accessToken: &quot;YOUR BEARER TOKEN&quot;,
});
const api = new FetchApi(config);

const body = {
  // FetchRequest
  fetchRequest: ...,
} satisfies FetchOperationRequest;

const data = await api.fetch(body);
console.log(data);</code></pre>
<p><strong>Parameters:</strong></p>
<table class="sdk-params"><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>fetchRequest</td><td><code>FetchRequest</code></td><td></td><td></td></tr></tbody></table>
<p><strong>Returns:</strong> <code>FetchResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>FetchResponse fetch(fetch_request)</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.fetch_request import FetchRequest
from weft_sdk.generated.models.fetch_response import FetchResponse
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)

# Configure Bearer authorization (APIKey): bearerAuth
configuration = weft_sdk.generated.Configuration(
    access_token = os.environ[&quot;BEARER_TOKEN&quot;]
)

# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.FetchApi(api_client)
    fetch_request = weft_sdk.generated.FetchRequest() # FetchRequest | 

    try:
        # Pay-and-fetch any URL (x402 proxy)
        api_response = api_instance.fetch(fetch_request)
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling FetchApi-&gt;fetch: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> fetch(fetch_request)</code></p>
<pre><code class="language-ruby">require 'weft-sdk'
# setup authorization
Weft.configure do |config|
  # Configure Bearer authorization (APIKey): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Weft::FetchApi.new
fetch_request = Weft::FetchRequest.new({url: 'https://x402.api.agentmail.to/v0/inboxes'}) # FetchRequest | 

begin
  # Pay-and-fetch any URL (x402 proxy)
  result = api_instance.fetch(fetch_request)
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling FetchApi-&gt;fetch: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>FetchResponse Fetch(ctx).FetchRequest(fetchRequest).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {
	fetchRequest := *openapiclient.NewFetchRequest(&quot;https://x402.api.agentmail.to/v0/inboxes&quot;) // FetchRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.FetchAPI.Fetch(context.Background()).FetchRequest(fetchRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `FetchAPI.Fetch``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `Fetch`: FetchResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `FetchAPI.Fetch`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


<h1 id="weft-api-payments">Payments</h1>

Payment history and individual purchase details.

## List payments

`GET /api/v1/payments`

<h3 id="list-payments-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|page|query|integer|false|Page number|
|per_page|query|integer|false|Items per page|

**200 Response**

```json
{
  "data": [
    {
      "id": 0,
      "tx_hash": "string",
      "payer_address": "string",
      "recipient_address": "string",
      "amount": 0,
      "amount_formatted": "string",
      "currency": "string",
      "network": "string",
      "resource_url": "string",
      "resource_host": "string",
      "fee_amount": 0,
      "settlement_latency_ms": 0,
      "settled_at": "2019-08-24T14:15:22Z",
      "api_key_name": "string"
    }
  ],
  "pagination": {
    "page": 0,
    "per_page": 0,
    "total": 0,
    "total_pages": 0
  }
}
```

<h3 id="list-payments-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|List of payments|[PaymentListResponse](#schemapaymentlistresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized|[ErrorResponse](#schemaerrorresponse)|
|403|[Forbidden](https://tools.ietf.org/html/rfc7231#section-6.5.3)|The credential authenticated but has no organization context
(`ORGANIZATION_REQUIRED`). Account-scoped (buyer) keys cannot read
this org-scoped endpoint.|[ErrorResponse](#schemaerrorresponse)|

<p class="auth-note auth-required">Requires authentication: Bearer token</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>PaymentListResponse listPayments(page, perPage)</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  PaymentsApi,
} from '@weft-labs/sdk';
import type { ListPaymentsRequest } from '@weft-labs/sdk';

const config = new Configuration({ 
  // Configure HTTP bearer authorization: bearerAuth
  accessToken: &quot;YOUR BEARER TOKEN&quot;,
});
const api = new PaymentsApi(config);

const body = {
  // number | Page number (optional)
  page: 56,
  // number | Items per page (optional)
  perPage: 56,
} satisfies ListPaymentsRequest;

const data = await api.listPayments(body);
console.log(data);</code></pre>
<p><strong>Parameters:</strong></p>
<table class="sdk-params"><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>page</td><td><code>number</code></td><td>Page number</td><td>[Optional] [Defaults to <code>1</code>]</td></tr><tr><td>perPage</td><td><code>number</code></td><td>Items per page</td><td>[Optional] [Defaults to <code>25</code>]</td></tr></tbody></table>
<p><strong>Returns:</strong> <code>PaymentListResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>PaymentListResponse list_payments(page=page, per_page=per_page)</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.payment_list_response import PaymentListResponse
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)

# Configure Bearer authorization (APIKey): bearerAuth
configuration = weft_sdk.generated.Configuration(
    access_token = os.environ[&quot;BEARER_TOKEN&quot;]
)

# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.PaymentsApi(api_client)
    page = 1 # int | Page number (optional) (default to 1)
    per_page = 25 # int | Items per page (optional) (default to 25)

    try:
        # List payments
        api_response = api_instance.list_payments(page=page, per_page=per_page)
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling PaymentsApi-&gt;list_payments: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> list_payments(opts)</code></p>
<pre><code class="language-ruby">require 'weft-sdk'
# setup authorization
Weft.configure do |config|
  # Configure Bearer authorization (APIKey): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Weft::PaymentsApi.new
opts = {
  page: 56, # Integer | Page number
  per_page: 56 # Integer | Items per page
}

begin
  # List payments
  result = api_instance.list_payments(opts)
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling PaymentsApi-&gt;list_payments: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>PaymentListResponse ListPayments(ctx).Page(page).PerPage(perPage).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {
	page := int32(56) // int32 | Page number (optional) (default to 1)
	perPage := int32(56) // int32 | Items per page (optional) (default to 25)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.PaymentsAPI.ListPayments(context.Background()).Page(page).PerPage(perPage).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `PaymentsAPI.ListPayments``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `ListPayments`: PaymentListResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `PaymentsAPI.ListPayments`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


## Get payment details

`GET /api/v1/payments/{id}`

<h3 id="get-payment-details-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|id|path|integer|true|Payment ID|

**200 Response**

```json
{
  "data": {
    "id": 0,
    "tx_hash": "string",
    "payer_address": "string",
    "recipient_address": "string",
    "amount": 0,
    "amount_formatted": "string",
    "currency": "string",
    "network": "string",
    "resource_url": "string",
    "resource_host": "string",
    "fee_amount": 0,
    "settlement_latency_ms": 0,
    "settled_at": "2019-08-24T14:15:22Z",
    "api_key_name": "string"
  }
}
```

<h3 id="get-payment-details-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|Payment details|[PaymentResponse](#schemapaymentresponse)|
|401|[Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1)|Unauthorized|[ErrorResponse](#schemaerrorresponse)|
|404|[Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4)|Payment not found|[ErrorResponse](#schemaerrorresponse)|

<p class="auth-note auth-required">Requires authentication: Bearer token</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="ts">TypeScript</button><button class="sdk-tab" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="ts">
<p><code>PaymentResponse getPayment(id)</code></p>
<pre><code class="language-typescript">import {
  Configuration,
  PaymentsApi,
} from '@weft-labs/sdk';
import type { GetPaymentRequest } from '@weft-labs/sdk';

const config = new Configuration({ 
  // Configure HTTP bearer authorization: bearerAuth
  accessToken: &quot;YOUR BEARER TOKEN&quot;,
});
const api = new PaymentsApi(config);

const body = {
  // number | Payment ID
  id: 56,
} satisfies GetPaymentRequest;

const data = await api.getPayment(body);
console.log(data);</code></pre>
<p><strong>Parameters:</strong></p>
<table class="sdk-params"><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Notes</th></tr></thead><tbody><tr><td>id</td><td><code>number</code></td><td>Payment ID</td><td>[Defaults to <code>undefined</code>]</td></tr></tbody></table>
<p><strong>Returns:</strong> <code>PaymentResponse</code></p>
</div>
<div class="sdk-panel" data-lang="python" style="display:none">
<p><code>PaymentResponse get_payment(id)</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.payment_response import PaymentResponse
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)

# Configure Bearer authorization (APIKey): bearerAuth
configuration = weft_sdk.generated.Configuration(
    access_token = os.environ[&quot;BEARER_TOKEN&quot;]
)

# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.PaymentsApi(api_client)
    id = 56 # int | Payment ID

    try:
        # Get payment details
        api_response = api_instance.get_payment(id)
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling PaymentsApi-&gt;get_payment: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> get_payment(id)</code></p>
<pre><code class="language-ruby">require 'weft-sdk'
# setup authorization
Weft.configure do |config|
  # Configure Bearer authorization (APIKey): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Weft::PaymentsApi.new
id = 56 # Integer | Payment ID

begin
  # Get payment details
  result = api_instance.get_payment(id)
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling PaymentsApi-&gt;get_payment: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>PaymentResponse GetPayment(ctx, id).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {
	id := int32(56) // int32 | Payment ID

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.PaymentsAPI.GetPayment(context.Background(), id).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `PaymentsAPI.GetPayment``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `GetPayment`: PaymentResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `PaymentsAPI.GetPayment`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


<h1 id="weft-api-resources">Resources</h1>

Public, unauthenticated ghost-resource enrollment. Lets an agent
self-register so its human controller can later claim it from the
dashboard.

## Self-enroll a ghost resource (public, no auth)

`POST /api/v1/resources/enroll`

Lets an unauthenticated agent (or its operator) self-enroll a
Resource as a "ghost" (no owning provider). The server generates the
`slug` and a single-use `claim_token`; the response also carries a
`claim_url` the agent hands to its human controller to claim the
resource from the dashboard.

Client-supplied `slug` and `category` are silently ignored: slugs are
server-generated from `name` (so callers cannot squat on reserved
names), and `category` is a post-claim concern set by a real human.

Rate-limited to 10 enrollments/hour/IP.

**Request body**

```json
{
  "kind": "agent",
  "name": "Self-Enrolled Bot",
  "description": "string",
  "wallet_address": "string"
}
```

<h3 id="self-enroll-a-ghost-resource-(public,-no-auth)-parameters">Parameters</h3>

|Name|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[ResourceEnrollmentRequest](#schemaresourceenrollmentrequest)|true|none|

**201 Response**

```json
{
  "data": {
    "id": 0,
    "name": "string",
    "slug": "string",
    "description": "string",
    "kind": "agent",
    "visibility": "public_profile",
    "wallet_address": "string",
    "category": "string",
    "verified": true,
    "claimed": true,
    "created_at": "2019-08-24T14:15:22Z",
    "stats": {
      "total_paid": 0,
      "total_received": 0,
      "payments_made": 0,
      "payments_received": 0,
      "unique_counterparties": 0,
      "first_seen": "2019-08-24T14:15:22Z",
      "last_active": "2019-08-24T14:15:22Z"
    },
    "claim_token": "string",
    "claim_url": "string"
  }
}
```

<h3 id="self-enroll-a-ghost-resource-(public,-no-auth)-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|201|[Created](https://tools.ietf.org/html/rfc7231#section-6.3.2)|Ghost resource created|[ResourceEnrollmentResponse](#schemaresourceenrollmentresponse)|
|422|[Unprocessable Entity](https://tools.ietf.org/html/rfc2518#section-10.3)|Validation error (missing/blank fields, or unknown `kind`)|[ErrorResponse](#schemaerrorresponse)|
|429|[Too Many Requests](https://tools.ietf.org/html/rfc6585#section-4)|Rate limit exceeded (10 enrollments/hour/IP)|[ErrorResponse](#schemaerrorresponse)|

<p class="auth-note">No authentication required</p>

<h3>SDK</h3>
<div class="sdk-tabs">
<div class="sdk-tab-bar"><button class="sdk-tab active" data-lang="python">Python</button><button class="sdk-tab" data-lang="ruby">Ruby</button><button class="sdk-tab" data-lang="go">Go</button></div>
<div class="sdk-panel" data-lang="python">
<p><code>ResourceEnrollmentResponse enroll_resource(resource_enrollment_request)</code></p>
<pre><code class="language-python">import weft_sdk.generated
from weft_sdk.generated.models.resource_enrollment_request import ResourceEnrollmentRequest
from weft_sdk.generated.models.resource_enrollment_response import ResourceEnrollmentResponse
from weft_sdk.generated.rest import ApiException

configuration = weft_sdk.generated.Configuration(
)


# Enter a context with an instance of the API client
with weft_sdk.generated.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = weft_sdk.generated.ResourcesApi(api_client)
    resource_enrollment_request = weft_sdk.generated.ResourceEnrollmentRequest() # ResourceEnrollmentRequest | 

    try:
        # Self-enroll a ghost resource (public, no auth)
        api_response = api_instance.enroll_resource(resource_enrollment_request)
        print(api_response)
    except Exception as e:
        print(&quot;Exception when calling ResourcesApi-&gt;enroll_resource: %s\n&quot; % e)</code></pre>
</div>
<div class="sdk-panel" data-lang="ruby" style="display:none">
<p><code> enroll_resource(resource_enrollment_request)</code></p>
<pre><code class="language-ruby">require 'weft-sdk'

api_instance = Weft::ResourcesApi.new
resource_enrollment_request = Weft::ResourceEnrollmentRequest.new({kind: 'agent', name: 'Self-Enrolled Bot'}) # ResourceEnrollmentRequest | 

begin
  # Self-enroll a ghost resource (public, no auth)
  result = api_instance.enroll_resource(resource_enrollment_request)
  p result
rescue Weft::ApiError =&gt; e
  puts &quot;Error when calling ResourcesApi-&gt;enroll_resource: #{e}&quot;
end</code></pre>
</div>
<div class="sdk-panel" data-lang="go" style="display:none">
<p><code>ResourceEnrollmentResponse EnrollResource(ctx).ResourceEnrollmentRequest(resourceEnrollmentRequest).Execute()</code></p>
<pre><code class="language-go">package main

import (
	&quot;context&quot;
	&quot;fmt&quot;
	&quot;os&quot;
	openapiclient &quot;github.com/weft-labs/weft-sdk/go/generated&quot;
)

func main() {
	resourceEnrollmentRequest := *openapiclient.NewResourceEnrollmentRequest(&quot;agent&quot;, &quot;Self-Enrolled Bot&quot;) // ResourceEnrollmentRequest | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.ResourcesAPI.EnrollResource(context.Background()).ResourceEnrollmentRequest(resourceEnrollmentRequest).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, &quot;Error when calling `ResourcesAPI.EnrollResource``: %v\n&quot;, err)
		fmt.Fprintf(os.Stderr, &quot;Full HTTP response: %v\n&quot;, r)
	}
	// response from `EnrollResource`: ResourceEnrollmentResponse
	fmt.Fprintf(os.Stdout, &quot;Response from `ResourcesAPI.EnrollResource`: %v\n&quot;, resp)
}</code></pre>
</div>
</div>


# Schemas

<h2 id="tocS_ErrorResponse">ErrorResponse</h2>
<a id="schemaerrorresponse"></a>
<a id="schema_ErrorResponse"></a>
<a id="tocSerrorresponse"></a>
<a id="tocserrorresponse"></a>

```json
{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or expired API key",
    "request_id": "req_01HX9F3K7B2N4P8Q1R6T8Y2Z5"
  }
}

```

Standard error envelope returned by all `/api/v1` endpoints except
`/search` and `/fetch` (which use bespoke envelopes carrying
additional context). `error.code` is stable across releases and
safe to branch on; `error.message` is human-readable and may change.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|error|[Error](#schemaerror)|true|none|A single error inside an `ErrorResponse` envelope. `code` is the<br>stable machine-readable identifier (snake_case), `message` is<br>human-readable, `details` carries optional structured context<br>(e.g. validation field breakdown), and `request_id` correlates<br>with server logs for debugging.|

<h2 id="tocS_Error">Error</h2>
<a id="schemaerror"></a>
<a id="schema_Error"></a>
<a id="tocSerror"></a>
<a id="tocserror"></a>

```json
{
  "code": "validation_failed",
  "message": "Email has already been taken",
  "details": {},
  "request_id": "req_01HX9F3K7B2N4P8Q1R6T8Y2Z5"
}

```

A single error inside an `ErrorResponse` envelope. `code` is the
stable machine-readable identifier (snake_case), `message` is
human-readable, `details` carries optional structured context
(e.g. validation field breakdown), and `request_id` correlates
with server logs for debugging.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|code|string|true|none|Stable machine-readable error code (snake_case).|
|message|string|true|none|Human-readable error description.|
|details|object¦null|false|none|Optional structured context about the failure.|
|request_id|string|false|none|Correlates with server logs; include when reporting bugs.|

<h2 id="tocS_InsufficientScopeResponse">InsufficientScopeResponse</h2>
<a id="schemainsufficientscoperesponse"></a>
<a id="schema_InsufficientScopeResponse"></a>
<a id="tocSinsufficientscoperesponse"></a>
<a id="tocsinsufficientscoperesponse"></a>

```json
{
  "error": "insufficient_scope",
  "error_description": "The access token does not include the required scope.",
  "scope": "balance"
}

```

RFC 6750 §3.1 `insufficient_scope` error. Returned with HTTP 403 and
a `WWW-Authenticate: Bearer error="insufficient_scope", scope="..."`
header when an OAuth access token authenticates successfully but does
not carry the scope the endpoint requires. Only OAuth bearer tokens
are scope-gated; `wk_`-prefixed API keys are unscoped and never see
this response.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|error|string|true|none|none|
|error_description|string|true|none|none|
|scope|string|true|none|Space-delimited list of scopes the endpoint requires.|

#### Enumerated Values

|Property|Value|
|---|---|
|error|insufficient_scope|

<h2 id="tocS_MessageResponse">MessageResponse</h2>
<a id="schemamessageresponse"></a>
<a id="schema_MessageResponse"></a>
<a id="tocSmessageresponse"></a>
<a id="tocsmessageresponse"></a>

```json
{
  "data": {
    "message": "string"
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|data|object|true|none|none|
|» message|string|true|none|none|

<h2 id="tocS_ResourceEnrollmentRequest">ResourceEnrollmentRequest</h2>
<a id="schemaresourceenrollmentrequest"></a>
<a id="schema_ResourceEnrollmentRequest"></a>
<a id="tocSresourceenrollmentrequest"></a>
<a id="tocsresourceenrollmentrequest"></a>

```json
{
  "kind": "agent",
  "name": "Self-Enrolled Bot",
  "description": "string",
  "wallet_address": "string"
}

```

`slug` and `category` are accepted but silently ignored — the server
generates the slug from `name`, and category is a post-claim concern.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|kind|string|true|none|Resource kind. Must be one of the supported kinds (currently<br>`agent`); an unknown value is rejected with a 422.|
|name|string|true|none|Human-readable name; the server derives the slug from it.|
|description|string|false|none|none|
|wallet_address|string|false|none|Declared EVM wallet address for the ghost resource. Stored as a<br>claim (unverified) until the resource is claimed.|

<h2 id="tocS_ResourceEnrollmentResponse">ResourceEnrollmentResponse</h2>
<a id="schemaresourceenrollmentresponse"></a>
<a id="schema_ResourceEnrollmentResponse"></a>
<a id="tocSresourceenrollmentresponse"></a>
<a id="tocsresourceenrollmentresponse"></a>

```json
{
  "data": {
    "id": 0,
    "name": "string",
    "slug": "string",
    "description": "string",
    "kind": "agent",
    "visibility": "public_profile",
    "wallet_address": "string",
    "category": "string",
    "verified": true,
    "claimed": true,
    "created_at": "2019-08-24T14:15:22Z",
    "stats": {
      "total_paid": 0,
      "total_received": 0,
      "payments_made": 0,
      "payments_received": 0,
      "unique_counterparties": 0,
      "first_seen": "2019-08-24T14:15:22Z",
      "last_active": "2019-08-24T14:15:22Z"
    },
    "claim_token": "string",
    "claim_url": "string"
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|data|[EnrolledResource](#schemaenrolledresource)|true|none|The `:created` view of a ghost resource. Adds `stats`, the single-use<br>`claim_token`, and the `claim_url` to the base resource shape. The<br>claim fields appear ONLY on this enrollment response — never in list<br>or read views.|

<h2 id="tocS_EnrolledResource">EnrolledResource</h2>
<a id="schemaenrolledresource"></a>
<a id="schema_EnrolledResource"></a>
<a id="tocSenrolledresource"></a>
<a id="tocsenrolledresource"></a>

```json
{
  "id": 0,
  "name": "string",
  "slug": "string",
  "description": "string",
  "kind": "agent",
  "visibility": "public_profile",
  "wallet_address": "string",
  "category": "string",
  "verified": true,
  "claimed": true,
  "created_at": "2019-08-24T14:15:22Z",
  "stats": {
    "total_paid": 0,
    "total_received": 0,
    "payments_made": 0,
    "payments_received": 0,
    "unique_counterparties": 0,
    "first_seen": "2019-08-24T14:15:22Z",
    "last_active": "2019-08-24T14:15:22Z"
  },
  "claim_token": "string",
  "claim_url": "string"
}

```

The `:created` view of a ghost resource. Adds `stats`, the single-use
`claim_token`, and the `claim_url` to the base resource shape. The
claim fields appear ONLY on this enrollment response — never in list
or read views.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|integer|true|none|none|
|name|string|true|none|none|
|slug|string|true|none|none|
|description|string¦null|false|none|none|
|kind|string|true|none|none|
|visibility|string|true|none|none|
|wallet_address|string¦null|false|none|Declared wallet address, or `null` if none was provided.|
|category|string¦null|true|none|Legacy v3 taxonomy field. Returns a string only for `agent`-kind<br>resources that carry a `category` in their metadata; `null` for<br>all other kinds and for agents without one. Always `null` on<br>enrollment (category is a post-claim concern).|
|verified|boolean|true|none|none|
|claimed|boolean|true|none|True once the resource has an owning provider. Always false at enrollment.|
|created_at|string(date-time)|true|none|none|
|stats|[ResourceStats](#schemaresourcestats)|true|none|Aggregate public payment stats for the resource.|
|claim_token|string|true|none|Single-use token for the magic claim URL. Surfaced only on enrollment.|
|claim_url|string¦null|true|none|Dashboard path the agent hands to its human to claim the resource.|

<h2 id="tocS_ResourceStats">ResourceStats</h2>
<a id="schemaresourcestats"></a>
<a id="schema_ResourceStats"></a>
<a id="tocSresourcestats"></a>
<a id="tocsresourcestats"></a>

```json
{
  "total_paid": 0,
  "total_received": 0,
  "payments_made": 0,
  "payments_received": 0,
  "unique_counterparties": 0,
  "first_seen": "2019-08-24T14:15:22Z",
  "last_active": "2019-08-24T14:15:22Z"
}

```

Aggregate public payment stats for the resource.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|total_paid|integer|true|none|Total atomic units paid out by this resource.|
|total_received|integer|true|none|Total atomic units received by this resource.|
|payments_made|integer|true|none|none|
|payments_received|integer|true|none|none|
|unique_counterparties|integer|true|none|none|
|first_seen|string(date-time)¦null|true|none|none|
|last_active|string(date-time)¦null|true|none|none|

<h2 id="tocS_Pagination">Pagination</h2>
<a id="schemapagination"></a>
<a id="schema_Pagination"></a>
<a id="tocSpagination"></a>
<a id="tocspagination"></a>

```json
{
  "page": 0,
  "per_page": 0,
  "total": 0,
  "total_pages": 0
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|page|integer|true|none|none|
|per_page|integer|true|none|none|
|total|integer|true|none|none|
|total_pages|integer|true|none|none|

<h2 id="tocS_SignUpRequest">SignUpRequest</h2>
<a id="schemasignuprequest"></a>
<a id="schema_SignUpRequest"></a>
<a id="tocSsignuprequest"></a>
<a id="tocssignuprequest"></a>

```json
{
  "email": "user@example.com",
  "password": "string",
  "password_confirmation": "string"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|email|string(email)|true|none|none|
|password|string|true|none|none|
|password_confirmation|string|true|none|none|

<h2 id="tocS_SignInRequest">SignInRequest</h2>
<a id="schemasigninrequest"></a>
<a id="schema_SignInRequest"></a>
<a id="tocSsigninrequest"></a>
<a id="tocssigninrequest"></a>

```json
{
  "email": "user@example.com",
  "password": "string"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|email|string(email)|true|none|none|
|password|string|true|none|none|

<h2 id="tocS_ConfirmRequest">ConfirmRequest</h2>
<a id="schemaconfirmrequest"></a>
<a id="schema_ConfirmRequest"></a>
<a id="tocSconfirmrequest"></a>
<a id="tocsconfirmrequest"></a>

```json
{
  "confirmation_token": "string"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|confirmation_token|string|true|none|none|

<h2 id="tocS_ResendConfirmationRequest">ResendConfirmationRequest</h2>
<a id="schemaresendconfirmationrequest"></a>
<a id="schema_ResendConfirmationRequest"></a>
<a id="tocSresendconfirmationrequest"></a>
<a id="tocsresendconfirmationrequest"></a>

```json
{
  "email": "user@example.com"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|email|string(email)|true|none|none|

<h2 id="tocS_PasswordResetRequest">PasswordResetRequest</h2>
<a id="schemapasswordresetrequest"></a>
<a id="schema_PasswordResetRequest"></a>
<a id="tocSpasswordresetrequest"></a>
<a id="tocspasswordresetrequest"></a>

```json
{
  "email": "user@example.com"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|email|string(email)|true|none|none|

<h2 id="tocS_PasswordUpdateRequest">PasswordUpdateRequest</h2>
<a id="schemapasswordupdaterequest"></a>
<a id="schema_PasswordUpdateRequest"></a>
<a id="tocSpasswordupdaterequest"></a>
<a id="tocspasswordupdaterequest"></a>

```json
{
  "reset_password_token": "string",
  "password": "string",
  "password_confirmation": "string"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|reset_password_token|string|true|none|none|
|password|string|true|none|none|
|password_confirmation|string|true|none|none|

<h2 id="tocS_AuthResponse">AuthResponse</h2>
<a id="schemaauthresponse"></a>
<a id="schema_AuthResponse"></a>
<a id="tocSauthresponse"></a>
<a id="tocsauthresponse"></a>

```json
{
  "data": {
    "user": {
      "id": 0,
      "email": "user@example.com",
      "status": "string"
    },
    "token": "string",
    "confirmation_required": true
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|data|object|true|none|none|
|» user|[User](#schemauser)|true|none|none|
|» token|string¦null|false|none|none|
|» confirmation_required|boolean|true|none|none|

<h2 id="tocS_User">User</h2>
<a id="schemauser"></a>
<a id="schema_User"></a>
<a id="tocSuser"></a>
<a id="tocsuser"></a>

```json
{
  "id": 0,
  "email": "user@example.com",
  "status": "string"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|integer|true|none|none|
|email|string(email)|true|none|none|
|status|string|false|none|none|

<h2 id="tocS_MeResponse">MeResponse</h2>
<a id="schemameresponse"></a>
<a id="schema_MeResponse"></a>
<a id="tocSmeresponse"></a>
<a id="tocsmeresponse"></a>

```json
{
  "data": {
    "id": 0,
    "name": "string",
    "slug": "string",
    "kind": "string",
    "api_key": {
      "id": 0,
      "name": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "last_used_at": "2019-08-24T14:15:22Z",
      "created_by": {
        "id": 0,
        "email": "user@example.com",
        "display_name": "string"
      }
    }
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|data|[AccountDetails](#schemaaccountdetails)|true|none|The Organization that owns the authenticated API key — the principal<br>in API v1 (the key represents an Org, not a person). `api_key` carries<br>audit info about the key itself, including the user who minted it<br>(`created_by`, which may be `null` if that user has left the Org).|

<h2 id="tocS_AccountDetails">AccountDetails</h2>
<a id="schemaaccountdetails"></a>
<a id="schema_AccountDetails"></a>
<a id="tocSaccountdetails"></a>
<a id="tocsaccountdetails"></a>

```json
{
  "id": 0,
  "name": "string",
  "slug": "string",
  "kind": "string",
  "api_key": {
    "id": 0,
    "name": "string",
    "created_at": "2019-08-24T14:15:22Z",
    "last_used_at": "2019-08-24T14:15:22Z",
    "created_by": {
      "id": 0,
      "email": "user@example.com",
      "display_name": "string"
    }
  }
}

```

The Organization that owns the authenticated API key — the principal
in API v1 (the key represents an Org, not a person). `api_key` carries
audit info about the key itself, including the user who minted it
(`created_by`, which may be `null` if that user has left the Org).

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|integer|true|none|none|
|name|string|true|none|none|
|slug|string|true|none|none|
|kind|string|true|none|none|
|api_key|[MeApiKey](#schemameapikey)|true|none|none|

<h2 id="tocS_MeApiKey">MeApiKey</h2>
<a id="schemameapikey"></a>
<a id="schema_MeApiKey"></a>
<a id="tocSmeapikey"></a>
<a id="tocsmeapikey"></a>

```json
{
  "id": 0,
  "name": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "last_used_at": "2019-08-24T14:15:22Z",
  "created_by": {
    "id": 0,
    "email": "user@example.com",
    "display_name": "string"
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|integer|true|none|none|
|name|string¦null|false|none|none|
|created_at|string(date-time)|true|none|none|
|last_used_at|string(date-time)¦null|false|none|none|
|created_by|[MeApiKeyCreator](#schemameapikeycreator)|false|none|The user who minted this API key, surfaced for audit rendering only.<br>`null` if that user has since left the Organization. NEVER use for<br>authorization.|

<h2 id="tocS_MeApiKeyCreator">MeApiKeyCreator</h2>
<a id="schemameapikeycreator"></a>
<a id="schema_MeApiKeyCreator"></a>
<a id="tocSmeapikeycreator"></a>
<a id="tocsmeapikeycreator"></a>

```json
{
  "id": 0,
  "email": "user@example.com",
  "display_name": "string"
}

```

The user who minted this API key, surfaced for audit rendering only.
`null` if that user has since left the Organization. NEVER use for
authorization.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|integer|true|none|none|
|email|string(email)|true|none|none|
|display_name|string¦null|false|none|none|

<h2 id="tocS_CreateApiKeyRequest">CreateApiKeyRequest</h2>
<a id="schemacreateapikeyrequest"></a>
<a id="schema_CreateApiKeyRequest"></a>
<a id="tocScreateapikeyrequest"></a>
<a id="tocscreateapikeyrequest"></a>

```json
{
  "name": "string"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|name|string|false|none|A friendly name for the API key|

<h2 id="tocS_ApiKey">ApiKey</h2>
<a id="schemaapikey"></a>
<a id="schema_ApiKey"></a>
<a id="tocSapikey"></a>
<a id="tocsapikey"></a>

```json
{
  "id": 0,
  "name": "string",
  "key_prefix": "string",
  "last_used_at": "2019-08-24T14:15:22Z",
  "revoked_at": "2019-08-24T14:15:22Z",
  "created_at": "2019-08-24T14:15:22Z"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|integer|true|none|none|
|name|string¦null|false|none|none|
|key_prefix|string|true|none|First 16 characters of the key for identification|
|last_used_at|string(date-time)¦null|false|none|none|
|revoked_at|string(date-time)¦null|false|none|none|
|created_at|string(date-time)|true|none|none|

<h2 id="tocS_ApiKeyCreated">ApiKeyCreated</h2>
<a id="schemaapikeycreated"></a>
<a id="schema_ApiKeyCreated"></a>
<a id="tocSapikeycreated"></a>
<a id="tocsapikeycreated"></a>

```json
{
  "id": 0,
  "name": "string",
  "key_prefix": "string",
  "raw_key": "string",
  "created_at": "2019-08-24T14:15:22Z"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|integer|true|none|none|
|name|string¦null|false|none|none|
|key_prefix|string|true|none|none|
|raw_key|string|true|none|Full API key (shown only once at creation)|
|created_at|string(date-time)|true|none|none|

<h2 id="tocS_ApiKeyListResponse">ApiKeyListResponse</h2>
<a id="schemaapikeylistresponse"></a>
<a id="schema_ApiKeyListResponse"></a>
<a id="tocSapikeylistresponse"></a>
<a id="tocsapikeylistresponse"></a>

```json
{
  "data": [
    {
      "id": 0,
      "name": "string",
      "key_prefix": "string",
      "last_used_at": "2019-08-24T14:15:22Z",
      "revoked_at": "2019-08-24T14:15:22Z",
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "pagination": {
    "page": 0,
    "per_page": 0,
    "total": 0,
    "total_pages": 0
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|data|[[ApiKey](#schemaapikey)]|true|none|none|
|pagination|[Pagination](#schemapagination)|true|none|none|

<h2 id="tocS_ApiKeyCreatedResponse">ApiKeyCreatedResponse</h2>
<a id="schemaapikeycreatedresponse"></a>
<a id="schema_ApiKeyCreatedResponse"></a>
<a id="tocSapikeycreatedresponse"></a>
<a id="tocsapikeycreatedresponse"></a>

```json
{
  "data": {
    "id": 0,
    "name": "string",
    "key_prefix": "string",
    "raw_key": "string",
    "created_at": "2019-08-24T14:15:22Z"
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|data|[ApiKeyCreated](#schemaapikeycreated)|true|none|none|

<h2 id="tocS_Payment">Payment</h2>
<a id="schemapayment"></a>
<a id="schema_Payment"></a>
<a id="tocSpayment"></a>
<a id="tocspayment"></a>

```json
{
  "id": 0,
  "tx_hash": "string",
  "payer_address": "string",
  "recipient_address": "string",
  "amount": 0,
  "amount_formatted": "string",
  "currency": "string",
  "network": "string",
  "resource_url": "string",
  "resource_host": "string",
  "fee_amount": 0,
  "settlement_latency_ms": 0,
  "settled_at": "2019-08-24T14:15:22Z",
  "api_key_name": "string"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|integer|true|none|none|
|tx_hash|string|true|none|none|
|payer_address|string|true|none|none|
|recipient_address|string|true|none|none|
|amount|integer|true|none|Amount in atomic units (1 USDC = 1,000,000)|
|amount_formatted|string|true|none|Human-readable amount (e.g. "1.00 USDC")|
|currency|string|true|none|none|
|network|string|true|none|CAIP-2 chain identifier|
|resource_url|string¦null|false|none|none|
|resource_host|string¦null|false|none|none|
|fee_amount|integer|false|none|none|
|settlement_latency_ms|integer¦null|false|none|none|
|settled_at|string(date-time)|true|none|none|
|api_key_name|string|true|none|none|

<h2 id="tocS_PaymentListResponse">PaymentListResponse</h2>
<a id="schemapaymentlistresponse"></a>
<a id="schema_PaymentListResponse"></a>
<a id="tocSpaymentlistresponse"></a>
<a id="tocspaymentlistresponse"></a>

```json
{
  "data": [
    {
      "id": 0,
      "tx_hash": "string",
      "payer_address": "string",
      "recipient_address": "string",
      "amount": 0,
      "amount_formatted": "string",
      "currency": "string",
      "network": "string",
      "resource_url": "string",
      "resource_host": "string",
      "fee_amount": 0,
      "settlement_latency_ms": 0,
      "settled_at": "2019-08-24T14:15:22Z",
      "api_key_name": "string"
    }
  ],
  "pagination": {
    "page": 0,
    "per_page": 0,
    "total": 0,
    "total_pages": 0
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|data|[[Payment](#schemapayment)]|true|none|none|
|pagination|[Pagination](#schemapagination)|true|none|none|

<h2 id="tocS_PaymentResponse">PaymentResponse</h2>
<a id="schemapaymentresponse"></a>
<a id="schema_PaymentResponse"></a>
<a id="tocSpaymentresponse"></a>
<a id="tocspaymentresponse"></a>

```json
{
  "data": {
    "id": 0,
    "tx_hash": "string",
    "payer_address": "string",
    "recipient_address": "string",
    "amount": 0,
    "amount_formatted": "string",
    "currency": "string",
    "network": "string",
    "resource_url": "string",
    "resource_host": "string",
    "fee_amount": 0,
    "settlement_latency_ms": 0,
    "settled_at": "2019-08-24T14:15:22Z",
    "api_key_name": "string"
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|data|[Payment](#schemapayment)|true|none|none|

<h2 id="tocS_BalanceResponse">BalanceResponse</h2>
<a id="schemabalanceresponse"></a>
<a id="schema_BalanceResponse"></a>
<a id="tocSbalanceresponse"></a>
<a id="tocsbalanceresponse"></a>

```json
{
  "promo": {
    "balance_usd": "0.00",
    "scope": "weft-search",
    "expires_at": "2019-08-24T14:15:22Z"
  },
  "wallet": {
    "address": "string",
    "balance_usdc": "12.34",
    "tempo_usd": "3.00",
    "total_usd": "15.34",
    "network": "string"
  },
  "spent_today_usd": "0.42",
  "spent_week_usd": "3.10",
  "policy": {
    "max_tx_usd": "1.00",
    "daily_limit_usd": "10.00",
    "weekly_limit_usd": "50.00"
  }
}

```

Buyer's wallet snapshot. Note: unlike `/me` / `/payments` / `/api_keys`,
this endpoint does NOT use a `data:` envelope — the response object
is the snapshot directly.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|promo|[PromoBalance](#schemapromobalance)|true|none|Freemium promo credit. v1 returns zero values; once the promo<br>ledger ships (deferred from spec 10), real balances appear here<br>without a shape change.|
|wallet|[Wallet](#schemawallet)|true|none|none|
|spent_today_usd|string|true|none|USD spent in the current calendar day (UTC), 2dp.|
|spent_week_usd|string|true|none|USD spent in the current calendar week (UTC, Monday start), 2dp.|
|policy|[SpendingPolicy](#schemaspendingpolicy)|true|none|none|

<h2 id="tocS_PromoBalance">PromoBalance</h2>
<a id="schemapromobalance"></a>
<a id="schema_PromoBalance"></a>
<a id="tocSpromobalance"></a>
<a id="tocspromobalance"></a>

```json
{
  "balance_usd": "0.00",
  "scope": "weft-search",
  "expires_at": "2019-08-24T14:15:22Z"
}

```

Freemium promo credit. v1 returns zero values; once the promo
ledger ships (deferred from spec 10), real balances appear here
without a shape change.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|balance_usd|string|true|none|none|
|scope|string|true|none|Where the promo can be spent.|
|expires_at|string(date-time)¦null|true|none|none|

<h2 id="tocS_Wallet">Wallet</h2>
<a id="schemawallet"></a>
<a id="schema_Wallet"></a>
<a id="tocSwallet"></a>
<a id="tocswallet"></a>

```json
{
  "address": "string",
  "balance_usdc": "12.34",
  "tempo_usd": "3.00",
  "total_usd": "15.34",
  "network": "string"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|address|string¦null|true|none|EVM address of the buyer's Privy-managed wallet. Null if no wallet provisioned.|
|balance_usdc|string|true|none|Live Base USDC balance, 2dp. Returns "0.00" if the upstream wallet provider is unreachable.|
|tempo_usd|string¦null|true|none|Aggregated USD value of the allowlisted Tempo TIP-20 dollar tokens on the wallet's paired Tempo chain, 2dp. `null` when the value is UNKNOWN — the Tempo RPC read failed, or no dollar token is allowlisted for that chain yet (e.g. Tempo mainnet pre-launch). A null here is never "0.00"; it means "we couldn't determine it", and `total_usd` then reflects the Base component only.|
|total_usd|string¦null|true|none|Single aggregated USD balance = Base USDC + Tempo dollar tokens, 2dp. When `tempo_usd` is null (unavailable/unallowlisted) this equals `balance_usdc` alone. Null when the Base USDC provider is unreachable, because the surface never claims zero for a component it could not read.|
|network|string¦null|true|none|Wallet network (e.g. `base-sepolia`).|

<h2 id="tocS_SpendingPolicy">SpendingPolicy</h2>
<a id="schemaspendingpolicy"></a>
<a id="schema_SpendingPolicy"></a>
<a id="tocSspendingpolicy"></a>
<a id="tocsspendingpolicy"></a>

```json
{
  "max_tx_usd": "1.00",
  "daily_limit_usd": "10.00",
  "weekly_limit_usd": "50.00"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|max_tx_usd|string|true|none|Maximum USD per single transaction.|
|daily_limit_usd|string|true|none|Maximum USD spent in a 24-hour window.|
|weekly_limit_usd|string|true|none|Maximum USD spent in a 7-day window.|

<h2 id="tocS_SearchRequest">SearchRequest</h2>
<a id="schemasearchrequest"></a>
<a id="schema_SearchRequest"></a>
<a id="tocSsearchrequest"></a>
<a id="tocssearchrequest"></a>

```json
{
  "query": "send email from an agent",
  "limit": 10,
  "filters": {
    "min_price_usd": "0.01",
    "max_price_usd": "0.10",
    "payment_protocol": "x402",
    "agent_protocol": "a2a",
    "domain": "string"
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|query|string|true|none|Free-text query. Required and non-empty.|
|limit|integer|false|none|Max number of hits to return. Clamped to [1, 50].|
|filters|[SearchFilters](#schemasearchfilters)|false|none|Optional narrowing applied after the embedding score is computed.<br>Unknown keys are rejected. Price filters use the agent's cheapest<br>skill for `max_price_usd` and the most-expensive skill for<br>`min_price_usd`, so an agent stays in results as long as any one<br>of its skills satisfies the band.|

<h2 id="tocS_SearchFilters">SearchFilters</h2>
<a id="schemasearchfilters"></a>
<a id="schema_SearchFilters"></a>
<a id="tocSsearchfilters"></a>
<a id="tocssearchfilters"></a>

```json
{
  "min_price_usd": "0.01",
  "max_price_usd": "0.10",
  "payment_protocol": "x402",
  "agent_protocol": "a2a",
  "domain": "string"
}

```

Optional narrowing applied after the embedding score is computed.
Unknown keys are rejected. Price filters use the agent's cheapest
skill for `max_price_usd` and the most-expensive skill for
`min_price_usd`, so an agent stays in results as long as any one
of its skills satisfies the band.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|min_price_usd|string|false|none|Decimal USD floor; agent must have at least one skill priced at or above this.|
|max_price_usd|string|false|none|Decimal USD ceiling; agent must have at least one skill priced at or below this.|
|payment_protocol|string|false|none|Payment protocol the agent settles on.|
|agent_protocol|string|false|none|Agent protocol surface (Agent-to-Agent, MCP, raw OpenAPI, or AgentNet).|
|domain|string|false|none|Substring match against any of the agent's declared domain tags<br>(e.g. `email`, `sales`, `enrichment`).|

#### Enumerated Values

|Property|Value|
|---|---|
|payment_protocol|x402|
|payment_protocol|mpp|
|payment_protocol|free|
|agent_protocol|a2a|
|agent_protocol|mcp|
|agent_protocol|openapi|
|agent_protocol|AgentNet|

<h2 id="tocS_SearchResponse">SearchResponse</h2>
<a id="schemasearchresponse"></a>
<a id="schema_SearchResponse"></a>
<a id="tocSsearchresponse"></a>
<a id="tocssearchresponse"></a>

```json
{
  "results": [
    {
      "id": "string",
      "score": 1,
      "protocol": "a2a",
      "domain": [
        "string"
      ],
      "reseller": "string",
      "upstream": "string",
      "agent_card": {
        "name": "string",
        "description": "string",
        "url": "http://example.com",
        "version": "string",
        "protocolVersion": "string",
        "capabilities": {},
        "defaultInputModes": [
          "string"
        ],
        "defaultOutputModes": [
          "string"
        ],
        "skills": [
          {
            "id": "string",
            "name": "string",
            "description": "string",
            "tags": [
              "string"
            ],
            "examples": [
              "string"
            ],
            "inputModes": [
              "string"
            ],
            "outputModes": [
              "string"
            ],
            "streaming": true,
            "endpoint": {
              "method": "string",
              "path": "string"
            },
            "price_usd": "string"
          }
        ]
      },
      "pricing": {
        "protocol": "x402",
        "scheme": "per_call",
        "amount_usd": "string",
        "network": "string"
      },
      "ranking": {
        "popularity_score": 1,
        "settlement_count_30d": 0,
        "success_rate_30d": 1,
        "p50_latency_ms": 0,
        "first_seen_at": "2019-08-24T14:15:22Z"
      },
      "endpoints": {
        "a2a": "http://example.com",
        "mcp": "http://example.com",
        "openapi": "http://example.com",
        "weft_fetch_target": "http://example.com"
      }
    }
  ],
  "paid_usd": "string",
  "tx_hash": "string",
  "artifact_id": "string",
  "_mock": true
}

```

Spec-11 search envelope. `paid_usd`, `tx_hash`, and `artifact_id`
are reserved for a later release that adds per-call billing and
artifact persistence; they are always `null` in v1. `_mock: true`
is set only by the mock backend.

Result rows: the mock backend (`SEARCH_BACKEND=mock`, the default
while the real index is unshipped) emits the rich, SDK-facing
`SearchResult` shape. The legacy `platform` backend proxies the
upstream search service and passes its result rows through verbatim —
Weft does not own or reshape that payload, so those rows are typed as
a free-form object. SDK clients on v1 should treat unknown row shapes
defensively until the platform backend is retrofitted to the
`SearchResult` contract (specs 07 + 10).

Because the `PlatformSearchResult` branch is intentionally permissive
(free-form, to admit the un-owned platform rows), the `anyOf` is
satisfied by any object — so the committee response-validation gate does
NOT strictly validate result-row shapes; the rich `SearchResult`
contract is instead guarded by the `/api/v1/search` request spec.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|results|[anyOf]|true|none|none|

anyOf

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» *anonymous*|[SearchResult](#schemasearchresult)|false|none|none|

or

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» *anonymous*|[PlatformSearchResult](#schemaplatformsearchresult)|false|none|A result row from the legacy `platform` search backend. The<br>`/api/v1/search` controller proxies the upstream search service and<br>passes its rows through verbatim, so Weft does not own or constrain<br>this shape. Documented as a free-form object purely so the canonical<br>spec stays truthful about both backends. SDK clients should prefer the<br>rich `SearchResult` shape and treat platform rows defensively.|

continued

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|paid_usd|string¦null|false|none|Always `null` in v1.|
|tx_hash|string¦null|false|none|Always `null` in v1.|
|artifact_id|string¦null|false|none|Always `null` in v1.|
|_mock|boolean|false|none|Present and `true` only when served by the mock backend.|

<h2 id="tocS_SearchResult">SearchResult</h2>
<a id="schemasearchresult"></a>
<a id="schema_SearchResult"></a>
<a id="tocSsearchresult"></a>
<a id="tocssearchresult"></a>

```json
{
  "id": "string",
  "score": 1,
  "protocol": "a2a",
  "domain": [
    "string"
  ],
  "reseller": "string",
  "upstream": "string",
  "agent_card": {
    "name": "string",
    "description": "string",
    "url": "http://example.com",
    "version": "string",
    "protocolVersion": "string",
    "capabilities": {},
    "defaultInputModes": [
      "string"
    ],
    "defaultOutputModes": [
      "string"
    ],
    "skills": [
      {
        "id": "string",
        "name": "string",
        "description": "string",
        "tags": [
          "string"
        ],
        "examples": [
          "string"
        ],
        "inputModes": [
          "string"
        ],
        "outputModes": [
          "string"
        ],
        "streaming": true,
        "endpoint": {
          "method": "string",
          "path": "string"
        },
        "price_usd": "string"
      }
    ]
  },
  "pricing": {
    "protocol": "x402",
    "scheme": "per_call",
    "amount_usd": "string",
    "network": "string"
  },
  "ranking": {
    "popularity_score": 1,
    "settlement_count_30d": 0,
    "success_rate_30d": 1,
    "p50_latency_ms": 0,
    "first_seen_at": "2019-08-24T14:15:22Z"
  },
  "endpoints": {
    "a2a": "http://example.com",
    "mcp": "http://example.com",
    "openapi": "http://example.com",
    "weft_fetch_target": "http://example.com"
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|string|true|none|Stable agent identifier (e.g. `weft:agent:agentmail`).|
|score|number(double)|true|none|Cosine similarity score, clipped to [0, 1].|
|protocol|string|true|none|Agent protocol surface.|
|domain|[string]|true|none|Domain tags declared by the agent.|
|reseller|string¦null|false|none|Reseller slug if this agent is fronted by an aggregator (e.g. `locus`).|
|upstream|string¦null|false|none|Upstream provider hostname when fronted by a reseller.|
|agent_card|[SearchAgentCard](#schemasearchagentcard)|true|none|A2A-spec-shaped AgentCard. Free-form `capabilities` and per-skill<br>metadata follow the upstream A2A schema; documented here only at<br>the surface level Weft's index actually populates.|
|pricing|[SearchPricing](#schemasearchpricing)|true|none|Aggregate pricing at the agent level. `recipient_address` is<br>intentionally absent from the index — under x402 it is delivered<br>per-request in the `402 Payment Required` challenge from the agent.|
|ranking|[SearchRanking](#schemasearchranking)|true|none|none|
|endpoints|[SearchEndpoints](#schemasearchendpoints)|true|none|Per-protocol entry points for the agent. Any field may be `null`<br>if the agent does not expose that protocol surface.|

#### Enumerated Values

|Property|Value|
|---|---|
|protocol|a2a|
|protocol|mcp|
|protocol|openapi|
|protocol|AgentNet|

<h2 id="tocS_PlatformSearchResult">PlatformSearchResult</h2>
<a id="schemaplatformsearchresult"></a>
<a id="schema_PlatformSearchResult"></a>
<a id="tocSplatformsearchresult"></a>
<a id="tocsplatformsearchresult"></a>

```json
{}

```

A result row from the legacy `platform` search backend. The
`/api/v1/search` controller proxies the upstream search service and
passes its rows through verbatim, so Weft does not own or constrain
this shape. Documented as a free-form object purely so the canonical
spec stays truthful about both backends. SDK clients should prefer the
rich `SearchResult` shape and treat platform rows defensively.

### Properties

*None*

<h2 id="tocS_SearchAgentCard">SearchAgentCard</h2>
<a id="schemasearchagentcard"></a>
<a id="schema_SearchAgentCard"></a>
<a id="tocSsearchagentcard"></a>
<a id="tocssearchagentcard"></a>

```json
{
  "name": "string",
  "description": "string",
  "url": "http://example.com",
  "version": "string",
  "protocolVersion": "string",
  "capabilities": {},
  "defaultInputModes": [
    "string"
  ],
  "defaultOutputModes": [
    "string"
  ],
  "skills": [
    {
      "id": "string",
      "name": "string",
      "description": "string",
      "tags": [
        "string"
      ],
      "examples": [
        "string"
      ],
      "inputModes": [
        "string"
      ],
      "outputModes": [
        "string"
      ],
      "streaming": true,
      "endpoint": {
        "method": "string",
        "path": "string"
      },
      "price_usd": "string"
    }
  ]
}

```

A2A-spec-shaped AgentCard. Free-form `capabilities` and per-skill
metadata follow the upstream A2A schema; documented here only at
the surface level Weft's index actually populates.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|name|string|false|none|none|
|description|string|false|none|none|
|url|string(uri)|false|none|none|
|version|string|false|none|none|
|protocolVersion|string|false|none|none|
|capabilities|object|false|none|none|
|defaultInputModes|[string]|false|none|none|
|defaultOutputModes|[string]|false|none|none|
|skills|[[SearchSkill](#schemasearchskill)]|false|none|none|

<h2 id="tocS_SearchSkill">SearchSkill</h2>
<a id="schemasearchskill"></a>
<a id="schema_SearchSkill"></a>
<a id="tocSsearchskill"></a>
<a id="tocssearchskill"></a>

```json
{
  "id": "string",
  "name": "string",
  "description": "string",
  "tags": [
    "string"
  ],
  "examples": [
    "string"
  ],
  "inputModes": [
    "string"
  ],
  "outputModes": [
    "string"
  ],
  "streaming": true,
  "endpoint": {
    "method": "string",
    "path": "string"
  },
  "price_usd": "string"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|id|string|false|none|none|
|name|string|false|none|none|
|description|string|false|none|none|
|tags|[string]|false|none|none|
|examples|[string]|false|none|none|
|inputModes|[string]|false|none|none|
|outputModes|[string]|false|none|none|
|streaming|boolean|false|none|True for skills that require streaming transport (e.g. websockets).<br>Streaming skills are filtered out of results by default so<br>non-streaming clients only see callable skills.|
|endpoint|object|false|none|none|
|» method|string|false|none|HTTP method or `WEBSOCKET` for streaming skills.|
|» path|string|false|none|none|
|price_usd|string|false|none|Per-call price in USD for this individual skill.|

<h2 id="tocS_SearchPricing">SearchPricing</h2>
<a id="schemasearchpricing"></a>
<a id="schema_SearchPricing"></a>
<a id="tocSsearchpricing"></a>
<a id="tocssearchpricing"></a>

```json
{
  "protocol": "x402",
  "scheme": "per_call",
  "amount_usd": "string",
  "network": "string"
}

```

Aggregate pricing at the agent level. `recipient_address` is
intentionally absent from the index — under x402 it is delivered
per-request in the `402 Payment Required` challenge from the agent.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|protocol|string|false|none|none|
|scheme|string|false|none|none|
|amount_usd|string|false|none|Default per-call amount; individual skills may override via `price_usd`.|
|network|string|false|none|Settlement network (e.g. `base-sepolia`).|

#### Enumerated Values

|Property|Value|
|---|---|
|protocol|x402|
|protocol|mpp|
|protocol|free|

<h2 id="tocS_SearchRanking">SearchRanking</h2>
<a id="schemasearchranking"></a>
<a id="schema_SearchRanking"></a>
<a id="tocSsearchranking"></a>
<a id="tocssearchranking"></a>

```json
{
  "popularity_score": 1,
  "settlement_count_30d": 0,
  "success_rate_30d": 1,
  "p50_latency_ms": 0,
  "first_seen_at": "2019-08-24T14:15:22Z"
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|popularity_score|number(double)|false|none|none|
|settlement_count_30d|integer|false|none|none|
|success_rate_30d|number(double)|false|none|none|
|p50_latency_ms|integer|false|none|none|
|first_seen_at|string(date-time)|false|none|none|

<h2 id="tocS_SearchEndpoints">SearchEndpoints</h2>
<a id="schemasearchendpoints"></a>
<a id="schema_SearchEndpoints"></a>
<a id="tocSsearchendpoints"></a>
<a id="tocssearchendpoints"></a>

```json
{
  "a2a": "http://example.com",
  "mcp": "http://example.com",
  "openapi": "http://example.com",
  "weft_fetch_target": "http://example.com"
}

```

Per-protocol entry points for the agent. Any field may be `null`
if the agent does not expose that protocol surface.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|a2a|string(uri)¦null|false|none|none|
|mcp|string(uri)¦null|false|none|none|
|openapi|string(uri)¦null|false|none|URL to the agent's OpenAPI document.|
|weft_fetch_target|string(uri)¦null|false|none|Base URL the `weft_fetch` MCP tool should target for this agent.|

<h2 id="tocS_SearchErrorResponse">SearchErrorResponse</h2>
<a id="schemasearcherrorresponse"></a>
<a id="schema_SearchErrorResponse"></a>
<a id="tocSsearcherrorresponse"></a>
<a id="tocssearcherrorresponse"></a>

```json
{
  "error": "INVALID_QUERY",
  "details": {}
}

```

Bespoke error envelope returned by `/api/v1/search` for `422`, `502`,
and `500` responses. It differs from the standard `ErrorResponse`
envelope (no nested `code`/`message`/`request_id`); SDK clients
should handle both shapes for this endpoint until the controller
is migrated to the standard envelope.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|error|string|true|none|Stable error code.|
|details|object|false|none|Optional context. Shape varies by error code.|

#### Enumerated Values

|Property|Value|
|---|---|
|error|INVALID_QUERY|
|error|SEARCH_UPSTREAM_ERROR|
|error|SEARCH_BACKEND_MISCONFIGURED|

<h2 id="tocS_FetchRequest">FetchRequest</h2>
<a id="schemafetchrequest"></a>
<a id="schema_FetchRequest"></a>
<a id="tocSfetchrequest"></a>
<a id="tocsfetchrequest"></a>

```json
{
  "url": "https://x402.api.agentmail.to/v0/inboxes",
  "max_cost_usd": "0.05",
  "method": "GET",
  "body": "string",
  "headers": {
    "Accept": "application/json",
    "User-Agent": "my-agent/1.0"
  }
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|url|string(uri)|true|none|Target URL. Must pass Weft's URL safety check (no SSRF / private IP ranges).|
|max_cost_usd|string|false|none|Hard ceiling on what the buyer is willing to pay. Defaults to `0.10` USD.|
|method|string|false|none|HTTP method to use against the upstream.|
|body|any|false|none|Request body forwarded to the upstream. Pass `null` for GET.|

oneOf

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» *anonymous*|string|false|none|none|

xor

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» *anonymous*|object|false|none|none|

xor

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|» *anonymous*|null|false|none|none|

continued

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|headers|object|false|none|Headers forwarded to the upstream. Up to 32 headers, 4 KB<br>total. The following are silently stripped: `host`,<br>`authorization`, `cookie`, `proxy-authorization`,<br>`x-forwarded-*`, `x-real-ip`, `x-payment`, `connection`,<br>`upgrade`.|
|» **additionalProperties**|string|false|none|none|

#### Enumerated Values

|Property|Value|
|---|---|
|method|GET|
|method|POST|
|method|PUT|
|method|PATCH|
|method|DELETE|

<h2 id="tocS_FetchResponse">FetchResponse</h2>
<a id="schemafetchresponse"></a>
<a id="schema_FetchResponse"></a>
<a id="tocSfetchresponse"></a>
<a id="tocsfetchresponse"></a>

```json
{
  "status": 200,
  "headers": {
    "property1": "string",
    "property2": "string"
  },
  "body_base64": "string",
  "paid_usd": "0.002",
  "tx_hash": "string",
  "artifact_id": 0,
  "merchant": {
    "address": "string",
    "settlement_count": 0,
    "first_seen_at": "2019-08-24T14:15:22Z",
    "dispute_count": 0
  }
}

```

Successful fetch envelope. `body_base64` is the upstream artifact
bytes, base64-encoded. `paid_usd`, `tx_hash`, and `merchant` are
populated only when the upstream charged for the response.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|status|integer|true|none|HTTP status returned by the upstream after the paid replay.|
|headers|object|true|none|Response headers from the upstream.|
|» **additionalProperties**|string|false|none|none|
|body_base64|string|true|none|Base64-encoded response body. Empty string for empty bodies.|
|paid_usd|string¦null|true|none|USD amount actually settled. Null for free upstreams.|
|tx_hash|string¦null|true|none|Settlement transaction hash. Null for free upstreams.|
|artifact_id|integer¦null|true|none|Internal artifact identifier if the response was persisted; `null` otherwise.|
|merchant|[Merchant](#schemamerchant)¦null|true|none|Merchant reputation snapshot. Null for free upstreams.|

<h2 id="tocS_Merchant">Merchant</h2>
<a id="schemamerchant"></a>
<a id="schema_Merchant"></a>
<a id="tocSmerchant"></a>
<a id="tocsmerchant"></a>

```json
{
  "address": "string",
  "settlement_count": 0,
  "first_seen_at": "2019-08-24T14:15:22Z",
  "dispute_count": 0
}

```

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|address|string|true|none|EVM address that received the payment.|
|settlement_count|integer|true|none|All-time settlement count for this merchant address.|
|first_seen_at|string(date-time)¦null|true|none|First time Weft observed a payment to this address.|
|dispute_count|integer|true|none|All-time dispute count for this merchant address.|

<h2 id="tocS_FetchErrorResponse">FetchErrorResponse</h2>
<a id="schemafetcherrorresponse"></a>
<a id="schema_FetchErrorResponse"></a>
<a id="tocSfetcherrorresponse"></a>
<a id="tocsfetcherrorresponse"></a>

```json
{
  "error": "EXCEEDED_MAX_COST",
  "details": {},
  "policy": {
    "max_tx_usd": "1.00",
    "daily_limit_usd": "10.00",
    "weekly_limit_usd": "50.00"
  },
  "balance": {
    "promo_usd": "0.00",
    "wallet_usdc": "12.34",
    "tempo_usd": "3.00",
    "total_usd": "15.34",
    "spent_today_usd": "0.42"
  },
  "dashboard_url": "http://example.com"
}

```

Bespoke error envelope for `/api/v1/fetch`. Every error carries the
buyer's current `policy`, `balance`, and a `dashboard_url` so a CLI
can render an actionable message without a second round-trip.

`error` values include the fixed codes listed below plus the
`POLICY_VIOLATION_<REASON>` family, where `<REASON>` is the violated
policy field (`MAX_TX`, `DAILY`, or `WEEKLY` — see
`PolicyViolation::REASONS`).

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|error|string|true|none|Stable error code.|
|details|object|true|none|Optional context. Shape varies by error code.|
|policy|[SpendingPolicy](#schemaspendingpolicy)|true|none|none|
|balance|[FetchBalanceSnapshot](#schemafetchbalancesnapshot)|true|none|Compact balance snapshot returned inside `FetchErrorResponse`. Less<br>rich than `BalanceResponse` — just the fields a CLI needs to explain<br>why a fetch failed.|
|dashboard_url|string(uri)|true|none|Deep-link to the dashboard's policy page.|

#### Enumerated Values

|Property|Value|
|---|---|
|error|INVALID_URL|
|error|EXCEEDED_MAX_COST|
|error|INSUFFICIENT_BALANCE|
|error|CONVERSION_UNAVAILABLE|
|error|MERCHANT_RETURNED_NON_402|
|error|ARTIFACT_TOO_LARGE|
|error|DENYLISTED_RECIPIENT|
|error|WALLET_ENVIRONMENT_MISMATCH|
|error|SETTLEMENT_FAILED|
|error|UNSUPPORTED_PAYMENT_METHOD|
|error|POLICY_VIOLATION_MAX_TX|
|error|POLICY_VIOLATION_DAILY|
|error|POLICY_VIOLATION_WEEKLY|

<h2 id="tocS_FetchBalanceSnapshot">FetchBalanceSnapshot</h2>
<a id="schemafetchbalancesnapshot"></a>
<a id="schema_FetchBalanceSnapshot"></a>
<a id="tocSfetchbalancesnapshot"></a>
<a id="tocsfetchbalancesnapshot"></a>

```json
{
  "promo_usd": "0.00",
  "wallet_usdc": "12.34",
  "tempo_usd": "3.00",
  "total_usd": "15.34",
  "spent_today_usd": "0.42"
}

```

Compact balance snapshot returned inside `FetchErrorResponse`. Less
rich than `BalanceResponse` — just the fields a CLI needs to explain
why a fetch failed.

### Properties

|Name|Type|Required|Restrictions|Description|
|---|---|---|---|---|
|promo_usd|string|true|none|none|
|wallet_usdc|string|true|none|Live Base USDC balance.|
|tempo_usd|string¦null|true|none|Aggregated USD of allowlisted Tempo dollar tokens, 2dp. `null` when UNKNOWN (RPC read failed or no token allowlisted for the paired chain) — never "0.00" for an unread component.|
|total_usd|string¦null|true|none|Aggregated USD balance = Base USDC + Tempo dollar tokens, 2dp. Equals `wallet_usdc` alone when `tempo_usd` is null. Null when the Base USDC provider is unreachable.|
|spent_today_usd|string|true|none|none|

