---
title: "CreateToken"
canonical: "https://docs.dk.is/space/DEV/10354701/CreateToken"
format: markdown
---
This function is used to create a [token ](https://dkdocs.atlassian.net/wiki/spaces/DEV/pages/10354737)that is assigned to a user and company

## Parameters

Supply the following

1. UserName - [string](https://dkdocs.atlassian.net/wiki/pages/createpage.action?spaceKey=dev&title=string&linkCreation=true&fromPageId=10354701)  
The id of the dk user that the [token](https://dkdocs.atlassian.net/wiki/spaces/DEV/pages/10354737) will be assigned to
2. Password - [string](https://dkdocs.atlassian.net/wiki/pages/createpage.action?spaceKey=dev&title=string&linkCreation=true&fromPageId=10354701)  
The password associated with the dk user
3. Company - [string](https://dkdocs.atlassian.net/wiki/pages/createpage.action?spaceKey=dev&title=string&linkCreation=true&fromPageId=10354701)  
 The company id that the token will be linked to
4. AppID - [string](https://dkdocs.atlassian.net/wiki/pages/createpage.action?spaceKey=dev&title=string&linkCreation=true&fromPageId=10354701)  
The application id that is assigned to the [token](https://dkdocs.atlassian.net/wiki/spaces/DEV/pages/10354737)

## Returns

the function return the following

- TToken  
this token should then be used to [authenticate](https://dkdocs.atlassian.net/wiki/spaces/DEV/pages/10354695) to the service for other calls

 

> ℹ️ Note : Tokens only have the lifespan of 5 day´s and need to be refreshed using the MasterToken

## Related articles



> Macro (contentbylabel)

> Macro (details)
> 
> | **Related issues** |  |
> | --- | --- |