Managed Cards

List Cards

GET /api/cards

Input:
{
  organizationId: string
  status?: "ACTIVE" | "PAUSED" | "FROZEN" | "CLOSED"
}

Output: Array<{
  id: string
  organizationId: string
  assignedTo: {
    id: string
    name: string | null
    email: string
    avatarUrl: string | null
  }
  policy: {
    id: string
    name: string
    description: string | null
  }
}>

Create Card

POST /api/cards

Input:
{
  organizationId: string
  assignedToId: string
  fundingAccountId: string
  policyId: string
  nickname?: string
  purpose: "PERSONAL" | "BUSINESS" | "ONLINE" | "SUBSCRIPTION"
}

Output: {
  id: string
  organizationId: string
  assignedToId: string
  createdById: string
  fundingAccountId: string
  policyId: string
  nickname: string | null
  purpose: "PERSONAL" | "BUSINESS" | "ONLINE" | "SUBSCRIPTION"
  status: "ACTIVE" | "PAUSED" | "FROZEN" | "CLOSED"
  lastFour: string
  expiryMonth: number
  expiryYear: number
  closedAt: Date | null
}

Update Card Status

PATCH /api/cards/status

Input:
{
  organizationId: string
  cardId: string
  status: "ACTIVE" | "PAUSED" | "FROZEN" | "CLOSED"
  reason?: string
}

Output: {
  id: string
  status: "ACTIVE" | "PAUSED" | "FROZEN" | "CLOSED"
  closedAt: Date | null
}

Card Policies

List Policies

GET /api/cards/policies

Input:
{
  organizationId: string
}

Output: Array<{
  id: string
  organizationId: string
  name: string
  description: string | null
  spendingLimit: number | null
  limitInterval: "PER_TRANSACTION" | "DAILY" | "WEEKLY" | "MONTHLY" | null
  allowAtm: boolean
  allowOnline: boolean
  allowInternational: boolean
  merchantCategories: string[]
  blockedMerchants: string[]
  activeFrom: Date | null
  activeTo: Date | null
  daysOfWeek: number[]
  cardCount: number
}>

Create Policy

POST /api/cards/policies

Input:
{
  organizationId: string
  name: string
  description?: string
  spendingLimit?: number
  limitInterval?: "PER_TRANSACTION" | "DAILY" | "WEEKLY" | "MONTHLY"
  allowAtm?: boolean
  allowOnline?: boolean
  allowInternational?: boolean
  merchantCategories?: string[]
  blockedMerchants?: string[]
  activeFrom?: Date
  activeTo?: Date
  daysOfWeek?: number[] // 0-6, where 0 is Sunday
}

Output: {
  id: string
  organizationId: string
  name: string
  description: string | null
  spendingLimit: number | null
  limitInterval: "PER_TRANSACTION" | "DAILY" | "WEEKLY" | "MONTHLY" | null
  allowAtm: boolean
  allowOnline: boolean
  allowInternational: boolean
  merchantCategories: string[]
  blockedMerchants: string[]
  activeFrom: Date | null
  activeTo: Date | null
  daysOfWeek: number[]
}

Update Policy

PATCH /api/cards/policies/:id

Input:
{
  organizationId: string
  policyId: string
  name?: string
  description?: string
  spendingLimit?: number
  limitInterval?: "PER_TRANSACTION" | "DAILY" | "WEEKLY" | "MONTHLY"
  allowAtm?: boolean
  allowOnline?: boolean
  allowInternational?: boolean
  merchantCategories?: string[]
  blockedMerchants?: string[]
  activeFrom?: Date
  activeTo?: Date
  daysOfWeek?: number[] // 0-6, where 0 is Sunday
}

Output: Same as Create Policy

Card Transactions

List Transactions

GET /api/cards/transactions

Input:
{
  organizationId: string
  cardId?: string
  status?: "PENDING" | "COMPLETED" | "DECLINED"
  from?: Date
  to?: Date
  merchantCategory?: string
  minAmount?: number
  maxAmount?: number
}

Output: Array<{
  id: string
  cardId: string
  amount: number
  currency: string
  merchantName: string
  merchantId: string | null
  merchantCategory: string | null
  description: string | null
  status: "PENDING" | "COMPLETED" | "DECLINED"
  declineReason: string | null
  createdAt: Date
  settledAt: Date | null
}>