> ## Documentation Index
> Fetch the complete documentation index at: https://turnkey-0e7c1f5b-traian-remove-eip-712-note.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Prepare Spark transfer

> Construct sender-side encrypted operator packages for a Spark BTC transfer. Does not perform FROST signing.

export const EndpointPath = ({type, path}) => {
  return <div class="flex w-full flex-col bg-background-light dark:bg-background-dark border-standard rounded-2xl p-1.5">
      <div class="flex items-center space-x-1.5">
        <div class="relative flex-1 flex gap-2 min-w-0 rounded-xl items-center cursor-pointer p-1.5 border-standard">
          <div class="rounded-lg font-bold px-1.5 py-0.5 text-sm leading-5 bg-blue-400/20 dark:bg-blue-400/20 text-blue-700 dark:text-blue-400">
            POST
          </div>
          <div class="flex items-center space-x-2 overflow-x-auto flex-1 no-scrollbar">
            <div class="group flex items-center flex-1 gap-0.5 font-mono">
              <div class="absolute right-0 p-2 bg-background-light dark:bg-background-dark rounded-lg hidden group-hover:block">
                <svg class="w-4 h-4 bg-gray-400 dark:bg-white/30"></svg>
              </div>
              <div class="text-sm text-gray-400">/</div>
              <div class="text-sm font-medium text-gray-800 dark:text-white min-w-max">
                public
              </div>
              <div class="text-sm text-gray-400">/</div>
              <div class="text-sm font-medium text-gray-800 dark:text-white min-w-max">
                v1
              </div>
              <div class="text-sm text-gray-400">/</div>
              <div class="text-sm font-medium text-gray-800 dark:text-white min-w-max">
                {type}
              </div>
              <div class="text-sm text-gray-400">/</div>
              <div class="text-sm font-medium text-gray-800 dark:text-white min-w-max">
                {path}
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>;
};

export const NestedParam = ({parentKey, childKey, type, required, description, children}) => {
  const fullKey = `${parentKey}.${childKey}`;
  const anchorId = `body-${fullKey.replace(/\./g, '-')}`;
  return <div className="py-6 border-gray-100 dark:border-gray-800 border-b last:border-b-0">
  <div className="flex font-mono text-sm group/param-head param-head break-all relative" id={anchorId}>
    <div className="flex-1 flex content-start py-0.5 mr-5">
      <div className="flex items-center flex-wrap gap-2">
        <div className="absolute -top-1.5">
          <a href={`#${anchorId}`} className="-ml-[2.1rem] flex items-center opacity-0 border-0 group-hover/param-head:opacity-100 py-2 [.expandable-content_&]:-ml-[2.1rem]" aria-label="Navigate to header">
            <div className="w-6 h-6 text-gray-400 rounded-md flex items-center justify-center zinc-box bg-white ring-1 ring-gray-400/30 dark:ring-gray-700/25 hover:ring-gray-400/60 dark:hover:ring-white/20">
              <svg xmlns="http://www.w3.org/2000/svg" fill="gray" height="12px" viewBox="0 0 576 512">
                <path d="M0 256C0 167.6 71.6 96 160 96h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C98.1 144 48 194.1 48 256s50.1 112 112 112h72c13.3 0 24 10.7 24 24s-10.7 24-24 24H160C71.6 416 0 344.4 0 256zm576 0c0 88.4-71.6 160-160 160H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c61.9 0 112-50.1 112-112s-50.1-112-112-112H344c-13.3 0-24-10.7-24-24s10.7-24 24-24h72c88.4 0 160 71.6 160 160zM184 232H392c13.3 0 24 10.7 24 24s-10.7 24-24 24H184c-13.3 0-24-10.7-24-24s10.7-24 24-24z"></path>
              </svg>
            </div>
          </a>
        </div>
        <div className="font-semibold text-primary dark:text-primary-light cursor-pointer overflow-wrap-anywhere">
          <span className="text-gray-500 dark:text-gray-400">{parentKey}.</span>
          {childKey}
        </div>
        <div className="inline items-center gap-2 text-xs font-medium [&_div]:inline [&_div]:mr-2 [&_div]:leading-5">
          <div className="flex items-center px-2 py-0.5 rounded-md bg-gray-100/50 dark:bg-white/5 text-gray-600 dark:text-gray-200 font-medium break-all">
            <span>{type}</span>
          </div>
          {required && <span className="px-2 py-0.5 rounded-md bg-red-100/50 dark:bg-red-400/10 text-red-600 dark:text-red-300 font-medium whitespace-nowrap">
              required
            </span>}
        </div>
      </div>
    </div>
  </div>
  {children && <div className="mt-4">
      <div className="prose prose-sm prose-gray dark:prose-invert">
        {children}
      </div>
    </div>}
</div>;
};

export const H3Bordered = ({text}) => <h3 id={text.toLowerCase()} className="border-b pb-2.5 border-gray-100 dark:border-gray-800">
    {text}
  </h3>;

export const Authorizations = () => {
  return <div>
      <H3Bordered text="Authorizations" />

      <Tabs>
        <Tab title="API Key">
          <div className="flex text-sm group/param-head param-head break-all relative" id="authorization-x-stamp">
            <ParamField header="X-Stamp" type="string" required={true}>
              Cryptographically signed (stamped) request to be passed in as a header. For more info, see <a href="https://docs.turnkey.com/developer-reference/api-overview/stamps">here</a>.
            </ParamField>
          </div>
        </Tab>

        <Tab title="WebAuthn (Passkey)">
         <div className="flex text-sm group/param-head param-head break-all relative" id="authorization-x-stamp-webauthn">
            <ParamField body="X-Stamp-WebAuthn" type="string" required={true}>
              Cryptographically signed (stamped) request to be passed in as a header. For more info, see <a href="https://docs.turnkey.com/developer-reference/api-overview/stamps">here</a>.
            </ParamField>
          </div>
        </Tab>
      </Tabs>
    </div>;
};

<EndpointPath type="submit" path="spark_prepare_transfer" />

<Authorizations />

<H3Bordered text="Body" />

<ParamField body="type" type="enum<string>" required={true}>
  Enum options: `ACTIVITY_TYPE_SPARK_PREPARE_TRANSFER`
</ParamField>

<ParamField body="timestampMs" type="string" required={true}>
  Timestamp (in milliseconds) of the request, used to verify liveness of user requests.
</ParamField>

<ParamField body="organizationId" type="string" required={true}>
  Unique identifier for a given Organization.
</ParamField>

<ParamField body="parameters" type="object" required={true} path="parameters">
  <p>The parameters object containing the specific intent data for this activity.</p>

  <Expandable title="details">
    <NestedParam parentKey="parameters" childKey="signWith" type="string" required={true} default="">
      A Spark wallet account address identifying the wallet.
    </NestedParam>

    <ParamField body="transfer" type="object" required={true} path="parameters.transfer">
      <p>transfer field</p>

      <Expandable title="details">
        <NestedParam parentKey="parameters.transfer" childKey="transferId" type="string" required={true} default="">
          Spark transfer identifier (UUID).
        </NestedParam>

        <ParamField body="leaves" type="array" required={true} path="parameters.transfer.leaves">
          <p>Leaves being transferred.</p>

          <Expandable title="item details">
            <NestedParam parentKey="parameters.transfer.leaves" childKey="leafId" type="string" required={true} default="">
              Leaf identifier (UUID).
            </NestedParam>

            <ParamField body="oldLeafDerivation" type="object" required={true} path="parameters.transfer.leaves.oldLeafDerivation">
              <p>oldLeafDerivation field</p>

              <Expandable title="details">
                <NestedParam parentKey="parameters.transfer.leaves.oldLeafDerivation" childKey="identity" type="object" required={false} default="">
                  identity field
                </NestedParam>

                <ParamField body="signingLeaf" type="object" required={false} path="parameters.transfer.leaves.oldLeafDerivation.signingLeaf">
                  <p>signingLeaf field</p>

                  <Expandable title="details">
                    <NestedParam parentKey="parameters.transfer.leaves.oldLeafDerivation.signingLeaf" childKey="leafId" type="string" required={true} default="">
                      Unique identifier for the Spark signing leaf.
                    </NestedParam>
                  </Expandable>
                </ParamField>

                <NestedParam parentKey="parameters.transfer.leaves.oldLeafDerivation" childKey="deposit" type="object" required={false} default="">
                  deposit field
                </NestedParam>

                <ParamField body="staticDeposit" type="object" required={false} path="parameters.transfer.leaves.oldLeafDerivation.staticDeposit">
                  <p>staticDeposit field</p>

                  <Expandable title="details">
                    <NestedParam parentKey="parameters.transfer.leaves.oldLeafDerivation.staticDeposit" childKey="index" type="number" required={true} default="">
                      Index used to derive the static deposit key.
                    </NestedParam>
                  </Expandable>
                </ParamField>

                <NestedParam parentKey="parameters.transfer.leaves.oldLeafDerivation" childKey="htlcPreimage" type="object" required={false} default="">
                  htlcPreimage field
                </NestedParam>
              </Expandable>
            </ParamField>

            <ParamField body="newLeafDerivation" type="object" required={true} path="parameters.transfer.leaves.newLeafDerivation">
              <p>newLeafDerivation field</p>

              <Expandable title="details">
                <NestedParam parentKey="parameters.transfer.leaves.newLeafDerivation" childKey="identity" type="object" required={false} default="">
                  identity field
                </NestedParam>

                <ParamField body="signingLeaf" type="object" required={false} path="parameters.transfer.leaves.newLeafDerivation.signingLeaf">
                  <p>signingLeaf field</p>

                  <Expandable title="details">
                    <NestedParam parentKey="parameters.transfer.leaves.newLeafDerivation.signingLeaf" childKey="leafId" type="string" required={true} default="">
                      Unique identifier for the Spark signing leaf.
                    </NestedParam>
                  </Expandable>
                </ParamField>

                <NestedParam parentKey="parameters.transfer.leaves.newLeafDerivation" childKey="deposit" type="object" required={false} default="">
                  deposit field
                </NestedParam>

                <ParamField body="staticDeposit" type="object" required={false} path="parameters.transfer.leaves.newLeafDerivation.staticDeposit">
                  <p>staticDeposit field</p>

                  <Expandable title="details">
                    <NestedParam parentKey="parameters.transfer.leaves.newLeafDerivation.staticDeposit" childKey="index" type="number" required={true} default="">
                      Index used to derive the static deposit key.
                    </NestedParam>
                  </Expandable>
                </ParamField>

                <NestedParam parentKey="parameters.transfer.leaves.newLeafDerivation" childKey="htlcPreimage" type="object" required={false} default="">
                  htlcPreimage field
                </NestedParam>
              </Expandable>
            </ParamField>

            <NestedParam parentKey="parameters.transfer.leaves" childKey="refundSignature" type="string" required={false} default="">
              Client-produced CPFP refund signature (hex-encoded), passed through verbatim into the per-operator SendLeafKeyTweak. Empty omits the field from the operator package.
            </NestedParam>

            <NestedParam parentKey="parameters.transfer.leaves" childKey="directRefundSignature" type="string" required={false} default="">
              Client-produced direct refund signature (hex-encoded). Passed through verbatim.
            </NestedParam>

            <NestedParam parentKey="parameters.transfer.leaves" childKey="directFromCpfpRefundSignature" type="string" required={false} default="">
              Client-produced direct-from-CPFP refund signature (hex-encoded). Passed through verbatim.
            </NestedParam>
          </Expandable>
        </ParamField>

        <NestedParam parentKey="parameters.transfer" childKey="threshold" type="number" required={true} default="">
          Feldman VSS threshold for reconstructing the per-leaf tweak scalar.
        </NestedParam>

        <ParamField body="operatorRecipients" type="array" required={true} path="parameters.transfer.operatorRecipients">
          <p>Operators that will receive Feldman shares of the per-leaf tweak. Order must match the operators' numeric IDs in the Spark operator config - share index is the 1-based position in this list.</p>

          <Expandable title="item details">
            <NestedParam parentKey="parameters.transfer.operatorRecipients" childKey="operatorId" type="string" required={true} default="">
              Spark operator identifier (UUID).
            </NestedParam>

            <NestedParam parentKey="parameters.transfer.operatorRecipients" childKey="encryptionPublicKey" type="string" required={true} default="">
              Operator's ECIES encryption pubkey (hex-encoded compressed secp256k1 point).
            </NestedParam>
          </Expandable>
        </ParamField>

        <NestedParam parentKey="parameters.transfer" childKey="receiverPublicKey" type="string" required={true} default="">
          Recipient's identity pubkey (hex-encoded compressed secp256k1 point). Each leaf's new\_priv is ECIES-encrypted to this key and embedded in the per-operator package for claim-time delivery.
        </NestedParam>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<H3Bordered text="Response" />

A successful response returns the following fields:

<ResponseField name="activity" type="object" required={true}>
  The activity object containing type, intent, and result

  <Expandable title="activity details">
    <NestedParam parentKey="activity" childKey="id" type="string" required={true}>
      Unique identifier for a given Activity object.
    </NestedParam>

    <NestedParam parentKey="activity" childKey="organizationId" type="string" required={true}>
      Unique identifier for a given Organization.
    </NestedParam>

    <NestedParam parentKey="activity" childKey="status" type="string" required={true}>
      The activity status
    </NestedParam>

    <NestedParam parentKey="activity" childKey="type" type="string" required={true}>
      The activity type
    </NestedParam>

    <NestedParam parentKey="activity" childKey="intent" type="object" required={true}>
      The intent of the activity

      <Expandable title="intent details">
        <NestedParam parentKey="activity.intent" childKey="sparkPrepareTransferIntent" type="object" required={true}>
          The sparkPrepareTransferIntent object

          <Expandable title="sparkPrepareTransferIntent details">
            <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent" childKey="signWith" type="string" required={true}>
              A Spark wallet account address identifying the wallet.
            </NestedParam>

            <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent" childKey="transfer" type="object" required={true}>
              transfer field

              <Expandable title="transfer details">
                <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer" childKey="transferId" type="string" required={true}>
                  Spark transfer identifier (UUID).
                </NestedParam>

                <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer" childKey="leaves" type="array" required={true}>
                  Leaves being transferred.

                  <Expandable title="leaves details">
                    <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves" childKey="leafId" type="string" required={true}>
                      Leaf identifier (UUID).
                    </NestedParam>

                    <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves" childKey="oldLeafDerivation" type="object" required={true}>
                      oldLeafDerivation field

                      <Expandable title="oldLeafDerivation details">
                        <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.oldLeafDerivation" childKey="identity" type="object" required={false}>
                          identity field
                        </NestedParam>

                        <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.oldLeafDerivation" childKey="signingLeaf" type="object" required={false}>
                          signingLeaf field

                          <Expandable title="signingLeaf details">
                            <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.oldLeafDerivation.signingLeaf" childKey="leafId" type="string" required={true}>
                              Unique identifier for the Spark signing leaf.
                            </NestedParam>
                          </Expandable>
                        </NestedParam>

                        <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.oldLeafDerivation" childKey="deposit" type="object" required={false}>
                          deposit field
                        </NestedParam>

                        <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.oldLeafDerivation" childKey="staticDeposit" type="object" required={false}>
                          staticDeposit field

                          <Expandable title="staticDeposit details">
                            <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.oldLeafDerivation.staticDeposit" childKey="index" type="number" required={true}>
                              Index used to derive the static deposit key.
                            </NestedParam>
                          </Expandable>
                        </NestedParam>

                        <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.oldLeafDerivation" childKey="htlcPreimage" type="object" required={false}>
                          htlcPreimage field
                        </NestedParam>
                      </Expandable>
                    </NestedParam>

                    <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves" childKey="newLeafDerivation" type="object" required={true}>
                      newLeafDerivation field

                      <Expandable title="newLeafDerivation details">
                        <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.newLeafDerivation" childKey="identity" type="object" required={false}>
                          identity field
                        </NestedParam>

                        <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.newLeafDerivation" childKey="signingLeaf" type="object" required={false}>
                          signingLeaf field

                          <Expandable title="signingLeaf details">
                            <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.newLeafDerivation.signingLeaf" childKey="leafId" type="string" required={true}>
                              Unique identifier for the Spark signing leaf.
                            </NestedParam>
                          </Expandable>
                        </NestedParam>

                        <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.newLeafDerivation" childKey="deposit" type="object" required={false}>
                          deposit field
                        </NestedParam>

                        <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.newLeafDerivation" childKey="staticDeposit" type="object" required={false}>
                          staticDeposit field

                          <Expandable title="staticDeposit details">
                            <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.newLeafDerivation.staticDeposit" childKey="index" type="number" required={true}>
                              Index used to derive the static deposit key.
                            </NestedParam>
                          </Expandable>
                        </NestedParam>

                        <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves.newLeafDerivation" childKey="htlcPreimage" type="object" required={false}>
                          htlcPreimage field
                        </NestedParam>
                      </Expandable>
                    </NestedParam>

                    <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves" childKey="refundSignature" type="string" required={false}>
                      Client-produced CPFP refund signature (hex-encoded), passed through verbatim into the per-operator SendLeafKeyTweak. Empty omits the field from the operator package.
                    </NestedParam>

                    <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves" childKey="directRefundSignature" type="string" required={false}>
                      Client-produced direct refund signature (hex-encoded). Passed through verbatim.
                    </NestedParam>

                    <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.leaves" childKey="directFromCpfpRefundSignature" type="string" required={false}>
                      Client-produced direct-from-CPFP refund signature (hex-encoded). Passed through verbatim.
                    </NestedParam>
                  </Expandable>
                </NestedParam>

                <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer" childKey="threshold" type="number" required={true}>
                  Feldman VSS threshold for reconstructing the per-leaf tweak scalar.
                </NestedParam>

                <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer" childKey="operatorRecipients" type="array" required={true}>
                  Operators that will receive Feldman shares of the per-leaf tweak. Order must match the operators' numeric IDs in the Spark operator config - share index is the 1-based position in this list.

                  <Expandable title="operatorRecipients details">
                    <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.operatorRecipients" childKey="operatorId" type="string" required={true}>
                      Spark operator identifier (UUID).
                    </NestedParam>

                    <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer.operatorRecipients" childKey="encryptionPublicKey" type="string" required={true}>
                      Operator's ECIES encryption pubkey (hex-encoded compressed secp256k1 point).
                    </NestedParam>
                  </Expandable>
                </NestedParam>

                <NestedParam parentKey="activity.intent.sparkPrepareTransferIntent.transfer" childKey="receiverPublicKey" type="string" required={true}>
                  Recipient's identity pubkey (hex-encoded compressed secp256k1 point). Each leaf's new\_priv is ECIES-encrypted to this key and embedded in the per-operator package for claim-time delivery.
                </NestedParam>
              </Expandable>
            </NestedParam>
          </Expandable>
        </NestedParam>
      </Expandable>
    </NestedParam>

    <NestedParam parentKey="activity" childKey="result" type="object" required={true}>
      The result of the activity

      <Expandable title="result details">
        <NestedParam parentKey="activity.result" childKey="sparkPrepareTransferResult" type="object" required={true}>
          The sparkPrepareTransferResult object

          <Expandable title="sparkPrepareTransferResult details">
            <NestedParam parentKey="activity.result.sparkPrepareTransferResult" childKey="operatorPackages" type="array" required={true}>
              Per-operator ECIES-encrypted packages.

              <Expandable title="operatorPackages details">
                <NestedParam parentKey="activity.result.sparkPrepareTransferResult.operatorPackages" childKey="operatorId" type="string" required={true}>
                  Spark operator identifier (UUID).
                </NestedParam>

                <NestedParam parentKey="activity.result.sparkPrepareTransferResult.operatorPackages" childKey="encryptedPackage" type="string" required={true}>
                  ECIES ciphertext (hex-encoded) opaque to Turnkey after emission.
                </NestedParam>
              </Expandable>
            </NestedParam>

            <NestedParam parentKey="activity.result.sparkPrepareTransferResult" childKey="transferUserSignature" type="string" required={true}>
              Hex-encoded ECDSA-DER signature of the TransferPackage signing payload, signed with the wallet's IDENTITY key.
            </NestedParam>

            <NestedParam parentKey="activity.result.sparkPrepareTransferResult" childKey="newLeafPublicKeys" type="array" required={true}>
              Newly-derived SigningLeaf public keys, one per leaf, in input order.

              <Expandable title="newLeafPublicKeys details">
                <NestedParam parentKey="activity.result.sparkPrepareTransferResult.newLeafPublicKeys" childKey="leafId" type="string" required={true}>
                  The Spark leaf\_id this public key was derived for.
                </NestedParam>

                <NestedParam parentKey="activity.result.sparkPrepareTransferResult.newLeafPublicKeys" childKey="publicKey" type="string" required={true}>
                  Hex-encoded compressed secp256k1 point (33 bytes) for the SigningLeaf derivation at leaf\_id.
                </NestedParam>
              </Expandable>
            </NestedParam>
          </Expandable>
        </NestedParam>
      </Expandable>
    </NestedParam>

    <NestedParam parentKey="activity" childKey="votes" type="array" required={true}>
      A list of objects representing a particular User's approval or rejection of a Consensus request, including all relevant metadata.
    </NestedParam>

    <NestedParam parentKey="activity" childKey="fingerprint" type="string" required={true}>
      An artifact verifying a User's action.
    </NestedParam>

    <NestedParam parentKey="activity" childKey="canApprove" type="boolean" required={true}>
      Whether the activity can be approved.
    </NestedParam>

    <NestedParam parentKey="activity" childKey="canReject" type="boolean" required={true}>
      Whether the activity can be rejected.
    </NestedParam>

    <NestedParam parentKey="activity" childKey="createdAt" type="string" required={true}>
      The creation timestamp.
    </NestedParam>

    <NestedParam parentKey="activity" childKey="updatedAt" type="string" required={true}>
      The last update timestamp.
    </NestedParam>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash title="cURL" theme={null}
  curl --request POST \
    --url https://api.turnkey.com/public/v1/submit/spark_prepare_transfer \
    --header 'Accept: application/json' \
    --header 'Content-Type: application/json' \
    --header "X-Stamp: <string> (see Authorizations)" \
    --data '{
      "type": "ACTIVITY_TYPE_SPARK_PREPARE_TRANSFER",
      "timestampMs": "<string> (e.g. 1746736509954)",
      "organizationId": "<string> (Your Organization ID)",
      "parameters": {
          "signWith": "<string>",
          "transfer": {
              "transferId": "<string>",
              "leaves": [
                  {
                      "leafId": "<string>",
                      "oldLeafDerivation": {
                          "identity": "<object>",
                          "signingLeaf": {
                              "leafId": "<string>"
                          },
                          "deposit": "<object>",
                          "staticDeposit": {
                              "index": "<number>"
                          },
                          "htlcPreimage": "<object>"
                      },
                      "newLeafDerivation": {
                          "identity": "<object>",
                          "signingLeaf": {
                              "leafId": "<string>"
                          },
                          "deposit": "<object>",
                          "staticDeposit": {
                              "index": "<number>"
                          },
                          "htlcPreimage": "<object>"
                      },
                      "refundSignature": "<string>",
                      "directRefundSignature": "<string>",
                      "directFromCpfpRefundSignature": "<string>"
                  }
              ],
              "threshold": "<number>",
              "operatorRecipients": [
                  {
                      "operatorId": "<string>",
                      "encryptionPublicKey": "<string>"
                  }
              ],
              "receiverPublicKey": "<string>"
          }
      }
  }'
  ```

  ```javascript title="JavaScript" theme={null}
  import { Turnkey } from "@turnkey/sdk-server";

  const turnkeyClient = new Turnkey({
    apiBaseUrl: "https://api.turnkey.com",
    apiPublicKey: process.env.API_PUBLIC_KEY!,
    apiPrivateKey: process.env.API_PRIVATE_KEY!,
    defaultOrganizationId: process.env.ORGANIZATION_ID!,
  });

  const response = await turnkeyClient.apiClient().sparkPrepareTransfer({
    signWith: "<string> (A Spark wallet account address identifying the wallet.)",
    transfer: { // transfer field,
      transferId: "<string> (Spark transfer identifier (UUID).)",
      leaves: [{ // Leaves being transferred.,
        leafId: "<string> (Leaf identifier (UUID).)",
        oldLeafDerivation: { // oldLeafDerivation field,
          identity: { /* object */ } // identity field,
          signingLeaf: { // signingLeaf field,
            leafId: "<string> (Unique identifier for the Spark signing leaf.)",
          },
          deposit: { /* object */ } // deposit field,
          staticDeposit: { // staticDeposit field,
            index: 0 // Index used to derive the static deposit key.,
          },
          htlcPreimage: { /* object */ } // htlcPreimage field,
        },
        newLeafDerivation: { // newLeafDerivation field,
          identity: { /* object */ } // identity field,
          signingLeaf: { // signingLeaf field,
            leafId: "<string> (Unique identifier for the Spark signing leaf.)",
          },
          deposit: { /* object */ } // deposit field,
          staticDeposit: { // staticDeposit field,
            index: 0 // Index used to derive the static deposit key.,
          },
          htlcPreimage: { /* object */ } // htlcPreimage field,
        },
        refundSignature: "<string> (Client-produced CPFP refund signature (hex-encoded), passed through verbatim into the per-operator SendLeafKeyTweak. Empty omits the field from the operator package.)",
        directRefundSignature: "<string> (Client-produced direct refund signature (hex-encoded). Passed through verbatim.)",
        directFromCpfpRefundSignature: "<string> (Client-produced direct-from-CPFP refund signature (hex-encoded). Passed through verbatim.)",
      }],
      threshold: 0 // Feldman VSS threshold for reconstructing the per-leaf tweak scalar.,
      operatorRecipients: [{ // Operators that will receive Feldman shares of the per-leaf tweak. Order must match the operators' numeric IDs in the Spark operator config - share index is the 1-based position in this list.,
        operatorId: "<string> (Spark operator identifier (UUID).)",
        encryptionPublicKey: "<string> (Operator's ECIES encryption pubkey (hex-encoded compressed secp256k1 point).)",
      }],
      receiverPublicKey: "<string> (Recipient's identity pubkey (hex-encoded compressed secp256k1 point). Each leaf's new_priv is ECIES-encrypted to this key and embedded in the per-operator package for claim-time delivery.)",
    }
  });
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "activity": {
      "id": "<activity-id>",
      "status": "ACTIVITY_STATUS_COMPLETED",
      "type": "ACTIVITY_TYPE_SPARK_PREPARE_TRANSFER",
      "organizationId": "<organization-id>",
      "timestampMs": "<timestamp> (e.g. 1746736509954)",
      "result": {
        "activity": {
          "id": "<string>",
          "organizationId": "<string>",
          "status": "<string>",
          "type": "<string>",
          "intent": {
            "sparkPrepareTransferIntent": {
              "signWith": "<string>",
              "transfer": {
                "transferId": "<string>",
                "leaves": [
                  {
                    "leafId": "<string>",
                    "oldLeafDerivation": {
                      "identity": "<object>",
                      "signingLeaf": {
                        "leafId": "<string>"
                      },
                      "deposit": "<object>",
                      "staticDeposit": {
                        "index": "<number>"
                      },
                      "htlcPreimage": "<object>"
                    },
                    "newLeafDerivation": {
                      "identity": "<object>",
                      "signingLeaf": {
                        "leafId": "<string>"
                      },
                      "deposit": "<object>",
                      "staticDeposit": {
                        "index": "<number>"
                      },
                      "htlcPreimage": "<object>"
                    },
                    "refundSignature": "<string>",
                    "directRefundSignature": "<string>",
                    "directFromCpfpRefundSignature": "<string>"
                  }
                ],
                "threshold": "<number>",
                "operatorRecipients": [
                  {
                    "operatorId": "<string>",
                    "encryptionPublicKey": "<string>"
                  }
                ],
                "receiverPublicKey": "<string>"
              }
            }
          },
          "result": {
            "sparkPrepareTransferResult": {
              "operatorPackages": [
                {
                  "operatorId": "<string>",
                  "encryptedPackage": "<string>"
                }
              ],
              "transferUserSignature": "<string>",
              "newLeafPublicKeys": [
                {
                  "leafId": "<string>",
                  "publicKey": "<string>"
                }
              ]
            }
          },
          "votes": "<array>",
          "fingerprint": "<string>",
          "canApprove": "<boolean>",
          "canReject": "<boolean>",
          "createdAt": "<string>",
          "updatedAt": "<string>"
        }
      }
    }
  }
  ```
</ResponseExample>
