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

# Creer une transaction

> Soumettez un paiement on-chain via le portefeuille securise par MPC d'un agent.

Soumettez une nouvelle transaction via le portefeuille d'un agent. La transaction passe par le moteur de politiques pour validation, puis est signee via MPC et diffusee sur la blockchain.

## Corps de la requete

<ParamField body="agent_id" type="string" required>
  L'agent dont le portefeuille enverra la transaction.
</ParamField>

<ParamField body="direction" type="string" required>
  Direction de la transaction. Actuellement, seul `outbound` est supporte.
</ParamField>

<ParamField body="type" type="string" required>
  Type de transaction. Valeurs : `transfer`.
</ParamField>

<ParamField body="from_address" type="string">
  Adresse de l'expediteur. Si omise, l'adresse du portefeuille de l'agent est utilisee.
</ParamField>

<ParamField body="to_address" type="string" required>
  Adresse on-chain du destinataire.
</ParamField>

<ParamField body="amount" type="string" required>
  Montant a envoyer sous forme de chaine decimale (par ex., `"10.5"`).
</ParamField>

<ParamField body="token" type="string" required>
  Symbole du jeton (par ex., `USDC`, `USDT`, `ETH`).
</ParamField>

<ParamField body="chain" type="string" required>
  Identifiant de chaine CAIP-2 (par ex., `eip155:84532`).
</ParamField>

<ParamField body="memo" type="string">
  Memo ou chaine de reference optionnel.
</ParamField>

## Reponse

<Expandable title="Champs de la reponse">
  <ParamField body="id" type="string">
    Identifiant unique de la transaction.
  </ParamField>

  <ParamField body="hash" type="string">
    Hash de la transaction on-chain (disponible apres la diffusion).
  </ParamField>

  <ParamField body="status" type="string">
    Statut de la transaction : `pending`, `confirmed`, `failed`.
  </ParamField>

  <ParamField body="amount" type="string">
    Montant envoye.
  </ParamField>

  <ParamField body="token" type="string">
    Symbole du jeton.
  </ParamField>

  <ParamField body="fee" type="string">
    Frais de gas reseau payes.
  </ParamField>

  <ParamField body="created_at" type="string">
    Horodatage ISO 8601.
  </ParamField>
</Expandable>

## Exemple

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.agentwallex.com/api/v1/transactions \
    -H "X-API-Key: awx_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "agent_id": "agent_abc123",
      "direction": "outbound",
      "type": "transfer",
      "to_address": "0xabcdef1234567890abcdef1234567890abcdef12",
      "amount": "10.5",
      "token": "USDC",
      "chain": "eip155:84532",
      "memo": "service payment"
    }'
  ```

  ```typescript TypeScript theme={null}
  const tx = await aw.payments.send({
    agentId: "agent_abc123",
    to: "0xabcdef1234567890abcdef1234567890abcdef12",
    amount: "10.50",
    token: "USDC",
    memo: "service payment",
  });
  ```

  ```python Python theme={null}
  tx = await aw.payments.send(
      agent_id="agent_abc123",
      to="0xabcdef1234567890abcdef1234567890abcdef12",
      amount="10.50",
      token="USDC",
      memo="service payment",
  )
  ```
</CodeGroup>

```json Response theme={null}
{
  "id": "tx_xyz789",
  "hash": "0xabc123def456...",
  "status": "confirmed",
  "amount": "10.5",
  "token": "USDC",
  "fee": "0.001",
  "created_at": "2025-06-15T14:30:00Z"
}
```


## OpenAPI

````yaml POST /api/v1/transactions
openapi: 3.1.0
info:
  title: AgentWallex API
  description: >-
    REST API for managing AI agent wallets, on-chain transactions, spending
    policies, webhooks, and x402 micropayments.
  version: 1.0.0
  contact:
    name: AgentWallex Support
    url: https://agentwallex.com
servers:
  - url: https://api.agentwallex.com
    description: Production
  - url: https://api-sandbox.agentwallex.com
    description: Sandbox
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Agents
    description: Create and manage AI agent wallets.
  - name: Transactions
    description: Send payments and query transaction history.
  - name: Policies
    description: Configure spending limits and access controls.
  - name: Webhooks
    description: Register and manage webhook endpoints.
  - name: x402
    description: x402 micropayment negotiation and session management.
paths:
  /api/v1/transactions:
    post:
      tags:
        - Transactions
      summary: Create Transaction
      description: >-
        Submit a new transaction through an agent's wallet. The transaction
        passes through the policy engine for validation, then is signed via MPC
        and broadcast to the blockchain.
      operationId: createTransaction
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - agent_id
                - direction
                - type
                - to_address
                - amount
                - token
                - chain
              properties:
                agent_id:
                  type: string
                  description: The agent whose wallet will send the transaction.
                direction:
                  type: string
                  enum:
                    - outbound
                  description: >-
                    Transaction direction. Currently only `outbound` is
                    supported.
                type:
                  type: string
                  enum:
                    - transfer
                  description: Transaction type.
                from_address:
                  type: string
                  description: >-
                    Sender address. If omitted, the agent's wallet address is
                    used.
                to_address:
                  type: string
                  description: Recipient on-chain address.
                amount:
                  type: string
                  description: Amount to send as a decimal string (e.g., `"10.5"`).
                token:
                  type: string
                  description: Token symbol (e.g., `USDC`, `USDT`, `ETH`).
                chain:
                  type: string
                  description: CAIP-2 chain identifier (e.g., `eip155:84532`).
                memo:
                  type: string
                  description: Optional memo or reference string.
            example:
              agent_id: agent_abc123
              direction: outbound
              type: transfer
              to_address: '0xabcdef1234567890abcdef1234567890abcdef12'
              amount: '10.5'
              token: USDC
              chain: eip155:84532
              memo: service payment
      responses:
        '200':
          description: Transaction created and submitted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transaction'
              example:
                id: tx_xyz789
                hash: 0xabc123def456...
                status: confirmed
                amount: '10.5'
                token: USDC
                fee: '0.001'
                created_at: '2025-06-15T14:30:00Z'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    Transaction:
      type: object
      description: An on-chain transaction submitted through an agent's wallet.
      properties:
        id:
          type: string
          description: Unique transaction identifier.
        hash:
          type: string
          description: On-chain transaction hash (available after broadcast).
        agent_id:
          type: string
          description: Agent that initiated the transaction.
        direction:
          type: string
          enum:
            - outbound
          description: Transaction direction.
        type:
          type: string
          enum:
            - transfer
          description: Transaction type.
        from_address:
          type: string
          description: Sender address.
        to_address:
          type: string
          description: Recipient address.
        amount:
          type: string
          description: Amount sent as a decimal string.
        token:
          type: string
          description: Token symbol (e.g., `USDC`, `USDT`, `ETH`).
        chain:
          type: string
          description: CAIP-2 chain identifier.
        fee:
          type: string
          description: Network gas fee paid.
        status:
          type: string
          enum:
            - pending
            - confirmed
            - failed
          description: Transaction status.
        memo:
          type: string
          description: Optional memo string.
        created_at:
          type: string
          format: date-time
          description: ISO 8601 creation timestamp.
    ErrorResponse:
      type: object
      description: Standard error response.
      required:
        - code
        - type
        - message
      properties:
        code:
          type: string
          description: Machine-readable error code.
        type:
          type: string
          enum:
            - invalid_request_error
            - authentication_error
            - authorization_error
            - not_found_error
            - rate_limit_error
            - internal_error
          description: Error type category.
        message:
          type: string
          description: Human-readable error description.
  responses:
    BadRequest:
      description: Invalid request body or parameters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: invalid_request
            type: invalid_request_error
            message: The request body is missing required fields.
    Unauthorized:
      description: Missing or invalid credentials.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: authentication_failed
            type: authentication_error
            message: The provided API key is invalid or expired.
    Forbidden:
      description: Insufficient permissions.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: insufficient_permissions
            type: authorization_error
            message: You do not have permission to perform this action.
    RateLimited:
      description: Rate limit exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: rate_limit_exceeded
            type: rate_limit_error
            message: Too many requests. Please retry after a short delay.
    InternalError:
      description: Server-side error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: server_error
            type: internal_error
            message: An unexpected error occurred. Please try again later.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key authentication. Keys are prefixed with `awx_`.
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT bearer token authentication.

````