ACCESS API

Account Management

Account Owners

Arkansas Civics Test

Community Service Learning

Data Services Agreements

Online Testing

Private Schools

Home Schools

Smart Core

Student Transcripts

Advanced Searching

OneRoster API

Student Data API


Login Endpoint


The login endpoint authenticates a vendor using their Triand account credentials and returns a Bearer token (PJWT) for subsequent API calls.

Endpoint

POST https://api.triand.com/v1/login

Headers

HeaderRequiredDescription
x-api-keyYesYour vendor API key
Content-TypeYesapplication/json
AuthorizationNoNot required — the login endpoint generates the Bearer token

Request Body

ParameterTypeRequiredDescription
emailstringYesYour Triand account email address
passwordstringYesYour Triand account password

Response

A successful login returns:

{
  "actionOk": true,
  "error": [],
  "pjwt": "eyJhbGciOiJIUzUxMiI...",
  "expiresIn": 86400
}
FieldTypeDescription
actionOkbooleantrue on success
errorstring[]Error codes (empty on success)
pjwtstringBearer token for subsequent API calls
expiresInnumberToken validity in seconds (86400 = 24 hours)

Example: curl

curl -X POST https://api.triand.com/v1/login \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "email": "vendor@example.com",
    "password": "your-password"
  }'

Example: JavaScript fetch

const response = await fetch('https://api.triand.com/v1/login', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY',
  },
  body: JSON.stringify({
    email: 'vendor@example.com',
    password: 'your-password',
  }),
})
const { pjwt, expiresIn } = await response.json()

// Use the pjwt for subsequent API calls:
const students = await fetch('https://api.triand.com/v1/students', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY',
    'Authorization': `Bearer ${pjwt}`,
  },
  body: JSON.stringify({ limit: 5, districtlea: '1503000' }),
})

Token Expiry and Re-Login

The PJWT token expires after 24 hours (expiresIn: 86400 seconds). When the token expires, your API calls will return a 401 invalid-token error. At that point, call POST /v1/login again to obtain a fresh token.

Best practice: Cache the PJWT and re-authenticate proactively before it expires, rather than waiting for a 401 error. Track the expiresIn value to know when to refresh.

Error Responses

Error CodeCause
missing-credentialsEmail or password was not provided
invalid-credentialsEmail not found or password is incorrect
no-vendor-accountUser exists but has no approved vendor account
vendor-not-activeVendor account is suspended or disabled