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

# Create company token transaction

> Create a token transaction to add, subtract, or transfer tokens for a member within a company.

Required permissions:
 - `company_token_transaction:create`
 - `member:basic:read`
 - `company:basic:read`



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/whopsdk/openapi.documented.yml post /company_token_transactions
openapi: 3.1.0
info:
  title: Whop API
  description: >-
    The Whop REST API. Please see
    https://docs.whop.com/developer/api/getting-started for more details.
  termsOfService: https://whop.com/tos-developer-api/
  version: 1.0.0
servers:
  - url: https://api.whop.com/api/v1
    description: Production Whop API
security: []
tags:
  - name: Products
    description: Products
  - name: Plans
    description: Plans
  - name: Payments
    description: Payments
  - name: Refunds
    description: Refunds
  - name: Disputes
    description: Disputes
  - name: Dispute alerts
    description: Dispute alerts
  - name: Resolution center cases
    description: Resolution center cases
  - name: Checkout configurations
    description: Checkout configurations
  - name: Setup intents
    description: Setup intents
  - name: Payment methods
    description: Payment methods
  - name: Invoices
    description: Invoices
  - name: Promo codes
    description: Promo codes
  - name: Card transactions
    description: Card transactions
  - name: Ledger accounts
    description: Ledger accounts
  - name: Transfers
    description: Transfers
  - name: Withdrawals
    description: Withdrawals
  - name: Payout methods
    description: Payout methods
  - name: Verifications
    description: Verifications
  - name: Payout accounts
    description: Payout accounts
  - name: Topups
    description: Topups
  - name: Users
    description: Users
  - name: Companies
    description: Companies
  - name: Authorized users
    description: Authorized users
  - name: Fee markups
    description: Fee markups
  - name: Members
    description: Members
  - name: Memberships
    description: Memberships
  - name: Leads
    description: Leads
  - name: Entries
    description: Entries
  - name: Shipments
    description: Shipments
  - name: Reviews
    description: Reviews
  - name: Company token transactions
    description: Company token transactions
  - name: Affiliates
    description: Affiliates
  - name: Experiences
    description: Experiences
  - name: Forums
    description: Forums
  - name: Forum posts
    description: Forum posts
  - name: Chat channels
    description: Chat channels
  - name: Support channels
    description: Support channels
  - name: Messages
    description: Messages
  - name: Reactions
    description: Reactions
  - name: Dm members
    description: Dm members
  - name: Dm channels
    description: Dm channels
  - name: Notifications
    description: Notifications
  - name: Courses
    description: Courses
  - name: Course chapters
    description: Course chapters
  - name: Course lessons
    description: Course lessons
  - name: Course students
    description: Course students
  - name: Course lesson interactions
    description: Course lesson interactions
  - name: Apps
    description: Apps
  - name: Webhooks
    description: Webhooks
  - name: App builds
    description: App builds
  - name: Access tokens
    description: Access tokens
  - name: Account links
    description: Account links
  - name: Files
    description: Files
  - name: Ai chats
    description: Ai chats
  - name: Bounties
    description: Bounties
  - name: Stats
    description: Stats
  - name: Ad campaigns
    description: Ad campaigns
  - name: Ad groups
    description: Ad groups
  - name: Ads
    description: Ads
  - name: Conversions
    description: Conversions
paths:
  /company_token_transactions:
    post:
      tags:
        - Company token transactions
      summary: Create company token transaction
      description: >-
        Create a token transaction to add, subtract, or transfer tokens for a
        member within a company.


        Required permissions:
         - `company_token_transaction:create`
         - `member:basic:read`
         - `company:basic:read`
      operationId: createCompanyTokenTransaction
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  properties:
                    amount:
                      type: number
                      description: >-
                        The positive number of tokens to transact. For example,
                        100.0 for 100 tokens.
                      example: 6.9
                    company_id:
                      type: string
                      description: >-
                        The unique identifier of the company to create the
                        transaction in, starting with 'biz_'.
                      example: biz_xxxxxxxxxxxxxx
                    description:
                      type:
                        - string
                        - 'null'
                      description: >-
                        A human-readable description of why the transaction was
                        created.
                    destination_user_id:
                      type: string
                      description: >-
                        The unique identifier of the user receiving the tokens.
                        Required when the transaction type is 'transfer'.
                    idempotency_key:
                      type:
                        - string
                        - 'null'
                      description: >-
                        A unique key to prevent duplicate transactions. Use a
                        UUID or similar unique string.
                    transaction_type:
                      type: string
                      const: transfer
                    user_id:
                      type: string
                      description: >-
                        The unique identifier of the user whose token balance
                        will be affected, starting with 'user_'.
                      example: user_xxxxxxxxxxxxx
                  required:
                    - amount
                    - company_id
                    - transaction_type
                    - user_id
                    - destination_user_id
                  description: Autogenerated input type of CreateCompanyTokenTransaction
                  title: CreateCompanyTokenTransactionInputTransactionTypeTransfer
                - type: object
                  properties:
                    amount:
                      type: number
                      description: >-
                        The positive number of tokens to transact. For example,
                        100.0 for 100 tokens.
                      example: 6.9
                    company_id:
                      type: string
                      description: >-
                        The unique identifier of the company to create the
                        transaction in, starting with 'biz_'.
                      example: biz_xxxxxxxxxxxxxx
                    description:
                      type:
                        - string
                        - 'null'
                      description: >-
                        A human-readable description of why the transaction was
                        created.
                    idempotency_key:
                      type:
                        - string
                        - 'null'
                      description: >-
                        A unique key to prevent duplicate transactions. Use a
                        UUID or similar unique string.
                    transaction_type:
                      type: string
                      const: add
                    user_id:
                      type: string
                      description: >-
                        The unique identifier of the user whose token balance
                        will be affected, starting with 'user_'.
                      example: user_xxxxxxxxxxxxx
                  required:
                    - amount
                    - company_id
                    - transaction_type
                    - user_id
                  description: Autogenerated input type of CreateCompanyTokenTransaction
                  title: CreateCompanyTokenTransactionInputTransactionTypeAdd
                - type: object
                  properties:
                    amount:
                      type: number
                      description: >-
                        The positive number of tokens to transact. For example,
                        100.0 for 100 tokens.
                      example: 6.9
                    company_id:
                      type: string
                      description: >-
                        The unique identifier of the company to create the
                        transaction in, starting with 'biz_'.
                      example: biz_xxxxxxxxxxxxxx
                    description:
                      type:
                        - string
                        - 'null'
                      description: >-
                        A human-readable description of why the transaction was
                        created.
                    idempotency_key:
                      type:
                        - string
                        - 'null'
                      description: >-
                        A unique key to prevent duplicate transactions. Use a
                        UUID or similar unique string.
                    transaction_type:
                      type: string
                      const: subtract
                    user_id:
                      type: string
                      description: >-
                        The unique identifier of the user whose token balance
                        will be affected, starting with 'user_'.
                      example: user_xxxxxxxxxxxxx
                  required:
                    - amount
                    - company_id
                    - transaction_type
                    - user_id
                  description: Autogenerated input type of CreateCompanyTokenTransaction
                  title: CreateCompanyTokenTransactionInputTransactionTypeSubtract
              type: object
              description: Parameters for CreateCompanyTokenTransaction
      responses:
        '200':
          description: A successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompanyTokenTransaction'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      message:
                        type: string
                      code:
                        type:
                          - string
                          - 'null'
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                      param:
                        type:
                          - string
                          - 'null'
                        description: The parameter that caused the error, if applicable
                    required:
                      - type
                      - message
                required:
                  - error
              example:
                error:
                  type: invalid_request_error
                  code: parameter_missing
                  message: 'Missing required parameter: amount.'
                  param: amount
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      message:
                        type: string
                      code:
                        type:
                          - string
                          - 'null'
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                      param:
                        type:
                          - string
                          - 'null'
                        description: The parameter that caused the error, if applicable
                    required:
                      - type
                      - message
                required:
                  - error
              example:
                error:
                  type: unauthorized
                  message: Invalid or missing API key
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      message:
                        type: string
                      code:
                        type:
                          - string
                          - 'null'
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                      param:
                        type:
                          - string
                          - 'null'
                        description: The parameter that caused the error, if applicable
                    required:
                      - type
                      - message
                required:
                  - error
              example:
                error:
                  type: forbidden
                  message: You do not have permission to access this resource
        '404':
          description: Not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      message:
                        type: string
                      code:
                        type:
                          - string
                          - 'null'
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                      param:
                        type:
                          - string
                          - 'null'
                        description: The parameter that caused the error, if applicable
                    required:
                      - type
                      - message
                required:
                  - error
              example:
                error:
                  type: not_found
                  message: Resource not found
        '422':
          description: Verification required
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      message:
                        type: string
                      code:
                        type:
                          - string
                          - 'null'
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                      param:
                        type:
                          - string
                          - 'null'
                        description: The parameter that caused the error, if applicable
                    required:
                      - type
                      - message
                required:
                  - error
              example:
                error: null
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      message:
                        type: string
                      code:
                        type:
                          - string
                          - 'null'
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                      param:
                        type:
                          - string
                          - 'null'
                        description: The parameter that caused the error, if applicable
                    required:
                      - type
                      - message
                required:
                  - error
              example:
                error:
                  type: internal_server_error
                  message: An unexpected error occurred
      security:
        - bearerAuth:
            - company_token_transaction:create
            - member:basic:read
            - company:basic:read
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Whop from '@whop/sdk';


            const client = new Whop({
              apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
            });


            const companyTokenTransaction = await
            client.companyTokenTransactions.create({
              amount: 6.9,
              company_id: 'biz_xxxxxxxxxxxxxx',
              destination_user_id: 'destination_user_id',
              transaction_type: 'transfer',
              user_id: 'user_xxxxxxxxxxxxx',
            });


            console.log(companyTokenTransaction.id);
        - lang: Python
          source: >-
            import os

            from whop_sdk import Whop


            client = Whop(
                api_key=os.environ.get("WHOP_API_KEY"),  # This is the default and can be omitted
            )

            company_token_transaction =
            client.company_token_transactions.create(
                amount=6.9,
                company_id="biz_xxxxxxxxxxxxxx",
                destination_user_id="destination_user_id",
                transaction_type="transfer",
                user_id="user_xxxxxxxxxxxxx",
            )

            print(company_token_transaction.id)
        - lang: Ruby
          source: |-
            require "whop_sdk"

            whop = WhopSDK::Client.new(api_key: "My API Key")

            company_token_transaction = whop.company_token_transactions.create(
              body: {
                amount: 6.9,
                company_id: "biz_xxxxxxxxxxxxxx",
                destination_user_id: "destination_user_id",
                transaction_type: :transfer,
                user_id: "user_xxxxxxxxxxxxx"
              }
            )

            puts(company_token_transaction)
components:
  schemas:
    CompanyTokenTransaction:
      type: object
      properties:
        id:
          type: string
          description: The unique identifier for the company token transaction.
        transaction_type:
          $ref: '#/components/schemas/CompanyTokenTransactionTypes'
          description: >-
            The direction of this token transaction (add, subtract, or
            transfer).
        amount:
          type: number
          description: >-
            The token amount for this transaction. Always a positive value
            regardless of transaction type.
          example: 6.9
        description:
          type:
            - string
            - 'null'
          description: >-
            Free-text description explaining the reason for this token
            transaction. Null if no description was provided.
          example: Reward for completing onboarding
        created_at:
          type: string
          format: date-time
          description: The datetime the company token transaction was created.
          example: '2023-12-01T05:00:00.401Z'
        linked_transaction_id:
          type:
            - string
            - 'null'
          description: >-
            The ID of the corresponding transaction on the other side of a
            transfer. Null if this is not a transfer transaction.
        idempotency_key:
          type:
            - string
            - 'null'
          description: >-
            A unique key used to prevent duplicate transactions when retrying
            API requests. Null if no idempotency key was provided.
          example: txn_reward_usr_123_2024
        user:
          type: object
          properties:
            id:
              type: string
              description: The unique identifier for the user.
              example: user_xxxxxxxxxxxxx
            name:
              type:
                - string
                - 'null'
              description: The user's display name shown on their public profile.
              example: John Doe
            username:
              type: string
              description: The user's unique username shown on their public profile.
              example: johndoe42
          required:
            - id
            - name
            - username
          description: The user whose token balance was affected by this transaction.
        member:
          type: object
          properties:
            id:
              type: string
              description: The unique identifier for the company member.
          required:
            - id
          description: The member whose token balance was affected by this transaction.
        company:
          type: object
          properties:
            id:
              type: string
              description: The unique identifier for the company.
              example: biz_xxxxxxxxxxxxxx
            title:
              type: string
              description: The written name of the company.
            route:
              type: string
              description: The slug/route of the company on the Whop site.
          required:
            - id
            - title
            - route
          description: The company whose token balance this transaction affects.
      required:
        - id
        - transaction_type
        - amount
        - description
        - created_at
        - linked_transaction_id
        - idempotency_key
        - user
        - member
        - company
      description: >-
        A token transaction records a credit or debit to a member's token
        balance within a company, including transfers between members.
    CompanyTokenTransactionTypes:
      type: string
      enum:
        - add
        - subtract
        - transfer
      description: The type of token transaction
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        A company API key, company scoped JWT, app API key, or user OAuth token.
        You must prepend your key/token with the word 'Bearer', which will look
        like `Bearer ***************************`
      scheme: bearer
      bearerFormat: auth-scheme

````