> ## Documentation Index
> Fetch the complete documentation index at: https://docs.member.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Put Achievement Rule

> Compile the achievement's rule pieces into one segment for this hub
offering.

``confirm=false`` (default) previews only — nothing is persisted;
``meta.preview_count`` carries the qualifying-members estimate
(``meta.preview_count_is_lower_bound=true`` above the preview page cap).
``confirm=true`` persists: 201 on the initial bind, 200 on a re-PUT
recompile (e.g. clearing a broken/drifted rule).



## OpenAPI

````yaml /openapi/mio-openapi.json put /api/v1/teams/{team_id}/hubs/{hub_id}/achievements/{achievement_id}/rule
openapi: 3.1.0
info:
  description: >-
    Production API reference for Membership.io. Use the authored guides for
    workflows and the generated endpoint pages for exact parameters and schemas.
  title: Membership.io API
  version: 0.1.0
servers:
  - description: Production
    url: https://api.member.dev
security:
  - bearerAuth: []
paths:
  /api/v1/teams/{team_id}/hubs/{hub_id}/achievements/{achievement_id}/rule:
    put:
      tags:
        - achievements-admin
      summary: Put Achievement Rule
      description: |-
        Compile the achievement's rule pieces into one segment for this hub
        offering.

        ``confirm=false`` (default) previews only — nothing is persisted;
        ``meta.preview_count`` carries the qualifying-members estimate
        (``meta.preview_count_is_lower_bound=true`` above the preview page cap).
        ``confirm=true`` persists: 201 on the initial bind, 200 on a re-PUT
        recompile (e.g. clearing a broken/drifted rule).
      operationId: >-
        achievements_admin.put_achievements_admin_put_teams_by_team_id_hubs_by_hub_id_achievements_by_achievement_id_rule
      parameters:
        - in: path
          name: team_id
          required: true
          schema:
            title: Team Id
            type: string
        - in: path
          name: hub_id
          required: true
          schema:
            title: Hub Id
            type: string
        - in: path
          name: achievement_id
          required: true
          schema:
            title: Achievement Id
            type: string
      requestBody:
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/AchievementRulePutEnvelope'
        required: true
      responses:
        '200':
          content:
            application/vnd.api+json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/AchievementRulePreviewResponse'
                  - $ref: >-
                      #/components/schemas/JsonApiResponse_AchievementRuleAttributes_
                title: >-
                  Response Achievements-Admin.Put Teams By Team Id Hubs By Hub
                  Id Achievements By Achievement Id Rule
          description: Successful Response
        '201':
          content:
            application/vnd.api+json:
              schema:
                $ref: >-
                  #/components/schemas/JsonApiResponse_AchievementRuleAttributes_
          description: New rule bind.
        '401':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Not authenticated
        '403':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Forbidden
        '404':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Resource not found
        '415':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Unsupported media type (requires application/vnd.api+json)
        '422':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Unprocessable entity
      security:
        - HTTPBearer: []
components:
  schemas:
    AchievementRulePutEnvelope:
      description: Top-level JSON:API request envelope for PUT .../rule.
      properties:
        data:
          $ref: '#/components/schemas/AchievementRulePutData'
      required:
        - data
      title: AchievementRulePutEnvelope
      type: object
    AchievementRulePreviewResponse:
      description: Top-level response for PUT .../rule?confirm=false — meta only, no data.
      properties:
        meta:
          $ref: '#/components/schemas/AchievementRulePreviewMeta'
      required:
        - meta
      title: AchievementRulePreviewResponse
      type: object
    JsonApiResponse_AchievementRuleAttributes_:
      properties:
        data:
          $ref: '#/components/schemas/JsonApiResource_AchievementRuleAttributes_'
        included:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
          title: Included
        links:
          anyOf:
            - $ref: '#/components/schemas/JsonApiLinks'
            - type: 'null'
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      required:
        - data
      title: JsonApiResponse[AchievementRuleAttributes]
      type: object
    JsonApiErrorResponse:
      description: Error JSON:API response.
      properties:
        errors:
          items:
            $ref: '#/components/schemas/JsonApiError'
          title: Errors
          type: array
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      required:
        - errors
      title: JsonApiErrorResponse
      type: object
    AchievementRulePutData:
      description: JSON:API data envelope for PUT .../rule.
      properties:
        attributes:
          $ref: '#/components/schemas/AchievementRulePutAttributes'
        type:
          title: Type
          type: string
      required:
        - type
      title: AchievementRulePutData
      type: object
    AchievementRulePreviewMeta:
      properties:
        preview_count:
          title: Preview Count
          type: integer
        preview_count_is_lower_bound:
          title: Preview Count Is Lower Bound
          type: boolean
      required:
        - preview_count
        - preview_count_is_lower_bound
      title: AchievementRulePreviewMeta
      type: object
    JsonApiResource_AchievementRuleAttributes_:
      properties:
        attributes:
          $ref: '#/components/schemas/AchievementRuleAttributes'
        id:
          title: Id
          type: string
        links:
          anyOf:
            - $ref: '#/components/schemas/JsonApiLinks'
            - type: 'null'
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
        relationships:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Relationships
        type:
          title: Type
          type: string
      required:
        - id
        - type
        - attributes
      title: JsonApiResource[AchievementRuleAttributes]
      type: object
    JsonApiLinks:
      properties:
        self:
          anyOf:
            - type: string
            - type: 'null'
          title: Self
      title: JsonApiLinks
      type: object
    JsonApiError:
      properties:
        code:
          anyOf:
            - type: string
            - type: 'null'
          title: Code
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
        source:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Source
        status:
          title: Status
          type: string
        title:
          title: Title
          type: string
      required:
        - status
        - title
      title: JsonApiError
      type: object
    AchievementRulePutAttributes:
      properties:
        confirm:
          default: false
          title: Confirm
          type: boolean
        notify_on_backfill:
          default: false
          title: Notify On Backfill
          type: boolean
      title: AchievementRulePutAttributes
      type: object
    AchievementRuleAttributes:
      properties:
        achievement_id:
          title: Achievement Id
          type: string
        backfill_status:
          title: Backfill Status
          type: string
        broken_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Broken Reason
        compiled_definition_version:
          title: Compiled Definition Version
          type: integer
        created_at:
          format: date-time
          title: Created At
          type: string
        hub_id:
          title: Hub Id
          type: string
        is_active:
          title: Is Active
          type: boolean
        notify_on_backfill:
          title: Notify On Backfill
          type: boolean
        rule_state:
          title: Rule State
          type: string
        rule_state_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Rule State Reason
        segment_id:
          title: Segment Id
          type: string
        updated_at:
          format: date-time
          title: Updated At
          type: string
      required:
        - achievement_id
        - hub_id
        - segment_id
        - is_active
        - backfill_status
        - compiled_definition_version
        - notify_on_backfill
        - created_at
        - updated_at
        - rule_state
      title: AchievementRuleAttributes
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT or mio_sk API key
      description: >-
        Send platform JWTs, contact JWTs, or team API keys as `Authorization:
        Bearer <token>`.
      scheme: bearer
      type: http
    HTTPBearer:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.