# Tokens

## createToken

> This method provides the required authentication token to perform GBDS operations.

```json
{"openapi":"3.0.1","info":{"title":"GBDS API","version":"4.7.0"},"servers":[{"url":"http://<ip>:8085/gbds/v2"}],"paths":{"/tokens":{"post":{"description":"This method provides the required authentication token to perform GBDS operations.","tags":["tokens"],"operationId":"createToken","summary":"createToken","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTokenRequest"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTokenResponse"}}}},"400":{"description":"Validation error, expired token, invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}},"401":{"description":"Expired token, invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecurityError"}}}},"422":{"description":"Invalid token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecurityError"}}}},"500":{"description":"Internal error, unknown token Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalError"}}}}}}}},"components":{"schemas":{"CreateTokenRequest":{"type":"object","properties":{"data":{"type":"object","properties":{"grantType":{"description":"How the token will be generated. To generate a new token from user credentials, use grantType =  CREDENTIALS. To generate a new token using a currently valid token, use grantType = TOKEN.","type":"string","enum":["CREDENTIALS","TOKEN"]},"userName":{"description":"User ID.","type":"string"},"userPassword":{"description":"User password.","type":"string"},"token":{"description":"Currently valid token to be used for the token renewal process.","type":"string"}}}}},"CreateTokenResponse":{"type":"object","properties":{"data":{"type":"object","properties":{"token":{"description":"Currently valid token to be used for the token renewal process.","type":"string"},"expirationTime":{"description":"Expiration time of the token in milliseconds.","type":"integer","format":"int64"},"ttl":{"description":"Token's time to live in milliseconds.","type":"integer","format":"int64"}}}}},"ValidationError":{"type":"object","properties":{"type":{"description":"Type of the Error","type":"string","enum":["VALIDATION_ERROR"]},"code":{"description":"Internal error code.","type":"string","enum":["MISSING_PGUID","MISSING_PERSON","MISSING_BIOMETRIC","INVALID_PARAMETER_COMBINATION","MISSING_REQUIRED_QUERY_PARAMETER","MISSING_REQUIRED_ENTITY_ATTRIBUTE","UNKNOWN_ENTITY_ATTRIBUTE","QUERY_PARAMETER_OUT_OF_RANGE","PARAMETER_OUT_OF_RANGE","PGUID_IS_EMPTY","FORBIDDEN_ATTRIBUTE_SET","INVALID_TOKEN_GRANT_SPEC","INVALID_ENUM_VALUE","MALFORMED_JSON","INVALID_JSON_ATTRIBUTE_VALUE","INVALID_URL_ATTRIBUTE_VALUE","UNKNOWN_REQUEST_READ_ERROR","PAGE_NOT_FOUND","UNSUPPORTED_HTTP_METHOD"]},"message":{"description":"Message detailing the nature of the Error","type":"string"},"meta":{"description":"Contains extra information about the API call.","type":"object"}}},"SecurityError":{"type":"object","properties":{"type":{"description":"Type of the Error","type":"string","enum":["SECURITY_ERROR"]},"code":{"description":"Internal error code.","type":"string","enum":["INVALID_CREDENTIALS","INVALID_TOKEN","INVALID_AUTHORIZATION_SCHEMA","MISSING_TOKEN","UNKNOWN_LOGIN_ERROR","UNKNOWN_TOKEN_ERROR","EXPIRED_TOKEN","UNAUTHORIZED_ACCESS"]},"message":{"description":"Message detailing the nature of the Error","type":"string"},"meta":{"description":"Contains extra information about the API call.","type":"object"}}},"InternalError":{"type":"object","properties":{"type":{"description":"Type of the Error","type":"string","enum":["INTERNAL_ERROR"]},"code":{"description":"Internal error code.","type":"string","enum":["DRIVER_OFFLINE","CREDENTIAL_SERVER_CONNECTION_ERROR","CLIENT_NOT_INITIALIZE","TRUSTED_ENROLL_WITH_PENDING_STATUS","SUBJECT_NOT_SET","UNKNOWN"]},"message":{"description":"Message detailing the nature of the Error","type":"string"},"meta":{"description":"Contains extra information about the API call.","type":"object"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.griaule.com/apis/gbds-4/tokens.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
