Create User Auth Token(s)
POST
https://api.sfox.com/v1/enterprise/user-tokens/:user_id
Path Parameters
User defined ID added to the path to retrieve an auth token for a single user
Body Parameters
Response Body
The authentication token that you will use to access this specific user account
An ISO-8601 date and time that the token will expire in UTC time zone
The unique ID for this end user shared between sFOX and your enterprise
Responses
201 Created (single)
{
"data": {
"token": "bcf5ab0aa8dfebc86460338514dd022d63080277373002e6986d7925375a0087",
"partner_user_id": "client_db29326e-5df6-4d8b-aaaa-b75dc194a0a2",
"expires": "2024-05-14T19:22:09.901Z"
}
}
201 Created (multiple)
{
"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"
}
]
}
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())
Example Requests: 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())