<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoTokenKit",
  "identifier" : "/documentation/CryptoTokenKit/TKSmartCard/send(ins:p1:p2:data:le:)-6dore",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CryptoTokenKit"
    ],
    "preciseIdentifier" : "s:So11TKSmartCardC14CryptoTokenKitE4send3ins2p12p24data2les6UInt16V2sw_10Foundation4DataV8responsets5UInt8V_A2rOSgSiSgtYaKF"
  },
  "title" : "send(ins:p1:p2:data:le:)"
}
-->

# send(ins:p1:p2:data:le:)

Asynchronously sends an APDU command to the smart card.

```
@backDeployed(before: macOS 27.0, iOS 27.0, tvOS 27.0, watchOS 27.0, visionOS 27.0)
final func send(ins: UInt8, p1: UInt8, p2: UInt8, data: Data? = nil, le: Int? = nil) async throws -> (sw: UInt16, response: Data)
```

## Parameters

`ins`

Instruction byte of the APDU command.

`p1`

P1 parameter byte.

`p2`

P2 parameter byte.

`data`

Optional command data.

`le`

Optional expected response length.

## Return Value

A tuple containing the status word (sw) and response data.

## Discussion

In an async context, Swift prefers this overload over the synchronous
`send(ins:p1:p2:data:le:) throws` method. To call the synchronous overload
from an async context, use a typed function reference cast:
`card.send as (UInt8, UInt8, UInt8, Data?, Int?) throws -> (UInt16, Data)`

> Throws: `CancellationError` if the task was cancelled before transmission,
> or an error if the command fails.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)