# addExtraDoc

### Overview

Parameters:

* [ExtraDoc](/english/facilitators/sdks/java-sdk/used-classes/body/extradoc.md)

Return:

* [ExtraDocResponse](/english/facilitators/sdks/java-sdk/used-classes/response/extradocresponse.md) - success
* Exception - failure

To add this extra document, we need:

* set your api token.
* set your doc token.
* set your extra doc.
* call the method.

### Usage:

Import the relevant components:

```java
import body.doc.ExtraDoc;
import docs.DocRequests;
import response.ExtraDocResponse;

import services.JsonConverter;
```

Set your [Api Token](/english/master.md):

```java
String apiToken = "YOUR TOKEN";
```

Set your doc token.

```java
String docToken = "DOC TOKEN";
```

Set your extra doc with class with the class [ExtraDoc](/english/documentos/adicionar-anexo-documento-extra.md):

```java
ExtraDoc extraDoc = ExtraDoc.extraDocBuilder()
    .name("Extra doc")
    .url_pdf("https://zapsign.s3.amazonaws.com/2022/1/pdf/63d19807-cbfa-4b51-8571-215ad0f4eb98/ca42e7be-c932-482c-b70b-92ad7aea04be.pdf")
    .build();

```

Call the method addExtraDoc and receive the [ExtraDocResponse](/english/facilitators/sdks/java-sdk/used-classes/response/extradocresponse.md) class or an error message as a response:

```java
try {
    ExtraDocResponse extraDocResponse = new DocRequests(apiToken).addExtraDoc(docToken, extraDoc);
    String jsonExtraDocs = new JsonConverter().extraDocToJson(extraDocResponse);
    System.out.println(jsonExtraDocs);
}
catch(Exception exceptionError) {
    System.out.println(exceptionError.getMessage());
}
```

### Example:

```java
import body.doc.ExtraDoc;
import docs.DocRequests;
import response.ExtraDocResponse;
import services.JsonConverter;

public class AddExtraDoc {
    public static void main(String[] args) throws Exception {
        String apiToken = "YOUR TOKEN";

        String docToken = "DOC TOKEN";

        ExtraDoc extraDoc = ExtraDoc.extraDocBuilder()
                .name("Extra doc")
                .url_pdf("https://zapsign.s3.amazonaws.com/2022/1/pdf/63d19807-cbfa-4b51-8571-215ad0f4eb98/ca42e7be-c932-482c-b70b-92ad7aea04be.pdf")
                .build();

        try {
            ExtraDocResponse extraDocResponse = new DocRequests(apiToken).addExtraDoc(docToken, extraDoc);
            String jsonExtraDocs = new JsonConverter().extraDocToJson(extraDocResponse);
            System.out.println(jsonExtraDocs);
        }
        catch(Exception exceptionError) {
            System.out.println(exceptionError.getMessage());
        }
    }
}
```


---

# 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/english/facilitators/sdks/java-sdk/documents-requests/addextradoc.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.
