> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyspend.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Coinbase session token

Generates a Coinbase Onramp session token that can be reused when constructing buy URLs.

` POST /onramp/coinbase/session-token `

Create Coinbase session token

Generates a Coinbase Onramp session token that can be reused when constructing buy URLs.

## Servers

- ` https://mainnet.anyspend.com ` — Production server

## Request body (required)

Content type: ` application/json `

- ` value `: type ` object ` — Request body to create a Coinbase session token

  - Required fields: ` destinationAddress `, ` blockchains `

  - ` destinationAddress `: type ` string ` — Wallet address that will receive purchased assets

    - example: ` "0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1" `

  - ` blockchains `: type ` array ` — List of supported blockchain identifiers

    - example: ` ["base"] `

    - ` array item `: type ` string `

  - ` assets `: type ` array ` — Optional list of asset symbols to whitelist

    - example: ` ["USDC"] `

    - ` array item `: type ` string `

## Responses

### ` 200 ` — Session token created successfully

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` success `, ` message `, ` data `, ` statusCode `

  - ` success `: type ` boolean `

    - example: ` true `

  - ` message `: type ` string `

    - example: ` "Session token created successfully" `

  - ` data `: type ` object ` — Coinbase session token result

    - Required fields: ` token `

    - ` token `: type ` string ` — Session token identifier

      - example: ` "token_123" `

    - ` channelId `: type ` string ` — Optional session channel identifier

      - example: ` "channel_abc" `

  - ` statusCode `: type ` number `

    - example: ` 200 `

### ` 400 ` — Bad request

Content type: ` application/json `

- ` value `: type ` object `

  - Required fields: ` success `, ` message `, ` statusCode `

  - ` success `: type ` boolean `

    - example: ` false `

  - ` message `: type ` string `

    - example: ` "Bad request" `

  - ` statusCode `: type ` number `

    - example: ` 400 `

## Request examples

### cURL

```curl
curl -X POST 'https://mainnet.anyspend.com/onramp/coinbase/session-token' \
  -H 'Content-Type: application/json' \
  -d '{
  "destinationAddress": "0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1",
  "blockchains": [
    "base"
  ],
  "assets": [
    "USDC"
  ]
}'
```

### JavaScript

```javascript
const response = await fetch('https://mainnet.anyspend.com/onramp/coinbase/session-token', {
  method: 'POST',
  headers: {
      "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "destinationAddress": "0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1",
    "blockchains": [
      "base"
    ],
    "assets": [
      "USDC"
    ]
  })
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

response = requests.post('https://mainnet.anyspend.com/onramp/coinbase/session-token', json={
  "destinationAddress": "0x58241893EF1f86C9fBd8109Cd44Ea961fDb474e1",
  "blockchains": [
    "base"
  ],
  "assets": [
    "USDC"
  ]
})
print(response.json())
```