> For the complete documentation index, see [llms.txt](https://docs.barte.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.barte.com/api-reference/3ds/criar-sessao-3ds.md).

# Criar Sessão 3DS

{% hint style="info" %}
A resposta de sucesso é `200`. O `providerType` é um identificador interno de quem conduz a autenticação; não use esse valor na sua integração, porque ele pode mudar sem aviso. Os erros seguem os códigos `BAR-xxxx` de [Códigos de Erro](https://docs.barte.com/guias/inicio/codigos-de-erro); a API não devolve códigos no formato `3DS-000x`.
{% endhint %}

## Criar Sessão 3DS

> Cria uma sessão 3DS e retorna os dados necessários para coleta de informações do navegador.\n\n ⚠️ IMPORTANTE: A sessão 3DS só consegue ser testada completamente em produção.

```json
{"openapi":"3.0.3","info":{"title":"API de 3D Secure (3DS)","version":"2.0.0"},"servers":[{"url":"https://api.barte.com","description":"Servidor de Produção (recomendado para testes 3DS)"},{"url":"https://sandbox-api.barte.com","description":"Servidor de Sandbox (limitações para 3DS)"}],"security":[{"X-Token-Api":[]}],"components":{"securitySchemes":{"X-Token-Api":{"type":"apiKey","name":"X-Token-Api","in":"header"}},"schemas":{"CreateThreeDSSessionRequest":{"type":"object","required":["sourceType","cardId"],"properties":{"sourceType":{"type":"string","enum":["card"],"description":"Tipo da fonte de pagamento"},"cardId":{"type":"string","format":"uuid","description":"ID do cartão retornado na tokenização"}}},"ThreeDSSessionResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"ID da sessão (setupId) - usado posteriormente no pagamento"},"token":{"type":"string","description":"JWT usado no script de coleta de dados"},"collectUrl":{"type":"string","format":"uri","description":"URL onde o navegador enviará dados de background"},"providerType":{"type":"string","enum":["CYBERSOURCE"],"description":"Tipo do provedor 3DS"}}},"ErrorResponse":{"type":"object","properties":{"errors":{"type":"array","items":{"$ref":"#/components/schemas/ErrorDetail"}},"metadata":{"$ref":"#/components/schemas/Metadata"}}},"ErrorDetail":{"type":"object","properties":{"status":{"type":"string"},"code":{"type":"string","enum":["PAYMENT-0000","PAYMENT-0500","PAYMENT-9999","BAR-7001","BAD_REQUEST","FORBIDDEN","METHOD_NOT_ALLOWED","NOT_ACCEPTABLE","UNSUPPORTED_MEDIA_TYPE","3DS-0001","3DS-0002","3DS-0003"]},"title":{"type":"string","enum":["BUSINESS_SELLER","BUSINESS_CHECKOUT","BUSINESS_COMMON","BUSINESS_SECURITY","BUSINESS_SUBSCRIPTION","INVALID_REQUEST_PARAM","BUSINESS_METRIC","BUSINESS_ACCOUNTANCY","BUSINESS_NOTIFICATION","BUSINESS_BARTE","BUSINESS_COMPANY","BUSINESS_INVOICE","BUSINESS_TRANSFER","BUSINESS_CARD","BUSINESS_ORDER","BUSINESS_3DS","card_not_supported"]},"description":{"type":"string"},"action":{"type":"string"},"additionalInfo":{"type":"object","additionalProperties":{"type":"object"}}}},"Metadata":{"type":"object","properties":{"totalRecords":{"type":"integer"},"totalPages":{"type":"integer"},"requestDatetime":{"type":"string","format":"date-time"}}}}},"paths":{"/v1/3ds/session":{"post":{"tags":["Criação de Sessão 3DS"],"summary":"Criar Sessão 3DS","description":"Cria uma sessão 3DS e retorna os dados necessários para coleta de informações do navegador.\\n\\n ⚠️ IMPORTANTE: A sessão 3DS só consegue ser testada completamente em produção.","operationId":"createThreeDSSession","requestBody":{"description":"Dados para criação da sessão 3DS","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateThreeDSSessionRequest"}}}},"responses":{"201":{"description":"Sessão 3DS criada com sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ThreeDSSessionResponse"}}}},"400":{"description":"Requisição inválida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Não autorizado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Acesso proibido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Erro interno do servidor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```


---

# 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.barte.com/api-reference/3ds/criar-sessao-3ds.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.
