openapi: 3.2.0 info: title: Forem API V1 Badge Achievements API version: 1.0.0 description: Access Forem articles, users and other resources via API. servers: - url: https://dev.to description: Production server security: - api-key: [] - bearer_auth: [] tags: - name: badge_achievements paths: /api/badge_achievements: get: summary: Retrieve all badge achievements tags: - badge_achievements description: Retrieve a list of all badge achievements (awarded badges) in the system. Requires administrator privileges. parameters: - name: page in: query required: false description: Pagination page index. schema: type: integer responses: '200': description: successful content: application/json: schema: type: array items: $ref: '#/components/schemas/BadgeAchievement' operationId: getApiBadgeAchievements x-operation-id-source: derived post: summary: Create a badge achievement tags: - badge_achievements description: 'Award a badge to a user. Requires administrator privileges. ### Integration Tips: - **user_id**: The numeric ID of the user receiving the badge. - **badge_id**: The numeric ID of the badge being awarded. - **rewarding_context_message_markdown**: Optional personalized message shown in the notification or profile feed to explain why the user was awarded the badge. - **metadata**: Optional key/value data stored with the achievement for context. - If the badge cannot be awarded more than once and the user already holds it, the request is rejected with `409 Conflict`, and the conflicting `achievement_id` is included in the response. A `422` is returned for other request errors.' parameters: [] responses: '201': description: created content: application/json: schema: $ref: '#/components/schemas/BadgeAchievement' '409': description: conflict content: application/json: schema: type: object properties: errors: type: array items: type: string achievement_id: type: integer description: ID of the conflicting achievement awarding the badge to the user. required: - errors - achievement_id '422': description: unprocessable requestBody: content: application/json: schema: type: object properties: badge_achievement: type: object properties: user_id: type: integer badge_id: type: integer rewarding_context_message_markdown: type: string include_default_description: type: boolean metadata: type: object additionalProperties: true required: - user_id - badge_id description: Badge achievement details. operationId: postApiBadgeAchievements x-operation-id-source: derived /api/badge_achievements/{id}: get: summary: Retrieve a badge achievement's details tags: - badge_achievements description: Retrieve details of a specific badge award/achievement by ID. parameters: - name: id in: path required: true description: Badge achievement unique ID. schema: type: integer responses: '200': description: successful content: application/json: schema: $ref: '#/components/schemas/BadgeAchievement' operationId: getApiBadgeAchievementsById x-operation-id-source: derived delete: summary: Delete a badge achievement tags: - badge_achievements description: Revoke a badge award by deleting the badge achievement. Requires administrator privileges. parameters: - name: id in: path required: true description: Badge achievement unique ID to delete. schema: type: integer responses: '204': description: no content operationId: deleteApiBadgeAchievementsById x-operation-id-source: derived components: schemas: BadgeAchievement: description: Representation of a badge achievement type: object properties: id: type: integer format: int64 user_id: type: integer format: int64 badge_id: type: integer format: int64 rewarding_context_message_markdown: type: - string - 'null' include_default_description: type: boolean metadata: type: object description: Key/value data supplied for context additionalProperties: true created_at: type: string format: date-time updated_at: type: string format: date-time required: - id - user_id - badge_id - created_at - updated_at securitySchemes: api-key: type: apiKey name: api-key in: header description: "API Key authentication.\n\nAuthentication for some endpoints, like write operations on the\nArticles API require a DEV API key.\n\nAll authenticated endpoints are CORS disabled, the API key is intended for non-browser scripts.\n\n### Getting an API key\n\nTo obtain one, please follow these steps:\n\n - visit https://dev.to/settings/extensions\n - in the \"DEV API Keys\" section create a new key by adding a\n description and clicking on \"Generate API Key\"\n\n ![obtain a DEV API Key](https://user-images.githubusercontent.com/37842/172718105-bd93664e-76e0-477d-99c4-265dda0b06c5.png)\n\n - You'll see the newly generated key in the same view\n ![generated DEV API Key](https://user-images.githubusercontent.com/37842/172718151-e7fe26a0-9937-42e8-96c6-333acdab9e49.png)" bearer_auth: type: http scheme: bearer bearerFormat: JWT description: Short-lived RS256 RFC 9068 access token issued by the configured delegation service and verified against its configured JWKS. The issuer authorizes the client and requested operation before minting the token; Forem validates the token and resolves its subject and owner to a local user. An invalid token returns 401; an unavailable trust dependency with no usable cached key returns 503.