> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mangopay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Submit a KYC Document

<Warning>
  **Caution – Legacy endpoints being superseded by the hosted KYC/KYB solution**

  Mangopay's [hosted KYC/KYB solution](/guides/users/verification/hosted) is becoming mandatory for all platforms (relying on the [IDV Session](/api-reference/idv-sessions/idv-session-object) object). The legacy KYC Document endpoints remain available for the sole purposes of [sending additional documents](/guides/users/verification/hosted/integration#sending-additional-documents), but this use case will also be handled by the hosted solution in future.
</Warning>

Submitting a KYC Document consists in updating the object `Status` from `CREATED` to `VALIDATION_ASKED`. 

Once submitted, Mangopay's teams review the document and validate or reject it. This process takes on average 24 hours (on bank working days).

Set up a hook for the following event types in order to be notified of the outcome:

* KYC\_SUCCEEDED
* KYC\_FAILED

### Path parameters

<ParamField path="UserId" type="string" required>
  The unique identifier of the user.
</ParamField>

<ParamField path="KycDocumentId" type="string" required>
  The unique identifier of the KYC Document.
</ParamField>

### Body parameters

<ParamField body="Status" type="string">
  **Allowed values:** VALIDATION\_ASKED

  The status of the document:

  * `CREATED` – The document container is created and files can be uploaded using the [POST Create a KYC Document Page](/api-reference/kyc-documents/create-kyc-document-page) endpoint before submission.
  * `VALIDATION_ASKED` – The document is submitted to Mangopay for validation.
  * `VALIDATED` – The document is validated by Mangopay’s teams.
  * `REFUSED` – The document is rejected by Mangopay’s teams and a new KYC Document object needs to be created to resubmit it. You can learn more about the reason why it was refused in the `RefusedReasonType` parameter.
  * `OUT_OF_DATE` – The document is downgraded and a new KYC Document object needs to be created to resubmit it.
</ParamField>

### Responses

<AccordionGroup>
  <Accordion title="200">
    <ResponseField name="Type" type="string">
      **Returned values:** `IDENTITY_PROOF`, `REGISTRATION_PROOF`, `ARTICLES_OF_ASSOCIATION`, `SHAREHOLDER_DECLARATION`, `ADDRESS_PROOF`

      The type of the document for the user verification.
    </ResponseField>

    <ResponseField name="UserId" type="string">
      The unique identifier of the user.
    </ResponseField>

    <ResponseField name="Flags" type="array">
      **Returned values:** A code from the <a href="/guides/users/verification/documents/submission/refusals" target="_blank">Flags list</a>.

      The series of codes providing more precision regarding the reason why the identity proof document was refused. You can review the explanations for each code in the <a href="/guides/users/verification/documents/submission/refusals" target="_blank">Flags list</a>.
    </ResponseField>

    <ResponseField name="Id" type="string">
      Max length: 128 characters (see [data formats](/api-reference/overview/data-formats) for details)

      The unique identifier of the object.
    </ResponseField>

    <ResponseField name="Tag" type="string">
      Max. length: 255 characters

      Custom data that you can add to this object.
    </ResponseField>

    <ResponseField name="CreationDate" type="Unix timestamp">
      The date and time at which the object was created.
    </ResponseField>

    <ResponseField name="ProcessedDate" type="Unix timestamp">
      The date and time at which the document was processed by Mangopay’s team.
    </ResponseField>

    <ResponseField name="Status" type="string">
      **Returned values:** `CREATED`, `VALIDATION_ASKED`, `VALIDATED`, `REFUSED`, `OUT_OF_DATE`

      The status of the document:

      * `CREATED` – The document container is created and files can be uploaded using the [POST Create a KYC Document Page](/api-reference/kyc-documents/create-kyc-document-page) endpoint before submission.
      * `VALIDATION_ASKED` – The document is submitted to Mangopay for validation.
      * `VALIDATED` – The document is validated by Mangopay’s teams.
      * `REFUSED` – The document is rejected by Mangopay’s teams and a new KYC Document object needs to be created to resubmit it. You can learn more about the reason why it was refused in the `RefusedReasonType` parameter.
      * `OUT_OF_DATE` – The document is downgraded and a new KYC Document object needs to be created to resubmit it.
    </ResponseField>

    <ResponseField name="RefusedReasonType" type="string">
      **Returned values:** DOCUMENT\_DO\_NOT\_MATCH\_USER\_DATA, DOCUMENT\_FALSIFIED, DOCUMENT\_HAS\_EXPIRED, DOCUMENT\_INCOMPLETE, DOCUMENT\_MISSING, DOCUMENT\_NOT\_ACCEPTED, DOCUMENT\_UNREADABLE, SPECIFIC\_CASE, UNDERAGE\_PERSON

      Returned `null` unless `Status` is `REFUSED`.

      The reason for the document refusal. See the <a href="/guides/users/verification/documents/submission/refusals">refused reason types</a> for more information depending on the document type.
    </ResponseField>

    <ResponseField name="RefusedReasonMessage" type="string">
      Max. length: 255 characters

      **Default value:** null

      Additional information about why the KYC Document was refused, provided by Mangopay’s team.
    </ResponseField>
  </Accordion>
</AccordionGroup>

<ResponseExample>
  ```json 200 theme={null}
  {
      "Type": "IDENTITY_PROOF",
      "UserId": "user_m_01J8J0Y9DPNYRA9RB532CCND9Q",
      "Flags": [],
      "Id": "kyc_01JA5M2N33ENJHWVPQXVJ6Q51P",
      "Tag": "Created using Mangopay API Postman Collection",
      "CreationDate": 1728913167,
      "ProcessedDate": null,
      "Status": "VALIDATION_ASKED",
      "RefusedReasonType": null,
      "RefusedReasonMessage": null
  }
  ```
</ResponseExample>

<RequestExample>
  ```json REST   theme={null}
  {
      "Status": "VALIDATION_ASKED"
  }  
  ```

  ```php PHP theme={null}
  <?php

  require_once 'vendor/autoload.php';

  use MangoPay\MangoPayApi;
  use MangoPay\Libraries\ResponseException as MGPResponseException;
  use MangoPay\Libraries\Exception as MGPException;

  $api = new MangoPayApi();

  $api->Config->ClientId = 'your-client-id';
  $api->Config->ClientPassword = 'your-api-key';
  $api->Config->TemporaryFolder = '/tmp/';

  try {

      $userId = '195627761';

      $kycDocument = new \MangoPay\KycDocument();
      $kycDocument->Id = '1234567';
      $kycDocument->Status = \MangoPay\KycDocumentStatus::ValidationAsked;

      $response = $api->Users->UpdateKycDocument($userId, $kycDocument);

      print_r($response);
  } catch(MGPResponseException $e) {
      print_r($e);
  } catch(MGPException $e) {
      print($e);
  }
    
  ```

  ```javascript NodeJS   theme={null}
  const mangopayInstance = require('mangopay4-nodejs-sdk')
  const mangopay = new mangopayInstance({
      clientId: 'your-client-id',
      clientApiKey: 'your-api-key',
  })

  let myUser = {
    Id: '192591410',
  }

  let myKycDocument = {
    Id: '192611019',
    Status: 'VALIDATION_ASKED',
  }

  const submitKyc = async (userId, kycDocument) => {
    return await mangopay.Users.updateKycDocument(userId, kycDocument)
      .then((response) => {
        console.info(response)
        return response
      })
      .catch((err) => {
        console.log(err)
        return false
      })
  }

  submitKyc(myUser.Id, myKycDocument)  
  ```

  ```ruby Ruby   theme={null}
  require 'mangopay'

  MangoPay.configure do |client|
      client.preproduction = true
      client.client_id = 'your-client-id'
      client.client_apiKey = 'your-api-key'
      client.log_file = File.join(Dir.pwd, 'mangopay.log')
  end

  def submitKycDocument(userId, kycDocumentId, kycDocument)
      begin
          response = MangoPay::KycDocument.update(userId, kycDocumentId, kycDocument)
          puts response
          return response
      rescue MangoPay::ResponseError => error
          puts "Failed to submit KYC Document: #{error.message}"
          puts "Error details: #{error.details}"
          return false
      end
  end

  myUser = {
      Id: '194150513'
  }

  myKycDocument = {
      Id: '194510406',
      Status: 'VALIDATION_ASKED'
  }

  submitKycDocument(myUser[:Id], myKycDocument[:Id], myKycDocument)  
  ```

  ```java Java   theme={null}
  import com.google.gson.Gson;
  import com.google.gson.GsonBuilder;
  import com.mangopay.MangoPayApi;
  import com.mangopay.core.enumerations.KycStatus;
  import com.mangopay.entities.KycDocument;

  public class SubmitKYCDoc {
       public static void main(String[] args) throws Exception {
          MangoPayApi mangopay = new MangoPayApi();
          mangopay.getConfig().setClientId("your-client-id");
          mangopay.getConfig().setClientPassword("your-api-key");

          var userId = "user_m_01HR9SZTXDRY1PCFHSJFAPC0YJ";

          KycDocument kycDoc = mangopay.getKycDocumentApi().getKycDocument("kyc_01HSB6MMPT9RPDFHSG1BN9BKPP");
          kycDoc.setStatus(KycStatus.VALIDATION_ASKED);

          KycDocument submitKycDoc = mangopay.getUserApi().updateKycDocument(userId, kycDoc);

          Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
          String prettyJson = prettyPrint.toJson(submitKycDoc);

          System.out.println(prettyJson);
      }
  }
  ```

  ```python Python   theme={null}
  from pprint import pprint
  import mangopay

  mangopay.client_id = 'your-client-id'
  mangopay.apikey = 'your-api-key'

  from mangopay.api import APIRequest
  handler = APIRequest(sandbox=True)

  from mangopay.resources import (Document, LegalUser)

  legal_user = LegalUser(
      id = '210760575'
  )

  kyc_document = Document(
      id = '211551193',
      user = legal_user,
      status = 'VALIDATION_ASKED'
  )

  submit_kyc_document = kyc_document.save()
   
  pprint(submit_kyc_document)  
  ```

  ```csharp .NET  theme={null}
  using MangoPay.SDK;
  using MangoPay.SDK.Core.Enumerations;
  using MangoPay.SDK.Entities.PUT;
  using Newtonsoft.Json;

  class Program
  {
      static async Task Main(string[] args)
      {
          MangoPayApi api = new MangoPayApi();

          api.Config.ClientId = "your-client-id";
          api.Config.ClientPassword = "your-api-key";

          var userId = "user_m_01J2TZ261WZNDM0ZDRWGDYA4GN";
          var kycDocId = "kyc_01J2V2W9CJKMS9V0SGFWHPQY87";

          var kycDoc = new KycDocumentPutDTO 
          {
              Status = KycStatus.VALIDATION_ASKED
          };

          var submitKycDoc = await api.Users.UpdateKycDocumentAsync(userId, kycDoc, kycDocId);

          string prettyPrint = JsonConvert.SerializeObject(submitKycDoc, Formatting.Indented);
          Console.WriteLine(prettyPrint);
      }
  }
  ```
</RequestExample>
