> For the complete documentation index, see [llms.txt](https://docs.fortics.com.br/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fortics.com.br/campanha-api-reference/autenticacao-v2.md). Agents can also search and read this documentation through its [MCP server](https://docs.fortics.com.br/~gitbook/mcp).

# Autenticação (v2)

## Autenticar

> Envie o Host do tenant. Use o access\_token retornado como Bearer nas demais rotas da v2.

```json
{"openapi":"3.0.0","info":{"title":"Campaign API","version":"1.0.0"},"servers":[{"url":"/","description":"Produção"}],"paths":{"/api/campaign/v2/auth/token":{"post":{"description":"Envie o Host do tenant. Use o access_token retornado como Bearer nas demais rotas da v2.","operationId":"AuthenticationV2Controller_token_v2","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$","description":"E-mail do usuário administrador do tenant"},"password":{"type":"string","minLength":1,"description":"Senha do usuário"}},"required":["email","password"],"description":"Credenciais para obtenção do access_token"}}}},"responses":{"201":{"description":"Autenticado com sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenPresenter"}}}}},"summary":"Autenticar","tags":["Autenticação (v2)"]}}},"components":{"schemas":{"TokenPresenter":{"type":"object","properties":{"access_token":{"type":"string","description":"Token JWT de acesso (Bearer)"},"expires_in":{"type":"number","description":"Tempo restante de validade do token em segundos","nullable":true}},"required":["access_token","expires_in"]}}}}
```

## GET /api/campaign/v2/auth/me

> Usuário e tenant autenticados

```json
{"openapi":"3.0.0","info":{"title":"Campaign API","version":"1.0.0"},"servers":[{"url":"/","description":"Produção"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"MePresenter":{"type":"object","properties":{"user":{"description":"Dados do usuário autenticado no token atual","allOf":[{"$ref":"#/components/schemas/AuthUserPresenter"}]},"tenant":{"description":"Dados do tenant associado ao token","nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/AuthTenantPresenter"}]}},"required":["user","tenant"]},"AuthUserPresenter":{"type":"object","properties":{"id":{"type":"string","description":"ID do usuário"},"email":{"type":"string","description":"E-mail do usuário"},"type":{"type":"string","description":"Tipo/perfil do usuário"},"sub":{"type":"string","description":"Subject do token JWT"},"platform":{"type":"string","description":"Plataforma de acesso"},"iss":{"type":"string","description":"Emissor do token JWT"},"iat":{"type":"number","description":"Timestamp de emissão do token (segundos)"},"exp":{"type":"number","description":"Timestamp de expiração do token (segundos)"},"nbf":{"type":"number","description":"Timestamp de início de validade (not before)"},"jti":{"type":"string","description":"JWT ID único"},"prv":{"type":"string","description":"Provedor do token"}},"required":["id","email","type","sub"]},"AuthTenantPresenter":{"type":"object","properties":{"id":{"type":"string","description":"Identificador do tenant"},"name":{"type":"string","description":"Nome do tenant"},"host":{"type":"string","description":"Host/domínio configurado para o tenant"},"timezone":{"type":"string","description":"Fuso horário do tenant"},"lang":{"type":"string","description":"Idioma padrão do tenant"}},"required":["id","name","host","timezone","lang"]}}},"paths":{"/api/campaign/v2/auth/me":{"get":{"operationId":"AuthenticationV2Controller_me_v2","parameters":[],"responses":{"200":{"description":"Usuário e tenant do token atual","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MePresenter"}}}}},"summary":"Usuário e tenant autenticados","tags":["Autenticação (v2)"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.fortics.com.br/campanha-api-reference/autenticacao-v2.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
