﻿---
sidebar_position: 1
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Get token
 Gets a token based on account ID and password



`Function GetToken(Val Account, Val Password, TestAPI = False) Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Account | --account | String | &#x2714; | Client identifier (Account) |
  | Password | --pass | String | &#x2714; | Secret key (Password) |
  | TestAPI | --testapi | Boolean | &#x2716; | Flag to use test API for requests |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from CDEK

<br/>

:::tip
Method at API documentation: [Client authorization](https://api-docs.cdek.ru/33828799.html)
:::
<br/>



```bsl title="1C:Enterprise/OneScript code example"
    Account  = "wqGwiQx0gg8mLtiEKsUinjVSICCjtTEP";
    Password = "RmAmgvSgSl...";

    Result = OPI_CDEK.GetToken(Account, Password, True);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            oint cdek GetToken \
             --account "wqGwiQx0gg8mLtiEKsUinjVSICCjtTEP" \
             --pass "***" \
             --testapi "***"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            oint cdek GetToken ^
             --account "wqGwiQx0gg8mLtiEKsUinjVSICCjtTEP" ^
             --pass "***" ^
             --testapi "***"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJsb2NhdGlvbjphbGwiLCJvcmRlcjphbGwiLCJwYXltZW50OmFsbCJdLCJleHAiOjE3Mjk1Mzg4MjQsImF1dGhvcml0aWVzIjpbInNoYXJkLWlkOnJ1LTAxIiwiY2xpZW50LWNpdHk60J3QvtCy0L7RgdC40LHQuNGA0YHQuiwg0J3QvtCy0L7RgdC40LHQuNGA0YHQutCw0Y8g0L7QsdC70LDRgdGC0YwiLCJhY2NvdW50LWxhbmc6cnVzIiwiY29udHJhY3Q60JjQnC3QoNCkLdCT0JvQky0yMiIsImFjY291bnQtdXVpZDplO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