Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Para fazer qualquer coisa com a API Looker, primeiro é necessário fazer a autenticação. As etapas necessárias dependem se você está usando ou não um SDK.
Autenticação com um SDK
Este é o método recomendado para autenticação de API:
Crie credenciais da API na página "Usuários" na seção "Administrador" da sua instância do Looker. Se você não for um administrador do Looker, peça para o administrador criar as credenciais da API.
As credenciais da API estão sempre vinculadas a uma conta de usuário do Looker. As solicitações de API são executadas "como" o usuário associado às credenciais da API. As chamadas para a API só vão retornar dados que o usuário tem permissão para ver e modificar apenas o que ele tem permissão para modificar.
As credenciais da API que você gerou incluem um ID e uma chave secreta do cliente. Você precisará fornecer esses dados ao SDK. As instruções para fazer isso estão na documentação do SDK.
O SDK vai cuidar de receber os tokens de acesso necessários e inseri-los em todas as solicitações de API subsequentes.
Autenticação sem um SDK
A autenticação de API com um SDK é o método recomendado. Para fazer a autenticação sem um SDK:
Crie credenciais da API na página "Usuários" na seção "Administrador" da sua instância do Looker. Se você não for um administrador do Looker, peça para o administrador criar as credenciais da API.
As credenciais da API estão sempre vinculadas a uma conta de usuário do Looker. As solicitações de API são executadas "como" o usuário associado às credenciais da API. As chamadas para a API só vão retornar dados que o usuário tem permissão para ver e modificar apenas o que ele tem permissão para modificar.
Receba um token de acesso do OAuth 2.0 de curto prazo chamando o endpoint login da API. Você precisa fornecer as credenciais da API que gerou na etapa 1, que incluem um ID e uma chave secreta do cliente.
Coloque esse token de acesso no cabeçalho de autorização HTTP das solicitações da API Looker. Um exemplo de solicitação da API Looker com um cabeçalho de autorização pode ser parecido com este:
GET /api/4.0/user HTTP/1.1
Host: test.looker.com
Date: Wed, 19 Oct 2023 12:34:56 -0700
Authorization: token mt6Xc8jJC9GfJzKBQ5SqFZTZRVX8KY6k49TMPS8F
O token de acesso do OAuth 2.0 pode ser usado em várias solicitações de API até que ele expire ou seja invalidado ao chamar o endpoint logout. As solicitações de API que usam um token de acesso expirado vão falhar com uma resposta HTTP 401 Authorization Required.
Interação da API com as configurações de login do usuário
A autenticação da API Looker é totalmente independente do login do usuário do Looker. Protocolos de autenticação do usuário, como senhas únicas (OTP, 2FA) e autenticação de diretório (LDAP, SAML etc.), não se aplicam à autenticação da API Looker.
Por isso, excluir as informações de um usuário de um protocolo de autenticação não exclui as credenciais da API. O uso dos procedimentos na página de documentação Excluir informações pessoais do usuário remove todos os dados pessoais de um usuário do Looker, impedindo que ele faça login, inclusive pela API.
Como gerenciar credenciais de API
Vários conjuntos de credenciais da API podem ser vinculados a uma única conta de usuário do Looker.
As credenciais da API podem ser criadas e excluídas sem afetar o estado da conta do usuário.
A exclusão de uma conta de usuário do Looker invalida todas as credenciais da API vinculadas à conta.
O segredo do cliente da API precisa ser mantido em sigilo. Evite armazenar chaves secretas de clientes de API no código-fonte ou em outros lugares
que possam ser acessados por muitas pessoas.
Na produção, evite usar credenciais da API vinculadas a contas de administrador do Looker. Crie contas de usuário com privilégios mínimos
específicas para atividades de API (geralmente chamadas de "contas de serviço") e crie credenciais de API nessas contas.
Conceda apenas as permissões necessárias para as atividades de API pretendidas.
Autenticação HTTPS
Mesmo que você esteja usando um SDK do cliente para cuidar dos detalhes de autenticação, talvez ainda tenha curiosidade sobre como a autenticação da API Looker funciona. Para detalhes de baixo nível sobre a autenticação, consulte Como se autenticar na API Looker (link em inglês) no GitHub.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-25 UTC."],[],[],null,["# Looker API authentication\n\n| **Note:** As of Looker 22.4, the [Looker API 4.0 is generally available](/looker/docs/api-4-ga). In Looker 23.18, the [Looker API 3.1 has been removed](/looker/docs/api-3x-deprecation).\n\nTo do anything with the Looker API, you'll first need to authenticate to it. The steps you'll need to take depend on whether or not you're using an SDK.\n\n\nAuthentication with an SDK\n--------------------------\n\nThis is the recommended method for API authentication:\n\n1. Create API credentials on the [Users page](/looker/docs/admin-panel-users-users) in the Admin section of your Looker instance. If you're not a Looker admin, ask your Looker admin to create the API credentials for you.\n\n API credentials are always bound to a Looker user account. API requests execute \"as\" the user associated with the API credentials. Calls to the API will only return data that the user is allowed to see, and modify only what the user is allowed to modify.\n2. The API credentials that you generated include a client ID and a client secret. You'll need to provide these to the SDK. The instructions for doing so can be found in the [SDK documentation](/looker/docs/api-sdk).\n\nThe SDK will then take care of obtaining the necessary access tokens and inserting them into all subsequent API requests.\n\n\nAuthentication without an SDK\n-----------------------------\n\nAPI authentication with an SDK is the recommended method. To authenticate without an SDK:\n\n1. Create API credentials on the [Users page](/looker/docs/admin-panel-users-users) in the Admin section of your Looker instance. If you're not a Looker admin, ask your Looker admin to create the API credentials for you.\n\n API credentials are always bound to a Looker user account. API requests execute \"as\" the user associated with the API credentials. Calls to the API will only return data that the user is allowed to see, and modify only what the user is allowed to modify.\n2. Obtain a short-term, OAuth 2.0 access token by calling the [`login`](/looker/docs/reference/looker-api/latest/methods/ApiAuth/login) endpoint of the API. You'll need to provide the API credentials that you generated in step 1, which include a client ID and a client secret.\n\n3. Place that access token into the HTTP authorization header of Looker API requests. An example Looker API request with an authorization header might look like this:\n\n GET /api/4.0/user HTTP/1.1\n Host: test.looker.com\n Date: Wed, 19 Oct 2023 12:34:56 -0700\n Authorization: token mt6Xc8jJC9GfJzKBQ5SqFZTZRVX8KY6k49TMPS8F\n\nThe OAuth 2.0 access token can be used on multiple API requests, until the access token expires or is invalidated by calling the [`logout`](/looker/docs/reference/looker-api/latest/methods/ApiAuth/logout) endpoint. API requests that use an expired access token will fail with a `401 Authorization Required` HTTP response.\n\nAPI interaction with user login settings\n----------------------------------------\n\nLooker API authentication is completely independent of Looker user login. User authentication protocols such as one-time passcodes (OTP, 2FA) and directory authentication (LDAP, SAML, and so on) don't apply to Looker API authentication.\n\nBecause of this, deleting a user's information from a user authentication protocol does not delete their API credentials. Using the procedures on the [Deleting Personal User Information](/looker/docs/deleting-personal-user-information) documentation page removes all of a user's personal data from Looker, preventing them from logging in at all, including through the API.\n\nManaging API credentials\n------------------------\n\n- Multiple sets of API credentials can be bound to a single Looker user account.\n- API credentials can be created and deleted without affecting the state of the user account.\n- Deleting a Looker user account invalidates all API credentials bound to the user account.\n- The API client secret must be kept private. Avoid storing API client secrets in source code or other places that can be seen by a lot of people.\n- In production, avoid using API credentials bound to Looker admin accounts. Create minimal privilege user accounts specifically for API activities (often called \"service accounts\") and create API credentials on those accounts. Grant only the permissions needed for the intended API activities.\n\nHTTPS authentication\n--------------------\n\nEven if you're using a client SDK to take care of the authentication details for you, you may still be curious about how Looker API authentication works. For low-level details about authentication, see [How to Authenticate to the Looker API](https://github.com/looker-open-source/looker-sdk-ruby/blob/master/authentication.md) on GitHub.\n\n\nAuthentication using OAuth\n--------------------------\n\nLooker can use the [Cross-Origin Resource Sharing (CORS)](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) protocol to let web applications make calls to the Looker API from outside a Looker instance's domain. See the [Looker API authentication using OAuth](/looker/docs/api-cors) documentation page for information about configuring CORS authentication."]]