# Cancel a transfer

Initiate a cancellation for a card, ACH, or queued transfer.

To access this endpoint using a [token](https://docs.moov.io/api/authentication/access-tokens/) you'll need to specify the `/accounts/{accountID}/transfers.write` scope.

## Request

POST

/accounts/{accountID}/transfers/{transferID}/cancellations

### Ask

```shell
curl -X POST "https://api.moov.io/accounts/{accountID}/transfers/{transferID}/cancellations" \
  -H "Authorization: Bearer {token}" \
  -H "X-Moov-Version: v2026.07.00"
```

### Ask

```go
mc, _ := moov.NewClient()

var accountID string // facilitator ID
var transferID string

mc.CancelTransfer(ctx, accountID, transferID)
```

### Ask

```typescript
import { Moov } from "@moovio/sdk";

const moov = new Moov({
  security: {
    username: "",
    password: "",
  },
});

async function run() {
  const result = await moov.transfers.createCancellation({
    accountID: "10ae862c-6658-4f87-967d-46e995737204",
    transferID: "36c80a6c-ceb2-4e5d-a437-8a39afdfdc58",
  });

console.log(result);
}

run();
```

### Ask

```php
declare(strict_types=1);

require 'vendor/autoload.php';

use Moov\MoovPhp;
use Moov\MoovPhp\Models\Components;

$sdk = MoovPhp\Moov::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$response = $sdk->transfers->createCancellation(
    accountID: '10ae862c-6658-4f87-967d-46e995737204',
    transferID: '36c80a6c-ceb2-4e5d-a437-8a39afdfdc58'
);

if ($response->cancellation !== null) {
    // handle response
}
```

### Ask

```java
package hello.world;

import io.moov.sdk.Moov;
import io.moov.sdk.models.components.Security;
import io.moov.sdk.models.errors.GenericError;
import io.moov.sdk.models.operations.CreateCancellationResponse;
import java.lang.Exception;

public class Application {

public static void main(String[] args) throws GenericError, Exception {

Moov sdk = Moov.builder()
                .security(Security.builder()
                    .username("")
                    .password("")
                    .build())
            .build();

CreateCancellationResponse res = sdk.transfers().createCancellation()
                .accountID("10ae862c-6658-4f87-967d-46e995737204")
                .transferID("36c80a6c-ceb2-4e5d-a437-8a39afdfdc58")
                .call();

if (res.cancellation().isPresent()) {
            System.out.println(res.cancellation().get());
        }
    }
}
```

### Ask

```python
from moovio_sdk import Moov
from moovio_sdk.models import components

with Moov(
    security=components.Security(
        username="",
        password="",
    ),
) as moov:

res = moov.transfers.create_cancellation(account_id="10ae862c-6658-4f87-967d-46e995737204", transfer_id="36c80a6c-ceb2-4e5d-a437-8a39afdfdc58")

# Handle response
    print(res)
```

### Ask

```ruby
require 'moov_ruby'

Models = ::Moov::Models
s = ::Moov::Client.new(
  security: Models::Components::Security.new(
    username: '',
    password: ''
  )
)
res = s.transfers.create_cancellation(account_id: '10ae862c-6658-4f87-967d-46e995737204', transfer_id: '36c80a6c-ceb2-4e5d-a437-8a39afdfdc58')

unless res.cancellation.nil?
  # handle response
end
```

### Ask

```csharp
using Moov.Sdk;
using Moov.Sdk.Models.Components;

var sdk = new MoovClient(security: new Security() {
    Username = "",
    Password = "",
});

var res = await sdk.Transfers.CreateCancellationAsync(
    accountID: "10ae862c-6658-4f87-967d-46e995737204",
    transferID: "36c80a6c-ceb2-4e5d-a437-8a39afdfdc58"
);

// handle response
```

## Response

The request completed successfully.

### Created cancellation

```json
{
  "cancellationID": "89ca7f54-13ba-4714-b9af-17163eae2057",
  "createdOn": "2025-01-19T03:02:43.255309588Z",
  "status": "completed"
}
```

### Response headers

A unique identifier used to trace requests.

Successfully initiated a cancellation but an error occurred while waiting for a synchronous response.

### Example

```json
{
  "cancellationID": "string",
  "status": "pending",
  "createdOn": "2019-08-24T14:15:22Z"
}
```

### Response headers

A unique identifier used to trace requests.

The server could not understand the request due to invalid syntax.

### Example

```json
{
  "error": "string"
}
```

### Response headers

A unique identifier used to trace requests.

The request contained missing or expired authentication.

### Response headers

A unique identifier used to trace requests.

The user is not authorized to make the request.

### Response headers

A unique identifier used to trace requests.

The requested resource was not found.

### Response headers

A unique identifier used to trace requests.

Request was refused due to rate limiting.

### Response headers

A unique identifier used to trace requests.

The request failed due to an unexpected error.

### Response headers

A unique identifier used to trace requests.

The request failed because a downstream service failed to respond.

### Response headers

A unique identifier used to trace requests.

Set this header to v2026.07.00 to use the API described in this specification. When omitted, the server defaults to v2024.01.00, which may not match the behavior documented here.

### Possible values:

`v2026.07.00`

The partner's Moov account ID.

The transfer ID to cancel.

Possible values:

`pending`,

`completed`,

`failed`
