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

# Craft Transaction Step

> Craft a single transaction step.



## OpenAPI

````yaml openapi/defi-api.json POST /api/defi/v1/transactions/steps/craft
openapi: 3.0.3
info:
  title: DeFi API
  version: 1.0.0
servers:
  - url: https://edge.p2p.org
security:
  - ClientHash: []
  - ApiKey: []
tags:
  - name: Earning
  - name: Positions
  - name: Rewards
  - name: Transactions
  - name: Wallets
paths:
  /api/defi/v1/transactions/steps/craft:
    post:
      tags:
        - Transactions
      summary: Craft Transaction Step
      description: Craft a single transaction step.
      operationId: craft_transaction_step
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - chain
                - action
                - protocol
                - strategy
                - userAddress
                - stepName
              properties:
                chain:
                  type: string
                action:
                  type: string
                  enum:
                    - deposit
                    - withdraw
                    - approvePermit2
                protocol:
                  type: string
                strategy:
                  type: string
                userAddress:
                  type: string
                stepName:
                  type: string
                  enum:
                    - permit2SingleDetailsForMorpho
                    - permit2SingleDetailsForP2pProxy
                    - finalDepositTransaction
                    - finalWithdrawTransaction
                    - finalPermit2AllowanceTransaction
                payload:
                  type: object
                options:
                  type: object
                  properties:
                    executionMode:
                      type: string
                      enum:
                        - sync
                        - async
                      default: sync
      responses:
        '200':
          description: Crafted step result.
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: object
                    properties:
                      operationId:
                        type: string
                      chain:
                        type: string
                      action:
                        type: string
                      status:
                        type: string
                        enum:
                          - AWAITING_CRAFT
                          - IN_PROGRESS
                          - READY_FOR_SIGN
                          - DONE
                      protocol:
                        type: string
                      strategy:
                        type: string
                      userAddress:
                        type: string
                      stepList:
                        type: array
                        items:
                          type: object
                          nullable: true
                      payload:
                        type: object
                        nullable: true
                      verifierMeta:
                        type: object
                        nullable: true
                      createdAt:
                        type: string
                        format: date-time
                      updatedAt:
                        type: string
                        format: date-time
                  error:
                    nullable: true
                    default: null
                  meta:
                    $ref: '#/components/schemas/ResponseMeta'
        '400':
          description: >-
            ValidationException | PreviousStepsNotCompletedException |
            StepSequenceViolationException
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            AssetNotSupportedException | StrategyNotSupportedException |
            ProtocolNotSupportedException
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: CraftStepFailedException
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ResponseMeta:
      type: object
      properties:
        time:
          type: integer
        requestId:
          type: string
          format: uuid
    ErrorResponse:
      type: object
      properties:
        result:
          nullable: true
          default: null
        error:
          type: object
          properties:
            name:
              type: string
            message:
              type: string
            validationErrors:
              type: array
              items:
                type: object
        meta:
          $ref: '#/components/schemas/ResponseMeta'
  securitySchemes:
    ClientHash:
      type: apiKey
      in: header
      name: X-Client-Hash
    ApiKey:
      type: apiKey
      in: header
      name: apikey

````

## Related topics

- [Sign and Broadcast Transaction](/docs/defi-api-signing-transaction.md)
- [Withdrawal](/docs/morpho-withdrawal.md)
- [Deposit](/docs/morpho-staking.md)
- [Get Transaction Step Schema](/reference/get-transaction-schema.md)
- [Get Step Crafting Status](/reference/get-step-status.md)
