# Retrieve employments for a link

Retrieve employments from an existing link.

Endpoint: POST /api/br/employments/
Version: 1.223.0
Security: basicAuth

## Header parameters:

  - `X-Belvo-Request-Mode` (string)
    Recommended header parameter to make your POST request asynchronous (thus preventing timeouts and improving your data flow).

When you make an asynchronous request, Belvo responds with a 202 - Accepted payload, including the request_id. Once we have retrieved the requested information, you will receive a webhook with the link and request IDs.
    Enum: "async"

## Query parameters:

  - `omit` (string)
    Omit certain fields from being returned in the response. For more information, see our Filtering responses DevPortal article.

  - `fields` (string)
    Return only the specified fields in the response. For more information, see our Filtering responses DevPortal article.

## Request fields (application/json):

  - `link` (string, required)
    The link.id you want to retrieve information for.
    Example: "c81a1dea-6dd6-4999-8b9f-541ee8197058"

  - `date_from` (string)
    The date from which you want to start getting data for, in YYYY-MM-DD format.


⚠️ The value of date_from cannot be greater than date_to.
    Example: "2020-08-05"

  - `date_to` (string)
    The date you want to stop getting data for, in YYYY-MM-DD format.


⚠️ The value of date_to cannot be greater than today's date (in other words, no future dates).
    Example: "2020-10-05"

  - `save_data` (boolean)
    Indicates whether or not to persist the data in Belvo. By default, this is set to true and we return a 201 Created response.

When set to false, the data won't be persisted and we return a 200 OK response.
    Example: true

## Response 200 fields (application/json):

  - `id` (string, required)
    Belvo's unique identifier for the current item.
    Example: "0d3ffb69-f83b-456e-ad8e-208d0998d71d"

  - `link` (string,null, required)
    The link.id the data belongs to.
    Example: "30cb4806-6e00-48a4-91c9-ca55968576c8"

  - `created_at` (string, required)
    The ISO-8601 timestamp of when the data point was created in Belvo's database.
    Example: "2022-02-09T08:45:50.406032Z"

  - `collected_at` (string, required)
    The ISO-8601 timestamp when the data point was collected.
    Example: "2022-02-09T08:45:50.406032Z"

  - `start_date` (string, required)
    The employee's start date at the employer, in YYYY-MM-DD format.
    Example: "2022-01-01"

  - `end_date` (string,null, required)
    The employee's end date at the employer, in YYYY-MM-DD format. If null, the employee is still working at the employer.
    Example: "2023-01-01"

  - `employer_data` (object, required)
    Details regarding the employer.

  - `employer_data.name` (string, required)
    The name of the employer.
    Example: "Wayne Industries"

  - `employer_data.code` (string, required)
    The institution's unique code for the employer.
    Example: "49430669"

  - `employer_data.economic_activity` (string, required)
    The main economic activity the employer is involved in. For Brazil, this is the Classificação Nacional de Atividades Econômicas (CNAE) code.
    Example: "6421-2 - BANCOS COMERCIAIS"

  - `occupations` (array, required)
    The employee's occupations at the employer.

  - `occupations.start_date` (string, required)
    The date that the employee started the position, in YYYY-MM-DD format.
    Example: "2022-01-01"

  - `occupations.end_date` (string,null, required)
    The date that the employee stopped working in this position, in YYYY-MM-DD format. If null, this means that the employee is still holds this position.
    Example: "2023-01-01"

  - `occupations.description` (string, required)
    The position the employee held. For Brazil, this description must be according to the Ministry of Labour and listed in the Classificação Brasileira de Ocupações (CBO).
    Example: "ANALISTA DE PRODUTOS BANCARIOS"

  - `occupations.name` (string, required)
    The employees occupation, as provided by the employer.
    Example: "ANALISTA DE PRODUTOS BANCARIOS - 2525-40"

  - `occupations.locale` (string, required)
    Where the employee fufilled their duties. For Brazil, this can be either:
  -  Urbana (Urban)
  - Rural (Rural)
  - Não Identificado
  - null
    Example: "Urbana"

  - `salaries` (array, required)
    The salaries the employee received from the employer.

  - `salaries.base_amount` (number, required)
    The base amount of the salary, before any deductions or bonuses.
    Example: 1033.09

  - `salaries.retained_amount` (number, required)
    The amount retained by Brazil's Instituto Nacional do Seguro Social (INSS).
    Example: 0.01

  - `salaries.type` (string,null)
    The type of salary.

We return one of the following values:
  - REGULAR
  - THIRTEENTH
  - VOLUNTARY
  - RETIREMENT
  - null
    Enum: "REGULAR", "THIRTEENTH", "VOLUNTARY", "RETIREMENT", null

  - `salaries.month` (string, required)
    The month that the employee received their salary, in YYYY-MM format.
    Example: "2022-01"

  - `salaries.currency` (string, required)
    The three-letter currency code (ISO-4217).
    Example: "BRL"

## Response 202 fields (application/json):

  - `request_id` (string)
    The unique ID for this request. We recommend you store this value to later identify which webhook event relates to an asynchronous request.
    Example: "b5d0106ac9cc43d5b36199fe831f6bbe"

## Response 408 fields (application/json):

  - `code` (string)
    A unique error code (request_timeout) that allows you to classify and handle the error programmatically.


ℹ️ Check our DevPortal for more information on how to handle 408 request_timeout errors.
    Example: "request_timeout"

  - `message` (string)
    A short description of the error. 


For request_timeout errors, the description is:
  
  - The request timed out, you can retry asking for less data by changing your query parameters.
    Example: "The request timed out, you can retry asking for less data by changing your query parameters"

  - `request_id` (string)
    A 32-character unique ID of the request (matching a regex pattern of: [a-f0-9]{32}). Provide this ID when contacting the Belvo support team to accelerate investigations.
    Example: "9e7b283c6efa449c9c028a16b5c249fb"

## Response 428 fields (application/json):

  - `code` (string)
    A unique error code (token_required) that allows you to classify and handle the error programmatically.
ℹ️ Check our DevPortal for more information on how to handle 428 token_required errors.
    Example: "token_required"

  - `message` (string)
    A short description of the error. 
For token_required errors, the description is:
  
  - A MFA token is required by the institution to login.
    Example: "A MFA token is required by the institution to login"

  - `request_id` (string)
    A 32-character unique ID of the request (matching a regex pattern of: [a-f0-9]{32}). Provide this ID when contacting the Belvo support team to accelerate investigations.
    Example: "9e7b283c6efa449c9c028a16b5c249fb"

  - `session` (string)
    A 32-character unique ID of the login session (matching a regex pattern of: [a-f0-9]{32}).
    Example: "2675b703b9d4451f8d4861a3eee54449"

  - `expiry` (integer)
    Session duration time in seconds.
    Example: 9600

  - `link` (string)
    Unique identifier created by Belvo, used to reference the current
Link.
    Example: "30cb4806-6e00-48a4-91c9-ca55968576c8"

  - `token_generation_data` (object)
    Details on how to generate the token.

  - `token_generation_data.instructions` (string)
    Instructions for token generation.
    Example: "Use this code to generate the token"

  - `token_generation_data.type` (string)
    Type of the data to generate the token (QR code, numeric
challenge).
    Example: "numeric"

  - `token_generation_data.value` (string)
    Value to use to generate the token.
    Example: "12345"

  - `token_generation_data.expects_user_input` (boolean)
    Indicates whether the user needs to provide input in order to complete the authentication.
When set to false, your user may need to:
- confirm the login on another device
- scan a QR code
You will still need to make a PATCH call to complete the request.
    Example: true

## Response 500 fields (application/json):

  - `code` (string)
    A unique error code (unexpected_error) that allows you to classify and handle the error programmatically.


ℹ️ Check our DevPortal for more information on how to handle 500 unexpected_error errors.
    Example: "unexpected_error"

  - `message` (string)
    A short description of the error. 


For unexpected_error errors, the description is:
  
  - Belvo is unable to process the request due to an internal system issue or to an unsupported response from an institution.
    Example: "Belvo is unable to process the request due to an internal system issue or to an unsupported response from an institution"

  - `request_id` (string)
    A 32-character unique ID of the request (matching a regex pattern of: [a-f0-9]{32}). Provide this ID when contacting the Belvo support team to accelerate investigations.
    Example: "9e7b283c6efa449c9c028a16b5c249fb"


