---
title: "Fetch with payment"
method: POST
path: "/v1/payments/x402/fetch"
tags: ["x402"]
---

# Fetch with payment

`POST /v1/payments/x402/fetch`

Fetch any given url. If the url returns HTTP 402 payment required, this endpoint handles payment with the authenticated wallet.

Optionally pass a 'from' query parameter with the authenticated wallet address (server or user wallet) to complete the payment.

If no 'from' parameter is passed, the default project wallet address will be used.

- Works with any x402 compatible endpoint.
- Automatically selects a compatible payment method.
- Signs the appropriate payment payload.
- Sends the payment to the url.
- Returns the final result from the url called.

Request body and headers are always passed through to the url called.

**Authentication**: This endpoint requires wallet authentication for the payment. For frontend usage, include `x-client-id` and `Authorization: Bearer <jwt>` headers. For backend usage, include `x-secret-key` header.

## Query parameters

- `from` string — The authenticated wallet address (server or user wallet)
- `url` string, uri, required — The url to fetch
- `method` union — The method to use, defaults to GET
  - 'POST'
  - 'PUT'
  - 'DELETE'
  - 'PATCH'
  - 'GET'
- `maxValue` string — The maximum value to fetch in base units of the asset (e.g. 1000000 for 1 USDC)
- `asset` string — The asset (token address) to use for the payment. If not provided, the asset from the url's payment requirements will be used.
- `chainId` union — Chain ID to use for the payment. Supports CAIP-2 strings (e.g., 'eip155:1', 'solana:mainnet') or legacy numeric EVM IDs.
  - string
  - integer

## Response `200`

Returns the final result from the API call

## Other responses

- `400` — Invalid request parameters
- `401` — Authentication required. For frontend usage, include `x-client-id` and `Authorization: Bearer <jwt>` headers. For backend usage, include `x-secret-key` header.
- `402` — Payment required. The user does not have enough funds to cover the payment requirements. Returns a payment link to fund the wallet and complete the payment.
- `500` — Internal server error

---

[API](https://skmtc.net/thirdweb/apis/thirdweb-api.md) · [All operations](https://skmtc.net/thirdweb/apis/thirdweb-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/thirdweb/thirdweb-api/revisions/fb4cb67da1c7/schema)
