sFOX API
Sign InOpen Account
Connect API
Connect API
  • Introduction
    • Welcome
    • Getting Started
    • Resources
      • Terminology
      • Systems & Operations
      • Integration Options
    • Guides
      • End User Onboarding & KYC
        • Individuals
        • Businesses
        • Enhanced Due Diligence
  • REST API
    • REST Endpoints
    • Authentication
    • End Users
      • Create End User Account
      • Request Verification Code
      • Confirm Verification Code
      • Create User Auth Token(s)
      • Get End User(s)
      • Get EDD Requests
      • Get EDD Prompts
      • Create EDD Responses
        • Uploading Files as Responses
      • Submit Documents
      • Deactivate User
    • Payments
      • Create Bank Account (Plaid)
      • Create Bank Account
      • Get Bank Account
      • Get Plaid Processors
      • Amend Plaid Processors
      • Verify Bank Account
      • Delete Bank Account
      • Get Wire Instructions
      • Get ACH Agreement Status
      • Request ACH Onboarding
      • Get ACH Deposit Limit
    • Withdrawals
      • Confirm Withdrawal
      • Resend Confirmation Code
      • Cancel Withdrawal
    • Transfers
      • Create Transfer
      • Confirm Transfer
      • Resend Confirmation Code
      • Cancel Transfer
      • Get Transfer Permissions
      • Get Transfer History
    • Monetization
      • Create Setting
      • Update Setting
      • Delete Setting
      • Get Settings
      • Get Permissions
      • Get Monetization History
  • WebSocket API
    • Connecting
    • Authentication
    • Subscribing & Unsubscribing
    • Message Format
    • End Users
      • Onboarding
      • Balances
      • Orders
      • Trades
    • Market Data
      • Order Book
      • Trades
      • Ticker
  • Single Sign-On
    • Overview
      • IdP Initiated SSO
    • IdP Data
    • SAML Response Data
  • Errors
    • Error Codes
Powered by GitBook
On this page
  • Request
  • Path Parameters
  • Body Parameters
  • Example Requests
  • Response
  • Response Body
  • Responses
  1. REST API
  2. End Users

Create User Auth Token(s)

POST

https://api.sfox.com/v1/enterprise/user-tokens/:user_id

Generate a user auth token for an end user.


Request

You must include either a single user_id in the path, or a list of user_ids in the body.

Path Parameters

Parameter
Type
Description

user_id optional

string

User defined ID added to the path to retrieve an auth token for a single user

Body Parameters

Name
Type
Description

data optional

string

Array of user_ids

Example Requests

Single User

export userId="156c5beb-7c9f-4f68-83c0-9479703ac490"

curl -X POST \
-H "Authorization: Bearer ${ENTERPRISE_API_KEY}" \
"https://api.sfox.com/v1/enterprise/user-tokens/${userId}"
const axios = require('axios');

const userId = "156c5beb-7c9f-4f68-83c0-9479703ac490"

const config = {
  method: 'post',
  url: `https://api.sfox.com/v1/enterprise/user-tokens/${userId}`,
  headers: {
    "Content-Type": "application/json",
    'Authorization': `Bearer ${process.env.ENTERPRISE_API_KEY}`
  }
}

axios(config)
  .then(response => {
    console.log(response.status)
    console.log(response.data)
  }).catch(err => {
    console.error(err.response.status)
    console.error(err.response.data)
  });
import requests
import os

userId = "156c5beb-7c9f-4f68-83c0-9479703ac490"

data = requests.post(
  f"https://api.sfox.com/v1/enterprise/user-tokens/{userId}",
  headers={
    "Authorization": f"Bearer {os.environ['ENTERPRISE_API_KEY']}"
  }
)
print(data.status_code)
print(data.json())

Multiple Users

curl -X POST \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${ENTERPRISE_API_KEY}" \
--data '{ "data": ["156c5beb-7c9f-4f68-83c0-9479703ac490", "236f5cdc-7h82-6fh3-h37s-9382840de46575"]}' \
'https://api.sfox.com/v1/enterprise/user-tokens'
const axios = require('axios');

const payload = JSON.stringify({
    "data": [
      '156c5beb-7c9f-4f68-83c0-9479703ac490',
      '236f5cdc-7h82-6fh3-h37s-9382840de46575'
    ]
})

const config = {
  method: 'post',
  url: 'https://api.sfox.com/v1/enterprise/user-tokens',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': `Bearer ${process.env.ENTERPRISE_API_KEY}`
  },
  data: data
}

axios(config)
  .then(response => {
    console.log(response.status)
    console.log(response.data)
  }).catch(err => {
    console.error(err.response.status)
    console.error(err.response.data)
  });
import requests
import os

data = requests.post(
  "https://api.sfox.com/v1/enterprise/user-tokens",
  headers={
    "Authorization": f"Bearer {os.environ['ENTERPRISE_API_KEY']}",
  },
  json={
    "data": ["156c5beb-7c9f-4f68-83c0-9479703ac490", "236f5cdc-7h82-6fh3-h37s-9382840de46575"]
    }
)
print(data.status_code)
print(data.json())

Response

Response Body

Key
Description

token

The authentication token that you will use to access this specific user account

expires

An ISO-8601 date and time that the token will expire in UTC time zone

partner_user_id

The unique ID for this end user shared between sFOX and your enterprise

Responses

201 Created (single)
Single user id
{
    "data": {
        "token": "bcf5ab0aa8dfebc86460338514dd022d63080277373002e6986d7925375a0087",
        "partner_user_id": "client_db29326e-5df6-4d8b-aaaa-b75dc194a0a2",
        "expires": "2024-05-14T19:22:09.901Z"
    }
}
201 Created (multiple)
Multiple users
{
  "data": [
  {
    "token":"911b79b52d8921e57d55bfe4fa182e0e3982e1fa7f202ede548299b1118028f3",
    "expires": "2022-02-08T03:28:56Z",
    "partner_user_id": "156c5beb-7c9f-4f68-83c0-9479703ac490"
  },
  {
    "token":"811d79b52d8921e57d55bfe4fa182e0e3982e1fa7f202ede548299b1117467c5",
    "expires": "2022-02-08T03:28:56Z",
    "partner_user_id": "236f5cdc-7h82-6fh3-h37s-9382840de46575"
  }
  ]
}
PreviousConfirm Verification CodeNextGet End User(s)

Last updated 1 day ago