Skip to main content
The Opigno Enterprise API provides queries retrieve the available achievements information, along with the user’s current earning status. Each badge represents a specific goal or condition that a user may fulfill such as completing an action, reaching a defined threshold, or maintaining a certain level of engagement.

Data Structure

Badge

An achievement object that might be earned by user.
FieldTypeDescription
idID!The Badge entity ID.
titleString!The title of the Badge.
pictureMediaImage!MediaImage object representing the Badge picture.
statusBadgeStatus!The status of the badge.
earned(format: String)StringA string showing the badge earning time, formatted according to the optional format argument (default: d/m/Y). Empty if the badge status is not EARNED.
earningCriteriaBadgeEarningCriteria!An earning criteria definition for the badge.

BadgeEarningCriteria

A union of available criteria types that describes a condition for badge earning

BadgeEarningCriteriaLpComplete

Represents criteria for badge earning by Learning Path accomplishment.
FieldTypeDescription
learningPathIdID!The Learning Path ID required to accomplish.

BadgeEarningCriteriaLpPassed

Represents criteria for badge earning by successful Learning Path accomplishment.
FieldTypeDescription
learningPathIdID!The Learning Path ID required to successfully accomplish.

BadgeEarningCriteriaLpEnroll

Represents criteria for badge earning by Learning Path enrollment.
FieldTypeDescription
learningPathIdID!The Learning Path ID required for enrollment.

BadgeEarningCriteriaSocialConnection

Represents criteria for badge earning by reaching the required number of established social connections.
FieldTypeDescription
thresholdInt!The number of connections required to be established.
currentThresholdInt!The number of social connections already established.
periodIntOptional period parameter. If specified, the badge can be earned only if the threshold has been reached within the number of seconds defined by this period.

BadgeEarningCriteriaSocialEngagement

Represents criteria for badge earning based on the total number of social posts created.
FieldTypeDescription
thresholdInt!The number of social posts required to be created.
currentThresholdInt!The number of social posts already created.

BadgeEarningCriteriaRegisteredFor

Represents criteria for badge earning based on the user’s registration duration, requiring the user account to exist for a specified period of time.
FieldTypeDescription
thresholdInt!The number of seconds the user account must exist.
currentThresholdInt!The number of seconds the user account has already existed.

Queries

getBadge

This query is used to retrieve a single badge information.
  • You must have AUTHENTICATED scope to access badges. Anonymous users cannot retrieve badges data.
  • The API user context must be present and valid - otherwise, access is denied.
The following arguments can be used in the query:
ArgumentTypeDescription
badgeIdIDThe badge entity ID.
userContextIdIDThe user context ID. If omitted, the user context from the API request will be used.
query getBadges {
  getBadges(
    badgeId: 2,
  ) {
    id
    title
    picture {
      url
    }
    status
    earned(format: "d/m/y")
  }
}

getBadges

This query is used to retrieve the full badges list available and supports cursor-based pagination (after, before) or limit-based (first, last).
  • You must have AUTHENTICATED scope to access badges. Anonymous users cannot retrieve badges data.
  • The API user context must be present and valid - otherwise, access is denied.
The following arguments can be used in the query:
ArgumentTypeDescription
userContextIdIDThe user context ID. If omitted, the user context from the API request will be used.
statusBadgeStatusThe earning status of the badge.
afterCursorReturns the elements that come before the specified cursor.
beforeCursorReturns results that come before the specified cursor. Should be used together with last parameter. Cannot be used if after is set.
firstIntegerReturns up to the first N elements from the list. Required if after parameter is set. Cannot be used together with last.
lastIntegerReturns up to the first N elements from the list. Required if before parameter is set. Cannot be used together with first.
reverseBooleanAllows to change the order of the sorting to DESC.
sortKeyBadgeSortKeySort the underlying list by the given key. By default badges will be sorted by the creation date.
query getBadges {
  getBadges(
    first: 3,
    status: EARNED,
  ) {
    edges {
      node {
        id
        title
        picture {
          url
        }
        status
        earned(format: "d/m/y")
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
    totalItems
  }
}
The getBadges query supports the same advanced features as other catalog queries: Common error scenarios and solutions:
  • 401 Unauthorized: Ensure you’re using a valid authentication token with AUTHENTICATED scope
  • 403 Forbidden: Verify your user account has the necessary permissions to access badges data
  • Missing cursor parameter: When using after, you must also specify first
  • Invalid cursor: Ensure cursor values are valid and not expired
  • Conflicting parameters: Don’t use both first/after and last/before together