Skip to main content
POST
/
v1
/
auth
/
login
/
privy
Log in with Privy token
curl --request POST \
  --url https://perp-api.phoenix.trade/v1/auth/login/privy \
  --header 'Content-Type: application/json' \
  --data '
{
  "privy_token": "string"
}
'
import requests

url = "https://perp-api.phoenix.trade/v1/auth/login/privy"

payload = { "privy_token": "string" }
headers = {"Content-Type": "application/json"}

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

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({privy_token: 'string'})
};

fetch('https://perp-api.phoenix.trade/v1/auth/login/privy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://perp-api.phoenix.trade/v1/auth/login/privy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'privy_token' => 'string'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://perp-api.phoenix.trade/v1/auth/login/privy"

payload := strings.NewReader("{\n \"privy_token\": \"string\"\n}")

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

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://perp-api.phoenix.trade/v1/auth/login/privy")
.header("Content-Type", "application/json")
.body("{\n \"privy_token\": \"string\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://perp-api.phoenix.trade/v1/auth/login/privy")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"privy_token\": \"string\"\n}"

response = http.request(request)
puts response.read_body
{
  "access_token": "<string>",
  "expires_in": 1,
  "pop_key": "<string>",
  "refresh_expires_in": 1,
  "refresh_token": "<string>",
  "token_type": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}

Body

application/json

JSON request payload for post.v1.auth.login.privy.

privy_token
string
required
wallet_proof
null | object

Proof of ownership of wallet_pubkey, obtained by signing the transaction returned from POST /v1/auth/privy/wallet-challenge. When supplied this satisfies the first-time binding ownership check without needing the Privy linked-accounts lookup.

wallet_pubkey
string | null

Optional Solana wallet pubkey the caller is asserting ownership of. For first-time bindings ownership must be proved either by including wallet_proof (a Solana memo transaction signed by the wallet — works for Ledger which cannot sign off-chain messages) or, absent a proof, by Privy's linked_accounts API confirming the wallet is linked to the authenticated user. An unverified pubkey is rejected with wallet_not_linked. For returning users, if supplied, it must match the bound pubkey. If omitted when no mapping exists, login still succeeds but the issued token will not carry a wallet claim and so cannot satisfy user-scoped authorization.

Response

Phoenix JWT pair issued

access_token
string
required
expires_in
integer<int64>
required
Required range: x >= 0
pop_key
string
required
refresh_expires_in
integer<int64>
required
Required range: x >= 0
refresh_token
string
required
token_type
string
required