User API

The User API provides endpoints for user authentication and account management. All endpoints are served under the base URL https://api.tradearies.dev.

View API Changelog

Authentication

The API uses JWT (JSON Web Tokens) for authentication. Most endpoints require a Bearer token in the Authorization header: Authorization: Bearer <token>.

Authenticate User

Authenticates a user with their credentials and returns access and refresh tokens.

POST/v1/auth
{
"email": "user@example.com",
"password": "password123"
}

Refresh Authentication Token

Refreshes the authentication token using a refresh token.

POST/v1/auth/refresh
{
"email": "user@example.com",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}

Re-authenticate User

Re-authenticates a user with their password. Requires a valid access token.

POST/v1/auth/reauth
{
"password": "password123"
}

Requires Authorization: Bearer <token> header.

Get User Accounts

Retrieves all accounts associated with the authenticated user.

GET/v1/users/me/accounts
{
"accounts": [
  {
    "id": 123456789,
    "fdid": "ARIESFD",
    "apex_id": "APEX123",
    "apex_account_id": "APEXACC456",
    "sterling_account_id": "STER789",
    "status": "OPEN",
    "apex_status": "Active",
    "is_sim": false,
    "primary_user_id": 1,
    "primary_user": {
      "id": 1,
      "email": "user@example.com",
      "country": "US",
      "plaid_status": "verified",
      "created_at": "2023-01-01T00:00:00Z",
      "updated_at": "2023-01-01T00:00:00Z"
    },
    "joint_user": null,
    "account_application": {
      "submitted": true,
      "missing_fields": [],
      "created_at": "2023-01-01T00:00:00Z",
      "updated_at": "2023-01-01T00:00:00Z"
    },
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z"
  }
]
}

Requires Authorization: Bearer <token> header.

Error Responses

All endpoints may return the following error responses:

400 Bad Request

GET
{
"error": "bad_request",
"message": "Invalid request parameters"
}

401 Unauthorized

GET
{
"error": "unauthorized",
"message": "Invalid or expired token"
}

500 Internal Server Error

GET
{
"error": "internal_error",
"message": "An unexpected error occurred"
}

Data Types

Account

FieldTypeDescription
idintegerAccount ID
fdidstringFDID
apex_idstringApex ID
apex_account_idstringApex account ID
sterling_account_idstringSterling account ID
statusstringAccount status (e.g., NEW, OPEN, CLOSED)
apex_statusstringApex account status
is_simbooleanWhether this is a simulation account
primary_user_idintegerPrimary user ID
primary_userAccountItemUserPrimary user details
joint_userAccountItemUserJoint user details (nullable)
account_applicationAccountItemApplicationAccount application details
created_atstringAccount creation timestamp (ISO 8601)
updated_atstringAccount last update timestamp (ISO 8601)

AccountItemUser

FieldTypeDescription
idintegerUser ID
emailstringUser email
countrystringUser country
plaid_statusstringPlaid verification status
created_atstringUser creation timestamp (ISO 8601)
updated_atstringUser last update timestamp (ISO 8601)

AccountItemApplication

FieldTypeDescription
submittedbooleanWhether the application has been submitted
missing_fieldsstring[]List of missing required fields
created_atstringApplication creation timestamp (ISO 8601)
updated_atstringApplication last update timestamp (ISO 8601)

AuthResponse

FieldTypeDescription
access_tokenstringJWT access token
refresh_tokenstringJWT refresh token
expires_inintegerToken expiration time in seconds