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

# Cancel a transfer

> Cancel a pending transfer by setting its status to cancelled. Only transfers in pending status can be cancelled before processing begins. Returns the updated transfer resource with cancelled status. Use this endpoint to stop a bank transfer from further processing.



## OpenAPI

````yaml post /transfers/{id}
openapi: 3.1.0
info:
  title: Dwolla API
  description: Dwolla API Documentation
  contact:
    name: Dwolla Developer Relations Team
    url: https://developers.dwolla.com
    email: api@dwolla.com
  version: '2.0'
  termsOfService: https://www.dwolla.com/legal/tos/
  license:
    name: MIT
    url: https://github.com/Dwolla/dwolla-openapi/blob/master/LICENSE
servers:
  - url: https://api.dwolla.com
    description: Production server
  - url: https://api-sandbox.dwolla.com
    description: Sandbox server
security:
  - clientCredentials: []
tags:
  - name: tokens
    description: Operations related to Application Access Tokens
  - name: root
    description: Root API operations
  - name: accounts
    description: Operations related to Accounts
  - name: customers
    description: Operations related to Customers
  - name: kba
    description: Operations related to Knowledge-Based Authentication
  - name: beneficial owners
    description: Operations related to Beneficial Owners
  - name: documents
    description: Operations related to Documents
  - name: exchanges
    description: Operations related to Exchanges
  - name: exchange sessions
    description: Operations related to Exchange Sessions
  - name: funding sources
    description: Operations related to Funding Sources
  - name: transfers
    description: Operations related to Transfers
  - name: labels
    description: Operations related to Labels
  - name: mass payments
    description: Operations related to Mass Payments
  - name: events
    description: Operations related to Events
  - name: webhook subscriptions
    description: Operations related to Webhook Subscriptions
  - name: webhooks
    description: Operations related to Webhooks
  - name: client tokens
    description: Operations related to Client Tokens
  - name: sandbox simulations
    description: Sandbox-only operations for simulating processing of bank transfers
paths:
  /transfers/{id}:
    post:
      tags:
        - transfers
      summary: Cancel a transfer
      description: >-
        Cancel a pending transfer by setting its status to cancelled. Only
        transfers in pending status can be cancelled before processing begins.
        Returns the updated transfer resource with cancelled status. Use this
        endpoint to stop a bank transfer from further processing.
      operationId: cancelTransfer
      parameters:
        - name: id
          in: path
          description: ID of transfer
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/Accept'
      requestBody:
        required: true
        description: Parameters to cancel a transfer
        content:
          application/json:
            schema:
              required:
                - status
              type: object
              properties:
                status:
                  type: string
                  const: cancelled
      responses:
        '200':
          description: successful operation
          headers: {}
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                type: object
        '400':
          description: 400 Bad Request
          headers: {}
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/BadRequestError'
                  - $ref: '#/components/schemas/StatusInvalidError'
                  - $ref: '#/components/schemas/StatusNotAllowedError'
        '404':
          description: 404 Not Found
          headers: {}
          content:
            application/vnd.dwolla.v1.hal+json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
      x-codeSamples:
        - lang: bash
          source: >
            POST
            https://api-sandbox.dwolla.com/transfers/3d48c13a-0fc6-e511-80de-0aa34a9b2388

            Content-Type: application/vnd.dwolla.v1.hal+json

            Accept: application/vnd.dwolla.v1.hal+json

            Authorization: Bearer
            pBA9fVDBEyYZCEsLf/wKehyh1RTpzjUj5KzIRfDi0wKTii7DqY


            {
                "status": "cancelled"
            }
        - lang: javascript
          source: >
            // Using dwolla-v2 - https://github.com/Dwolla/dwolla-v2-node

            var transferUrl =
              "https://api-sandbox.dwolla.com/transfers/3d48c13a-0fc6-e511-80de-0aa34a9b2388";
            var requestBody = {
              status: "cancelled",
            };


            dwolla.post(transfer_url, requestBody).then((res) =>
            res.body.status); // => "cancelled"
        - lang: python
          source: >
            # Using dwollav2 - https://github.com/Dwolla/dwolla-v2-python

            transfer_url =
            'https://api-sandbox.dwolla.com/transfers/3d48c13a-0fc6-e511-80de-0aa34a9b2388'

            request_body = {
              'status': 'cancelled'
            }


            transfer = app_token.post(transfer_url, request_body)

            transfer.body['status'] # => 'cancelled'
        - lang: php
          source: >
            <?php

            // Using dwollaswagger -
            https://github.com/Dwolla/dwolla-swagger-php

            $transfersApi = new DwollaSwagger\TransfersApi($apiClient);


            $transferUrl =
            'https://api-sandbox.dwolla.com/transfers/3d48c13a-0fc6-e511-80de-0aa34a9b2388';

            $transfer = $transfersApi->update([
              'status' => 'cancelled',
            ], $transferUrl);


            $transfer->status; # => "cancelled"

            ?>
        - lang: ruby
          source: >
            # Using dwolla_v2 - https://github.com/Dwolla/dwolla-v2-ruby

            transfer_url =
            'https://api-sandbox.dwolla.com/transfers/3d48c13a-0fc6-e511-80de-0aa34a9b2388'

            request_body = {
                  "status" => "cancelled",
            }


            transfer = app_token.post "#{transfer_url}", request_body

            transfer.status # => "cancelled"
components:
  parameters:
    Accept:
      name: Accept
      in: header
      required: true
      description: >-
        The media type of the response. Must be
        application/vnd.dwolla.v1.hal+json
      schema:
        type: string
        enum:
          - application/vnd.dwolla.v1.hal+json
        default: application/vnd.dwolla.v1.hal+json
  schemas:
    BadRequestError:
      title: BadRequestError
      description: Error response schema for 400 Bad Request
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: BadRequest
        message:
          type: string
          example: The request body contains bad syntax or is incomplete.
    StatusInvalidError:
      title: StatusInvalidError
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: ValidationError
        message:
          type: string
          example: >-
            Validation error(s) present. See embedded errors list for more
            details.
        _embedded:
          type: object
          properties:
            errors:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                    example: Invalid
                  message:
                    type: string
                    example: Status invalid.
                  path:
                    type: string
                    example: /status
                  _links:
                    type: object
                    example: {}
    StatusNotAllowedError:
      title: StatusNotAllowedError
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: ValidationError
        message:
          type: string
          example: >-
            Validation error(s) present. See embedded errors list for more
            details.
        _embedded:
          type: object
          properties:
            errors:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                    example: NotAllowed
                  message:
                    type: string
                    example: Status not allowed.
                  path:
                    type: string
                    example: /status
                  _links:
                    type: object
                    example: {}
    NotFoundError:
      title: NotFoundError
      description: Error response schema for 404 NotFound
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: NotFound
        message:
          type: string
          example: The requested resource was not found.
  securitySchemes:
    clientCredentials:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /token
          x-speakeasy-token-endpoint-authentication: client_secret_basic
          scopes: {}

````