# 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);
    }
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zapsign.com.br/espanol/facilitadores/sdks/typescript-sdk/documents-requests/createdocfrombase64async.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
