> You are reading the Docusign Developer Documentation. For clean Markdown of any page, append .md to the page URL.
>
> Documentation indexes by section:
> - APIs and SDKs: https://docusign.docs.buildwithfern.com/docs/llms.txt
> - Platform 101: https://docusign.docs.buildwithfern.com/platform/llms.txt
> - Extension Apps: https://docusign.docs.buildwithfern.com/extension-apps/llms.txt
> - Docusign CLI: https://docusign.docs.buildwithfern.com/docusign-cli/llms.txt
>
> Authentication (OAuth, JWT Grant, M2M): https://docusign.docs.buildwithfern.com/platform/auth
> Webhooks and Connect: https://docusign.docs.buildwithfern.com/platform/webhooks
>
> OpenAPI specifications: https://docusign.docs.buildwithfern.com/openapi.json
> MCP server: https://docusign.docs.buildwithfern.com/_mcp/server

# How to sync offline signed envelopes

> Learn how to sync all pending envelopes that have been signed offline on the user’s mobile device with the Android SDK.

This topic demonstrates how to sync all pending envelopes that have been signed offline on the user’s mobile device. An offline signed envelope can be synced when:

* an envelope’s local [In Person Signer](https://support.docusign.com/s/document-item?rsc_301\&bundleId=gav1643676262430\&topicId=hak1578456316043.html) and/or self-signer has finished signing and either has:

  * no pending local signer(s) or
  * only pending remote signer(s) next in the signing order.

Once an envelope has been successfully synced, it is deleted from the cache on the device.

## Required data

Running the code in this how-to requires this data:

| Data element                                    | Description                                                                                                                                  |
| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| Local envelope(s) that have been signed offline | The user’s mobile device must have one or more locally stored signed envelopes that do not have any local signers next in the signing order. |

## Step 1. Log in to Docusign

To make the API call shown in this how-to, you must be logged in to Docusign.

See [How to log in to Docusign from your app](/docs/mobile-sdks/android-sdk/how-to/log-in) for details.

## Step 2. Sync offline signed envelopes

Use the method shown to sync offline signed envelopes.

**`Java`**

```java title="Java"
DSEnvelopeDelegate envelopeDelegate = DocuSign.getInstance().getEnvelopeDelegate();
envelopeDelegate.syncAllEnvelopes(new DSSyncAllEnvelopesListener() {
    @Override
    public void onStart() {
        Log.d("syncAllEnvelopes", "Sync started");
    }

    @Override
    public void onComplete(List<String> failedEnvelopeIdList) {
        Log.d("syncAllEnvelopes", "Sync complete");
    }

    @Override
    public void onEnvelopeSyncError(DSSyncException exception, String localEnvelopeId, Integer syncRetryCount) {
        Log.e("syncAllEnvelopes", exception.getLocalizedMessage());
    }

    @Override
    public void onEnvelopeSyncSuccess(String localEnvelopeId, String serverEnvelopeId) {
        Log.d("syncAllEnvelopes", "Sync success");
    }

    @Override
    public void onError(DSException exception) {
        Log.e("syncAllEnvelopes", exception.getLocalizedMessage());
    }

}, true);
```

**`Kotlin`**

```kotlin title="Kotlin"
val envelopeDelegate = DocuSign.getInstance().getEnvelopeDelegate()
envelopeDelegate.syncAllEnvelopes(object : DSSyncAllEnvelopesListener {
    override fun onStart() {
        Log.d("syncAllEnvelopes", "Sync started")
    }

    override fun onComplete(failedEnvelopeIdList: List<String>?) {
        Log.d("syncAllEnvelopes", "Sync complete")
    }

    override fun onEnvelopeSyncError(
        exception: DSSyncException,
        localEnvelopeId: String,
        syncRetryCount: Int?
    ) {
        Log.e("syncAllEnvelopes", exception.localizedMessage)
    }

    override fun onEnvelopeSyncSuccess(localEnvelopeId: String, serverEnvelopeId: String?) {
        Log.d("syncAllEnvelopes", "Sync success")
    }

    override fun onError(exception: DSException) {
        Log.e("syncAllEnvelopes", exception.localizedMessage)
    }
}, true)
```

## Expected response

If the call is successful, the `onEnvelopeSyncSuccess` method in the listener defined in the previous step will be triggered for each envelope successful sync. Once all pending envelopes are synced successfully, the `onComplete` method is triggered.

## Next steps

* Learn [How to create an envelope for offline signing (PDF)](/docs/mobile-sdks/android-sdk/how-to/offline-signing-pdf).
* See [How to cache an existing unsigned envelope to use offline](/docs/mobile-sdks/android-sdk/how-to/cache-envelope).
* Learn [How to start the signing process for an unsigned envelope without connectivity (offline)](/docs/mobile-sdks/android-sdk/how-to/start-signing-offline).
* See [Preparing envelopes for mobile offline signing](https://support.docusign.com/s/document-item?rsc_301\&bundleId=gub1579795684748\&topicId=rxa1579795665285.html).