> For the complete documentation index, see [llms.txt](https://docs.zapsign.com.br/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zapsign.com.br/espanol/facilitadores/sdks/typescript-sdk/documents-requests/createdocfrombase64async.md).

# createDocFromBase64Async

### Overview

Parameters:&#x20;

* [DocFromPdf](/espanol/facilitadores/sdks/typescript-sdk/used-classes/body/docfrompdf.md)

Return:

* [DocAsyncResponse](/espanol/facilitadores/sdks/typescript-sdk/used-classes/response/docasyncresponse.md) - In case of success
* Exception - In case of failure

To create this document we will need:

* set your apiToken;
* build your signers;
* build the document;
* call the method;

### How to use:

Save your [apiToken](/espanol/master.md):

<pre class="language-typescript"><code class="lang-typescript"><strong>const apiToken: string = "YOUR TOKEN";
</strong></code></pre>

Set your base64:

```typescript
const base64: string = "JVBERi0xLjYKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTG..."
```

Build your signers with the [Signer](https://docs.zapsign.com.br/facilitadores/sdks/sdk-em-typescript/classes-usadas/body/signer) class:&#x20;

```typescript
const signer1: Signer = new SignerBuilder()
                .withName("My First Signer")
                .build();
                
const signer2: Signer = new SignerBuilder()
                .withName("My Second Signer")
                .withEmail("test@test.com")
                .withLockEmail(true)
                .withLockPhone(true)
                .withPhoneCountry("55")
                .withPhoneNumber("99999999999")
                .withAuthMode("assinaturaTela") // draw on screen
                .withSendAutomaticEmail(false)
                .withSendAutomaticWhatsapp(false)
                .build();
                
let signers: Signer[] = [];
                
signers.push(signer1, signer2);
```

Build your document with the [DocFromPdfBase64](broken://spaces/-MGLHwoaRaiLL9MSXMX9/pages/-MWtos8YoqMafOsi5RI7) class:

```typescript
const docFromPdfBase64 = DocFromPdfBase64Builder()
    .withSandbox(false)
    .withName("My Contract")
    .withBrandPrimaryColor("#000000")
    .withBase64Pdf(base64)
    .build();
```

Finally, call the createDocFromPdfBase64 method to get the [DocResponse ](https://docs.zapsign.com.br/facilitadores/sdks/sdk-em-typescript/classes-usadas/response/docasyncresponse)or an error message:

```typescript
try {
    docResponse = new DocRequests(apiToken).createDocFromPdfBase64(docFromPdfBase64);
    jsonDocResponse: string = new JsonConverter().docResponseToJson(docResponse);
    console.log(jsonDocResponse);
} catch {
     console.log(Err);
}
```

### Example:

```typescript
import DocRequests from "sdk-node-typescript-zapsign/src/docs/DocRequests";
import { JsonConverter } from "sdk-node-typescript-zapsign/src/services/JsonConverter";

const apiToken: string = "YOUR TOKEN";

const base64: string = "JVBERi0xLjYKJcOkw7zDtsOfCjIgMCBvYmoKP...";

const signer1: Signer = new SignerBuilder()
                .withName("My First Signer")
                .build();

const signer2: Signer = new SignerBuilder()
                .withName("My Second Signer")
                .withEmail("test@test.com")
                .withLockEmail(true)
                .withLockPhone(true)
                .withPhoneCountry("55")
                .withPhoneNumber("99999999999")
                .withAuthMode("assinaturaTela") // draw on screen
                .withSendAutomaticEmail(false)
                .withSendAutomaticWhatsapp(false)
                .build();
                
let signers: Signer[] = [];
                
signers.push(signer1, signer2);

const docFromPdfBase64 = DocFromPdfBase64Builder()
    .withSandbox(false)
    .withName("My Contract")
    .withBrandPrimaryColor("#000000")
    .build();

async function exempleDocFRomPdfBase64Async() {
    try {
                docResponse: DocResponse = await new DocRequests(apiToken).createDocFromPdfBase64Async(docFromPdfBase64);
                jsonDocResponse: string = new JsonConverter().docResponseToJson(docResponse);
                console.log(jsonDocResponse);
    } catch(Err) {
                console.log(Err);
    }
  }
}
```
