> 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/facilitadores/sdks/sdk-em-java/requisicoes-para-documentos/createdocfrombase64async.md).

# createDocFromBase64Async

Criar documento via pdf de um base64 Assincrono

### Visão geral

Parâmetros:&#x20;

* [DocFromPdfBase64](https://docs.zapsign.com.br/facilitadores/sdks/sdk-em-java/classes-usadas/body/docfrompdfbase64.md)

Retorno:

* [DocAsyncResponse ](https://docs.zapsign.com.br/facilitadores/sdks/sdk-em-java/classes-usadas/response/docasyncresponse.md)- caso sucesso
* Exception - caso falha

Para criar esse documento precisamos:

* definir seu token api.
* definir o base64 do pdf.
* definir os signatários.
* definir o documento.
* chamar o método.

### Uso:

Importe os componentes relevantes:

```
import body.doc.DocFromPdfBase64;
import body.signer.Signer;
import docs.DocRequests;
import response.DocResponse;
import services.JsonConverter;

import java.io.IOException;
import java.util.ArrayList;
```

Salve seu [Api Token](https://docs.zapsign.com.br/master.md):

```
String apiToken = "SEU TOKEN";
```

Salve seu base64:

```
String base64 = "JVBERi0xLjYKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTG..."
```

Crie seus signatários com a classe [Signer](https://docs.zapsign.com.br/facilitadores/sdks/sdk-em-java/classes-usadas/body/signer.md):

```
Signer signer1 = Signer.builder()
                .name("My First Signer")
                .build();

Signer signer2 = Signer.builder()
                .name("My Second Signer")
                .email("test@test.com")
                .lock_email(true)
                .lock_phone(true)
                .phone_country("55")
                .phone_number("99999999999")
                .auth_mode("assinaturaTela")
                .send_automatic_email(false)
                .send_automatic_whatsapp(false)
                .build();
                
ArrayList<Signer> signers = new ArrayList<>();
        signers.add(signer1);
        signers.add(signer2);
```

Defina seu documento com a classe [DocFromPdfBase64](https://docs.zapsign.com.br/facilitadores/sdks/sdk-em-java/classes-usadas/body/docfrompdfbase64.md):

```
DocFromPdfBase64 docFromPdfBase64 = DocFromPdfBase64.docFromPdfBase64Builder()
                .name("My Contract")
                .brand_primary_color("#000000")
                .lang("pt-br")
                .signers(signers)
                .base64_pdf(base64)
                .build();

```

Chame o método createDocFromPdfBase64 e receba como resposta a classe [docAsyncResponse  ](https://docs.zapsign.com.br/facilitadores/sdks/sdk-em-java/classes-usadas/response/docasyncresponse.md)ou uma mensagem de erro:

```
try {
    DocAsyncResponse docAsyncResponse = new DocRequests(apiToken).createDocFromPdfBase64Async(docFromPdfBase64);
    String jsonDocResponse = new JsonConverter().docAsyncResponseToJson(docAsyncResponse);
    System.out.println(jsonDocResponse);
}
catch(Exception exceptionError) {
    System.out.println(exceptionError.getMessage());
}
```

### Exemplo completo:

```
import body.doc.DocFromPdfBase64;
import body.signer.Signer;
import docs.DocRequests;
import response.DocResponse;
import services.JsonConverter;

import java.io.IOException;
import java.util.ArrayList;
public class CreateDocFromBase64PdfAssync {
    public static void main(String[] args) throws IOException, InterruptedException  {
        String apiToken = "SEU TOKEN";
        String base64 = "JVBERi0xLjYKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTG..."

                Signer signer1 = Signer.builder()
                .name("My First Signer")
                .build();

        Signer signer2 = Signer.builder()
                .name("My Second Signer")
                .email("test@test.com")
                .lock_email(true)
                .lock_phone(true)
                .phone_country("55")
                .phone_number("99999999999")
                .auth_mode("assinaturaTela")
                .send_automatic_email(false)
                .send_automatic_whatsapp(false)
                .build();

        ArrayList<Signer> signers = new ArrayList<>();
        signers.add(signer1);
        signers.add(signer2);

        DocFromPdfBase64 docFromPdfBase64 = DocFromPdfBase64.docFromPdfBase64Builder()
                .name("My Contract")
                .brand_primary_color("#000000")
                .lang("pt-br")
                .signers(signers)
                .base64_pdf(base64)
                .build();


        try {
            DocAsyncResponse docAsyncResponse = new DocRequests(apiToken).createDocFromPdfBase64Async(docFromPdfBase64);
            String jsonDocResponse = new JsonConverter().docAsyncResponseToJson(docAsyncResponse);
            System.out.println(jsonDocResponse);
        }
        catch(Exception exceptionError) {
            System.out.println(exceptionError.getMessage());
        }
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.zapsign.com.br/facilitadores/sdks/sdk-em-java/requisicoes-para-documentos/createdocfrombase64async.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
