# Lean - getDisposableContractWitheIDAssertion method

This method works with the eIDAssertion and returns:

* the disposable contract (Mod_NAMCA22D)
* the privacy document url
* the T&C document url


Check [How to enroll a disposable with an assertion provided by an authorized eID](https://namirial.atlassian.net/wiki/spaces/TT/pages/90442186) for more details.

The disposable contract (Mod_NAMCA22D)

* is filled if [`eIDAssertionHolder`](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/data-objects#disposableeidassertionholder) and [`disposableContacts`](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/data-objects#disposablecontacts) are specified
* is **not** filled if [`disposableHolder`](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/data-objects#disposableholder) are **not** specified


**For the full technical reference, see the  [OpenAPI specification](/products/leandisposable/openapi/document/getdisposablecontractwitheidassertion)**.

REST API
#### Endpoint


```
POST /api/document/{lraId}/getDisposableContractWithEidAssertion
```

#### Headers

| Name | Required | Description |
|  --- | --- | --- |
| `Content-Type` | Yes | Must be `application/json`. |
| `Authorization` | Yes | Basic Auth credentials. |


#### Path parameters

| Parameter | Type | Required | Description |
|  --- | --- | --- | --- |
| `lraId` | integer | Yes | LRA identifier. |


#### Body parameters

| Parameter | Type | Required | Description |
|  --- | --- | --- | --- |
| `languageCode` | array | Yes | Language(s) of the document. ISO 639-1 alpha-2 codes. |
| `docTypes` | array | Yes | Document type(s). `1` = PDF, `2` = TXT. |
| `cert` | object | Yes | [`DisposableCertificate` object](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/data-objects#disposablecertificate). |
| `country` | string | No | Country where the end user is located. ISO 3166-1 alpha-2. If omitted, the default template for the specified `languageCode` is returned. |
| `eIDAssertionHolder` | object | No | [`DisposableeIDAssertionHolder` object](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/data-objects#disposableeidassertionholder). |
| `disposableContacts` | object | No | [`DisposableContacts` object](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/data-objects#disposablecontacts). |


#### Request example


```json
{
    "eIDAssertionHolder": {
        "assertion": "encoded base64 assertion",
        "country": "IT",
        "eIDType": "SPID"
    },
    "cert": {
        "type": "DISPOSABLE_30_DAYS",
        "withoutUsageLimitLRA": true
    },
    "contacts": {
        "email": "user@example.com",
        "mobile": "+390000000000"
    },
    "languageCode": ["IT"],
    "docTypes": [1]
}
```

#### Response examples

**200 — Contract returned**


```json
[
    {
        "languageCode": "IT",
        "docTypes": 2,
        "doc": "encoded file",
        "privacy_link": "https://docs.namirialtsp.com/documents/Mod_NAM_GDPR03D_ITA_IT.pdf",
        "termsAndConditions_link": "https://docs.namirialtsp.com/documents/Mod_NAM_CA01D_ITA_IT.pdf",
        "checkBoxes": [
            "Al fine di perfezionare la sottoscrizione del Modulo di richiesta con firma elettronica, è necessario accettare i termini e le condizioni della fornitura richiesta contrassegnando con segno di spunta le caselle sottostanti:",
            "(1) Io sottoscritto/a dichiaro quanto indicato nel QUADRO E - AUTOCERTIFICAZIONE E SOTTOSCRIZIONE DA PARTE DEL TITOLARE.",
            "(2) Io sottoscritto/a accetto le Condizioni Generali di Contratto (Mod.NAM CA01) e le clausole vessatorie riportate nel QUADRO F – CLAUSOLE VESSATORIE"
        ]
    }
]
```

SOAP API
The SOAP interface is deprecated. Use the REST API instead.

**Method:**  getDisposableContractWitheIDAssertion

| **Parameter** | **Description** | **Mandatory** | **Values** |
|  --- | --- | --- | --- |
| lraid | The LRA identification code | YES |  |
| country | Country code. The country where the final user is located. The country code is optional, if not specified the default template for the specified languageCode is returned. It is necessary when a LRA needs contracts in several languages but for different legislations. It means for example that the French contract for France is different from French contract for Belgium. | NO | Country code defined by [ISO 3166-1 alpha-2 codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) |
| languageCode | Specify the languages of the document. You can use more than one value. | YES | Language code defined by ISO 639-1 alpha-2 codes ([ISO 639-1:2002](https://en.wikipedia.org/wiki/ISO_639-1)) |
| docTypes | Specify the type of document. Allowed values: 1 : PDF 2 :TXT You specify more than one value. | YES |  |
| eIDAssertionHolder | [`DisposableeIDAssertionHolder` object](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/data-objects#disposableeidassertionholder) | NO |  |
| disposableContacts | [`DisposableContacts` object](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/data-objects#disposablecontacts) | NO |  |
| cert | [`DisposableCertificate` object](/products/leandisposable/enterprise-documentation/developer-documentation/api-references/data-objects#disposablecertificate). | YES |  |


This method returns a list of **HolderContract** object:

* languageCode – the language of the document
* docTypes – doc type
* doc - document base64 encoded (Mod_NAMCA22D)
* privacyLink - the link/url to download the privacy document (Mod_NAMGDPR03D)
* termAndConditionLink - the link/url to download the term and condition document (Mod_NAMCA01D)
* checkBoxes - a list of the strings to be used for the checkboxes option


#### Request example


```xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.ws.nam/">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:getDisposableContractWitheIDAssertion>
         <eIDAssertionHolder>
            <assertion></assertion>
            <country>IT</country>
            <eIDType>SPID</eIDType>
         </eIDAssertionHolder>
         <cert>          
            <type>DISPOSABLE_30_DAYS</type>
         </cert>
         <contacts>
            <email>yyy@xxx.com</email>
            <mobile>3333333333</mobile>
         </contacts>
         <lraid>111</lraid>
         <languageCode>IT</languageCode>
         <docTypes>1</docTypes>
      </ser:getDisposableContractWitheIDAssertion>
   </soapenv:Body>
</soapenv:Envelope>
```

#### Response example


```xml
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns2:getDisposableContractResponse xmlns:ns2="http://service.ws.nam/">
         <return>
            <doc>JVBERi0xLjQKJeLjz9MKO....</doc> <!-- base64 -->
            <docTypes>1</docTypes>
            <languageCode>en</languageCode>
            <privacy_link>https://docs.namirialtsp.com/documents/privacy_en.pdf</privacy_link>
            <termsAndConditions_link>https://docs.namirialtsp.com/documents/EN_Mod_NAM_CA01D.pdf</termsAndConditions_link>
            <checkBoxes>In order to sign with electronic signature the Application Form, you need to accept the terms and conditions by checking the boxes below:</checkBoxes>
            <checkBoxes>(1) I certify the content of SECTION E - SELF CERTIFICATION BY THE HOLDER</checkBoxes>
            <checkBoxes>(2) I accept the General Terms and Conditions (Mod.NAMCA01D) and the one-sided clauses set forth in SECTION F - ONE-SIDED CLAUSES</checkBoxes>          
         </return>
         <return>
            <doc>RU1JVEVSRSBDRVJ...</doc>
            <docTypes>2</docTypes>
            <languageCode>en</languageCode>
            <privacy_link>https://docs.namirialtsp.com/documents/privacy_en.pdf</privacy_link>
            <termsAndConditions_link>https://docs.namirialtsp.com/documents/EN_Mod_NAM_CA01D.pdf</termsAndConditions_link>
            <checkBoxes>In order to sign with electronic signature the Application Form, you need to accept the terms and conditions by checking the boxes below:</checkBoxes>
            <checkBoxes>(1) I certify the content of SECTION E - SELF CERTIFICATION BY THE HOLDER</checkBoxes>
            <checkBoxes>(2) I accept the General Terms and Conditions (Mod.NAMCA01D) and the one-sided clauses set forth in SECTION F - ONE-SIDED CLAUSES</checkBoxes>
         </return>
      </ns2:getDisposableContractResponse>
   </soap:Body>
</soap:Envelope>
```

#### Error codes

The main errors that can be found within this method are (all return HTTP `500`):

| Error code | Description |
|  --- | --- |
| [2](/products/leandisposable/enterprise-documentation/developer-documentation/integration-guide/lean-ig-how-to-handle-errors#error-2-empty-field) | Some required fields are missing |
| [235](/products/leandisposable/enterprise-documentation/developer-documentation/integration-guide/lean-ig-how-to-handle-errors#error-235--wrong-assertion) | Wrong assertion |
| [237](/products/leandisposable/enterprise-documentation/developer-documentation/integration-guide/lean-ig-how-to-handle-errors#error-237--the-assertion-is-expired) | The assertion is expired |
| [238](/products/leandisposable/enterprise-documentation/developer-documentation/integration-guide/lean-ig-how-to-handle-errors#error-238--the-assertion-signature-is-invalid) | The assertion signature is invalid |
| [241](/products/leandisposable/enterprise-documentation/developer-documentation/integration-guide/lean-ig-how-to-handle-errors#error-241-lra-not-authorized-to-use-this-type-of-otp) | LRA not authorized to use this OTP type |
| [2083](/products/leandisposable/enterprise-documentation/developer-documentation/integration-guide/lean-ig-how-to-handle-errors#error-2083contract-template-not-found) | Contract template not found |
| [2084](/products/leandisposable/enterprise-documentation/developer-documentation/integration-guide/lean-ig-how-to-handle-errors#error-2084-the-insert-language-was-not-found-the-allowed-languages-are) | The specified language was not found |
| [10094](/products/leandisposable/enterprise-documentation/developer-documentation/integration-guide/lean-ig-how-to-handle-errors#error-10094-product-does-not-exist) | Product does not exist |


For authentication errors, see [Authentication](/products/leandisposable/enterprise-documentation/developer-documentation/authentication).

For details on how to handle errors, see [How to handle errors](/products/leandisposable/enterprise-documentation/developer-documentation/integration-guide/lean-ig-how-to-handle-errors).