> ## 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.

# Add Rule Contact

> Name a contact on a playlist rule.

The rule must carry a ``named_contact`` condition, and the contact must belong
to this team. A contact already named is a 409.



## OpenAPI

````yaml /openapi/mio-openapi.json post /api/v1/teams/{team_id}/hubs/{hub_id}/access-rules/{rule_id}/contacts
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}/access-rules/{rule_id}/contacts:
    post:
      tags:
        - access-rules-admin
      summary: Add Rule Contact
      description: >-
        Name a contact on a playlist rule.


        The rule must carry a ``named_contact`` condition, and the contact must
        belong

        to this team. A contact already named is a 409.
      operationId: >-
        access_rules_admin.post_access_rules_admin_post_teams_by_team_id_hubs_by_hub_id_access_rules_by_rule_id_contacts
      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: rule_id
          required: true
          schema:
            title: Rule Id
            type: string
      requestBody:
        content:
          application/vnd.api+json:
            schema:
              $ref: '#/components/schemas/RuleContactCreateEnvelope'
        required: true
      responses:
        '201':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/RuleContactResponse'
          description: Successful Response
        '400':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Validation error
        '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
        '409':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Conflict (duplicate rule for target)
        '422':
          content:
            application/vnd.api+json:
              schema:
                $ref: '#/components/schemas/JsonApiErrorResponse'
          description: Unprocessable entity
      security:
        - HTTPBearer: []
components:
  schemas:
    RuleContactCreateEnvelope:
      additionalProperties: false
      properties:
        data:
          $ref: '#/components/schemas/RuleContactCreateResource'
      required:
        - data
      title: RuleContactCreateEnvelope
      type: object
    RuleContactResponse:
      additionalProperties: false
      properties:
        data:
          $ref: '#/components/schemas/RuleContactResource'
      required:
        - data
      title: RuleContactResponse
      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
    RuleContactCreateResource:
      additionalProperties: false
      properties:
        attributes:
          $ref: '#/components/schemas/RuleContactCreateAttributes'
        type:
          const: access_rule_contacts
          title: Type
          type: string
      required:
        - type
        - attributes
      title: RuleContactCreateResource
      type: object
    RuleContactResource:
      additionalProperties: false
      properties:
        attributes:
          $ref: '#/components/schemas/RuleContactAttributes'
        id:
          title: Id
          type: string
        type:
          const: access_rule_contacts
          default: access_rule_contacts
          title: Type
          type: string
      required:
        - id
        - attributes
      title: RuleContactResource
      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
    RuleContactCreateAttributes:
      additionalProperties: false
      properties:
        contact_id:
          maxLength: 36
          minLength: 1
          title: Contact Id
          type: string
      required:
        - contact_id
      title: RuleContactCreateAttributes
      type: object
    RuleContactAttributes:
      additionalProperties: false
      properties:
        access_rule_id:
          title: Access Rule Id
          type: string
        contact_id:
          title: Contact Id
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
        first_name:
          anyOf:
            - type: string
            - type: 'null'
          title: First Name
        hub_id:
          title: Hub Id
          type: string
        last_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Name
      required:
        - contact_id
        - access_rule_id
        - hub_id
        - first_name
        - last_name
        - email
        - created_at
      title: RuleContactAttributes
      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.