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

# Transfer Float

> Transfer float from super-agent to sub-agent

<Info>
  Allows super-agents to transfer float balance to their sub-agents.
</Info>

## Request

<ParamField header="Authorization" type="string" required>
  `Bearer olive_live_xxx` or `Bearer eyJ...` (JWT)
</ParamField>

### Body Parameters

<ParamField body="from_agent_id" type="string" required>
  Source agent (super-agent) UUID
</ParamField>

<ParamField body="to_agent_id" type="string" required>
  Destination agent (sub-agent) UUID
</ParamField>

<ParamField body="amount" type="string" required>
  Amount to transfer
</ParamField>

<ParamField body="pin" type="string" required>
  Source agent's 4-digit PIN
</ParamField>

<ParamField body="description" type="string">
  Transfer description
</ParamField>

***

## Response

<ResponseField name="success" type="boolean">
  Whether transfer succeeded
</ResponseField>

<ResponseField name="transaction_id" type="string">
  Transfer transaction ID
</ResponseField>

<ResponseField name="from_balance" type="string">
  Super-agent's new balance
</ResponseField>

<ResponseField name="to_balance" type="string">
  Sub-agent's new balance
</ResponseField>

***

## Examples

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://demo.api.vultlocal.com/api/v1/agents/transfer" \
    -H "Authorization: Bearer olive_live_xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "from_agent_id": "agent_abc123",
      "to_agent_id": "agent_xyz789",
      "amount": "100000.00",
      "pin": "1234",
      "description": "Daily float allocation"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 Success theme={null}
  {
    "success": true,
    "message": "Float transferred successfully",
    "transaction_id": "txn_transfer_abc123",
    "amount": "100,000.00 SLE",
    "from_balance": "1,400,000.00 SLE",
    "to_balance": "600,000.00 SLE"
  }
  ```

  ```json 400 Insufficient Balance theme={null}
  {
    "success": false,
    "error": "Insufficient float balance",
    "code": "INSUFFICIENT_FLOAT",
    "available": 50000,
    "required": 100000
  }
  ```

  ```json 403 Not Sub-Agent theme={null}
  {
    "error": "Target agent is not your sub-agent",
    "code": "FORBIDDEN"
  }
  ```
</ResponseExample>

***

## Rules

<CardGroup cols={2}>
  <Card title="Hierarchy" icon="sitemap">
    Only super-agent to own sub-agent transfers
  </Card>

  <Card title="Balance Check" icon="coins">
    Source must have sufficient float
  </Card>
</CardGroup>

***

## Errors

| Status | Code                 | Description                      |
| ------ | -------------------- | -------------------------------- |
| 400    | `INVALID_AMOUNT`     | Invalid amount format            |
| 400    | `INVALID_PIN`        | PIN verification failed          |
| 400    | `INSUFFICIENT_FLOAT` | Insufficient balance             |
| 401    | `UNAUTHORIZED`       | Invalid API key                  |
| 403    | `FORBIDDEN`          | Not authorized for this transfer |
| 404    | `NOT_FOUND`          | Agent not found                  |
| 500    | `INTERNAL_ERROR`     | Server error                     |


## OpenAPI

````yaml olive-openapi.json POST /agents/transfer
openapi: 3.0.0
info:
  description: >-
    API Gateway for OLIVE NFC Card Payment System - Comprehensive payment, card
    management, agent operations, and admin authentication. All /api/v1 routes
    require authentication using either API Key or JWT token.
  title: OLIVE NFC Card Payment API
  termsOfService: http://swagger.io/terms/
  contact:
    name: API Support
    email: support@olive.sl
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.0
servers:
  - url: https://olive-gateway-a6ba.onrender.com/api/v1
security: []
paths:
  /agents/transfer:
    post:
      tags:
        - Agents
      summary: Transfer float to sub-agent
      description: >-
        Super-agent transfers float to their sub-agent. Super-agent ID is
        auto-detected from logged-in user. Admin can specify super_agent_id.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/handler.TransferToSubAgentRequest'
        description: Transfer details
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
        - ApiKeyAuth: []
        - BearerAuth: []
components:
  schemas:
    handler.TransferToSubAgentRequest:
      type: object
      required:
        - amount
        - sub_agent_id
      properties:
        amount:
          type: integer
        sub_agent_id:
          type: string
        super_agent_id:
          description: Optional - auto-detected from logged-in user if not provided
          type: string
  securitySchemes:
    ApiKeyAuth:
      description: >-
        API Key for third-party integrations (WhatsApp, Smart PAY, VULT).
        Format: 'Bearer olive_live_xxxxxxxxxxxxx'
      type: apiKey
      name: Authorization
      in: header
    BearerAuth:
      description: >-
        JWT token from admin login for administrative operations. Format:
        'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
      type: apiKey
      name: Authorization
      in: header

````