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

# Enter protocol referral code

> 
    Enter a referral code to establish a referral relationship.
    The code owner becomes your referrer for protocol-level benefits.

    Using a referral code gives you a 4% cashback on your trading fees.

    Restrictions:
    - Can only enter one referral code per account
    - Cannot refer yourself
    - Referral code must be active
  



## OpenAPI

````yaml post /enter-referral-code
openapi: 3.0.3
info:
  title: Token Layer API
  version: 1.0.0
  description: |2-

          Token Layer is an omnichain token trading platform where users can create and trade tokens across multiple chains.

          This API provides comprehensive access to token operations, trading, earnings,
          blockchain transactions, and portfolio management.

          ## Base URL
          All endpoints are accessed via: `https://api.tokenlayer.network/{endpoint}`

          ## Authentication
          Most endpoints require authentication using an JWT token or API key passed as a Bearer token in the Authorization header.

          ## Rate Limiting
          API calls are rate limited per user. Please implement appropriate backoff strategies.
        
  contact:
    name: Token Layer API Support
    url: https://app.tokenlayer.network
servers:
  - url: https://api.tokenlayer.network/functions/v1
    description: Production server
  - url: https://api.tokenlayer.network/functions/v1
    description: Staging server
security: []
tags:
  - name: Tokens
    description: Token creation, browsing, search, trading, and price operations
  - name: Transactions
    description: Blockchain transactions (send, tip, ownership checks)
paths:
  /enter-referral-code:
    post:
      tags:
        - Referrals
      summary: Enter protocol referral code
      description: |2-

            Enter a referral code to establish a referral relationship.
            The code owner becomes your referrer for protocol-level benefits.

            Using a referral code gives you a 4% cashback on your trading fees.

            Restrictions:
            - Can only enter one referral code per account
            - Cannot refer yourself
            - Referral code must be active
          
      operationId: enterReferralCode
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EnterReferralCodeRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnterReferralCodeResponse'
        '400':
          description: Bad request - Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized - Invalid or missing authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not found - Resource does not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Response 409
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - BearerAuth: []
components:
  schemas:
    EnterReferralCodeRequest:
      type: object
      properties:
        referral_code:
          type: string
          description: The referral code to enter
          example: alice2025
        network_mode:
          type: string
          enum:
            - testnet
            - mainnet
            - both
          default: mainnet
          description: Network mode for this referral code
          example: mainnet
      required:
        - referral_code
    EnterReferralCodeResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        referrer_code:
          type: string
          description: The referral code that was entered
          example: alice2025
        message:
          type: string
          description: Success message
          example: Referral code successfully applied
      required:
        - success
        - referrer_code
        - message
    Error:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: string
      required:
        - success
        - error
      description: Error response
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token or API key

````