Skip to main content

Backend API

The Backend GraphQL API is the primary interface for all AIQLick business operations. It is built with NestJS 11 and Apollo Server 4, serving an auto-generated schema with over 320 types.

Endpoint: https://api.aiqlick.com/graphql (production) | https://api-dev.aiqlick.com/graphql (development)

Authentication

All authenticated operations require a valid JWT in the Authorization header:

Authorization: Bearer <jwt_token>

On the server side, resolvers are protected with the @UseGuards(JwtAuthGuard) decorator. The @CurrentUser() parameter decorator injects the authenticated User entity into the resolver method.

# Obtain a token
mutation {
signIn(input: { email: "user@example.com", password: "..." }) {
token
temporaryToken
message
user {
id
email
}
}
}

Queries

Users

QueryDescriptionAuth Required
whoAmIReturns the currently authenticated user with full profileYes
user(id: ID!)Returns a user profile by IDYes
companyMembers(companyId: ID!)Lists users belonging to a companyYes

Companies

QueryDescriptionAuth Required
company(id: ID!)Returns a single company by IDYes
companiesLists companies the current user belongs toYes
allRolesLists all 8 platform roles (Super Admin, Company Admin, Internal Sales, Recruiter/HR, External Sales, Economy, Auditor/Viewer, support)Yes
roleById(id: ID!)Returns a single role by ID with its permissionsYes
roleByName(name: String!)Returns a single role by name with its permissionsYes

Jobs

QueryDescriptionAuth Required
allJobsLists all jobs accessible to the current userYes
job(id: ID!)Returns a single job by IDYes

Talents

QueryDescriptionAuth Required
talentsLists talents accessible to the current userYes
talent(id: ID!)Returns a single talent by IDYes
companyTalents(companyId: String!)Lists talents associated with a companyYes

Candidates

QueryDescriptionAuth Required
candidatesLists candidates accessible to the current userYes
companyCandidates(companyId: String!)Lists candidates across company jobsYes

Pipelines

QueryDescriptionAuth Required
companyPipelinesLists pipelines for the current user's companyYes
pipeline(id: ID!)Returns a single pipeline with itemsYes

Contacts

QueryDescriptionAuth Required
contactsLists contacts accessible to the current userYes
contactsByCompany(companyId: ID!, query: ContactsQueryInput)Lists contacts for a specific companyYes

Notifications

QueryDescriptionAuth Required
myNotifications(input: GetNotificationsInput)Lists user notificationsYes
unreadNotificationCount(companyId: ID)Returns count of unread notificationsYes

Billing

QueryDescriptionAuth Required
creditBalanceReturns current credit balance for the user/company contextYes
creditTransactions(filter: CreditTransactionsFilterInput)Lists credit transaction historyYes
creditPacksLists available credit packs for purchaseYes
plansLists all available subscription plansYes
activeSubscriptionReturns active subscription for the current contextYes
planUsageSummaryReturns usage against plan limits for the current contextYes

Meetings

QueryDescriptionAuth Required
myMeetings(input: ListMeetingsInput)Lists the current user's meetingsYes
companyMeetings(input: ListCompanyMeetingsInput!)Lists meetings for a companyYes
upcomingMeetings(limit: Int)Lists upcoming meetings (default 10)Yes
pastMeetings(limit: Int)Lists past meetings (default 20)Yes
meeting(id: ID!)Returns a single meeting with detailsYes

Admin (Super Admin Only)

QueryDescriptionAuth Required
adminPlatformOverviewAggregate platform statisticsSuper Admin
adminUserStatisticsUser growth and engagement statsSuper Admin
adminRevenueStatisticsRevenue and billing statsSuper Admin

The admin module provides 15+ statistical queries covering user activity, billing, system health, and more. All admin queries require the SuperAdmin role.

Mutations

Authentication

MutationDescriptionAuth Required
signUp(input: SignUpsInput!)Register a new user accountNo
signIn(input: SignInInput!)Authenticate and receive JWT (AuthPayload)No
requestPasswordReset(input: RequestPasswordResetInput!)Initiate password reset flowNo
resetPassword(input: ResetPasswordInput!)Complete password resetNo

Jobs

MutationDescriptionAuth Required
createJob(input: CreateJobInput!)Create a new job postingYes
updateJob(id: ID!, input: UpdateJobInput!)Update an existing jobYes
removeJob(id: ID!)Soft-delete a jobYes

Candidates

MutationDescriptionAuth Required
createCandidate(input: CreateCandidateInput!)Add a talent as a candidate to a jobYes
updateCandidate(id: ID!, input: UpdateCandidateInput!)Update candidate status or detailsYes

Pipelines

MutationDescriptionAuth Required
createPipeline(input: CreatePipelineInput!)Create a new recruitment pipelineYes
createPipelineItem(input: CreatePipelineItemInput!)Add a candidate to a pipeline stageYes
updatePipelineItem(id: ID!, input: UpdatePipelineItemInput!)Move a candidate between stagesYes

Billing

MutationDescriptionAuth Required
startSubscriptionCheckout(input: CheckoutInput!)Initiate Stripe checkout for a planYes
purchaseCreditPack(input: PurchaseCreditPackInput!)Purchase a credit pack via StripeYes
transferCredits(input: TransferCreditsInput!)Transfer credits from user to company balanceYes

Meetings

MutationDescriptionAuth Required
createMeeting(input: CreateMeetingInput!)Schedule a new meetingYes
updateMeeting(id: ID!, input: UpdateMeetingInput!)Update meeting detailsYes

Contacts

MutationDescriptionAuth Required
createContact(input: CreateContactInput!)Create a new contactYes
updateContact(id: ID!, input: UpdateContactInput!)Update contact detailsYes

Admin (Super Admin Only)

MutationDescriptionAuth Required
adminAssignSubscription(input: AdminAssignSubscriptionInput!)Manually assign a subscription to a companySuper Admin
adminGrantCredits(input: AdminGrantCreditsInput!)Grant credits to a user or companySuper Admin
adminDeleteUser(id: ID!)Soft-delete a user accountSuper Admin
adminBulkDeleteUsers(ids: [ID!]!)Bulk soft-delete (max 50 users)Super Admin

Subscriptions

The Backend exposes five GraphQL subscriptions, all using the graphql-ws protocol over WebSocket.

notificationCreated

Emits real-time notifications filtered by the authenticated user's ID.

subscription {
notificationCreated {
id
type
title
message
status
category
createdAt
}
}

unreadCountChanged

Emits updated unread notification counts, optionally filtered by company.

subscription {
unreadCountChanged(companyId: "optional-company-id") {
count
}
}

messageReceived

Emits real-time updates for new, edited, or deleted messages in conversations.

subscription {
messageReceived {
id
content
conversationId
sender { id firstName lastName }
createdAt
}
}

unreadMessageCountChanged

Emits updated unread message counts across conversations.

subscription {
unreadMessageCountChanged {
count
}
}

logStream

Available to super admins only. Streams live system logs for deployment diagnostics.

subscription {
logStream {
level
message
timestamp
metadata
}
}

Error Handling

The API returns structured GraphQL errors with extension codes. Common error codes and their meanings:

CodeHTTP EquivalentDescription
UNAUTHENTICATED401Missing or invalid JWT token
FORBIDDEN403Insufficient permissions for the requested operation
BAD_USER_INPUT400Invalid input data or validation failure
PLAN_LIMIT_EXCEEDED403Operation exceeds current subscription plan limits
NOT_FOUND404Requested resource does not exist
INTERNAL_SERVER_ERROR500Unexpected server error

Example error response:

{
"errors": [
{
"message": "Job posting limit reached for your current plan",
"extensions": {
"code": "PLAN_LIMIT_EXCEEDED",
"planLimit": 10,
"currentUsage": 10
}
}
]
}

Plan Limit Enforcement

Certain mutations are guarded by the @CheckPlanLimit decorator, which validates the operation against the company's active subscription plan. Plan limits use the following convention:

  • -1: Unlimited access
  • 0: Feature disabled
  • > 0: Specific numeric limit

When a plan limit is exceeded, the API returns a PLAN_LIMIT_EXCEEDED error with details about the current limit and usage.