How can I authenticate API requests? (2024)

  1. Zendesk help
  2. Support
  3. Support advice and troubleshooting
  4. API and SDK

Dwight Bussman

  • Edited

Zendesk Customer Care

Question

How can I authenticate API requests using one of Zendesk v2 APIs?

Answer

You must be a verified user to make API requests. To authenticate API requests, use basic authentication with your email address and password, your email address and an API token, or an OAuth access token.

All methods of authentication set the authorization header differently. Credentials sent in the payload or URL are not processed.

To view information on each authentication method, click each of the tabs below.

Password authentication

API token authentication

OAuth access token authentication

Password authentication

If you use basic authentication, combine your email address and password to generate the authorization header. To use basic authentication, enable Password access in Admin Center under Apps and integrations > APIs > Zendesk API, as well as within the relevant authentication section, either team member or end user.

How can I authenticate API requests? (1)

Format the email address and password combination to be an Base-64 encoded string. For an example of how to format the authorization header, see the code block below.

Authorization: Basic {base-64-encoded email_address:password}

API token authentication

If you use an API token, combine your email address and API token to generate the authorization header. Format the email address and API token combination to be an Base-64 encoded string. For an example of how to format the authorization header, see the code block below.

Authorization: Basic {base-64-encoded email_address/token:api_token}

OAuth access token authentication

If you use OAuth to authenticate, format the authorization header as seen below.

Authorization: Bearer oauth_access_token

For more information, see this article: Using OAuth authentication with your application.

Viewing your authorization header

To see exactly what your app sends, use a third-party page such as Request Bin. Compare your headers to those being generated by a webhook using an OAuth authentication. Point the webhook to your requestb.in URL and, on the Add webhook page, click Test webhook to see this in action.

How can I authenticate API requests? (2)

Once the request hits your requestb.in, it appears like this:

How can I authenticate API requests? (3)

The string after Authorization: Bearer is the API key provided by RequestBin in your account settings under Programmatic Access.

How can I authenticate API requests? (4)

If you use Python to make requests, set your session headers as follows.

session = requests.Session()
session.headers = {'Content-Type': 'application/json', 'Authorization': 'Basic Basic_64_encoded_code'}

For more information, see the developer documentation: Security and authentication.

Return to top

Date Votes

  • Bonaliza Garcia

    Hi, I'm working on a custom request form for our end-users (but still within our Zendesk subdomain). When I try to submit the form and send the data to create the request, it returns with a 403 error. The same code works on postman and the request is being created.

    I'm having a hard time figuring out why im getting a 403. I tried both email/token:api_key authentication and basic email:password authentication.

    https://support.zendesk.com/hc/en-us/community/posts/1260800839050-403-error-when-creating-request-via-API

  • Tomer Ben-Arye

    @...

    I think my code 5 post above will help you.

    https://support.zendesk.com/hc/en-us/articles/115000510267/comments/360005066074

  • Bonaliza Garcia

    @Tomer did you mean the base64 encoded? I did that, my email/token:api_token is encoded. I tried manually encoding it using one of the websites and also dis btoa('email/token:api_token'); but both gave me a 403 error.

  • Bheem Aitha

    Hi @...

    I am getting the same authentication error. Can you please help me on this? I also created a ticket on this.

    C:\Users\yyy> curl https://<subdomain>.zendesk.com/api/v2/users.json -u yyy@<company>.com/token:xxxxxxx

    {"error":"Couldn't authenticate you"}

    Thanks

    -Bheem

  • Waseem Khan

    • Edited

    Hi Team,

    Precindition: Token is created in zendesk

    I as an admin share my email address and token with other team member. Can they acess the API's? or is it like i need to login to zendesk from the same system/pc from where the user is trying to access the API's?

    Or they can just pass my email address and token simply without i being logged in to zendesk?

    Regards,

    Waseem

  • Dwight Bussman

    Zendesk Customer Care

    Waseem Khan

    Simply having your email & API token is sufficient for any user to make API requests on behalf of your user. This gives them the ability to do anything your user would be able to do via the API. This includes deleting things like tickets/users/organizations/articles/sections/categories/triggers which can be very destructive. For this reason, I would encourage you to be very selective about who has access to these tokens.

  • Nick Bolton

    Please make it clearer on this page that you have to Base-64 encode the token. Here's the command that I used on Mac to Base-64 encode my token.

    echo -n '[email protected]/token:abc123' | base64

  • Dwight Bussman

    Zendesk Customer Care

    HeyO Nick,

    Thanks for the feedback. I will make updates to this article to make that clearer.

  • Dan Reyes-Cairo(Staging)

    I just ran into and resolved an issue using Postman for API requests where the following was returned:

    "error": "Couldn't authenticate you"

    Per the API documentation I was using the following so everything should have been set up correctly:

    • Basic Auth
    • Format: {admin_email}/token:{admin_api_key}
    • URL: {my_domain}.zendesk.com/api/v2/{endpoint}

    Turns out, when the base64 encoded Authentication value was being decoded in Postman, it was adding an additional colon : to the decoded username string (I had to check this using a third-party decoding site).

    To resolve, I had to:

    1. Copy the rendered Authorization value in the Header's tab
    2. set Postman to "No Auth"
    3. Manually input the "Authorization" key on the Header's tab
    4. Paste in the copied value
    5. Remove the "g==" that had been added to the encoded value (which removed the colon from the decoded value back to what I had originally input)

    At that point my requests started going through. Hope this helps anyone else that runs into this with Postman!

  • Ramy Ben Aroya

    I have setup SSO for my end users.
    I want to show some of the Zendesk content on my own web app platform without having to proxy the requests to Zendesk API through my server.
    Is there any option to issue /api/v2/help_center/* requests with the JWT token I get from /access/jwt endpoint?
    Also what about CORS? Of course for now I get only 401 response but I see it is not supporting cross origin requests.

  • Fraser, Vanessa

    Hi! I'm trying to use Azure Logic Apps to Authentic for a POC but I keep getting 401 Couldn't authenticate you.

    I've encoded my username/token:aaaa via powershell this way but I must be missing something.

    $text = "[email protected]/token:tokentexthere"
    $encoded = [convert]::ToBase64String([text.encoding]::Unicode.GetBytes($text))
    $encoded

    I went through this article and tried OAuth, api, user/password but just not getting authenticated.

    Any ideas would be welcome!

  • Dwight Bussman

    Zendesk Customer Care

    Hi Fraser, Vanessa

    After doing that encoding are you passing the encoded value in as a Basic Authorization header as documented here: https://developer.zendesk.com/api-reference/introduction/security-and-auth/#basic-authentication

    Authorization: Basic {base64-encoded-string}

    If that doesn't help sort things out for you, I recommend contacting our support team to look into logs for your specific account.

  • Fraser, Vanessa

    • Edited

    I'm sure it is something I'm doing wrong but I have been over and over that article and am not seeing what I have done wrong. I'll contact support. Also I can curl using the email/token:tokeninfo so it has to do with my encoding of the email/token:tokeninfo.

  • Felipe Costa

    Hello, SSO authentication works to customer's side?
    We don't have our customer's zendesk password.

  • Dane

    Zendesk Engineering

    Hi Felipe,

    Yes, you can use SSO for your end users. Please refer to Providing multiple sign-in options for team members and end users.

  • Dermot Doran Cato Networks

    • Edited

    Hi All!

    If you are working on macOS, I recommend that you follow the tip given by Nick Bolton. I tried to create the base64 code using the -i option of the base64 comman, but it kept adding an extra character to the end of encoded output.

    Cheers!!

    Dermot

Please sign in to leave a comment.

More about

  • API

Related articles

  • Using OAuth authentication with your application
  • Managing access to the Zendesk API
  • Zendesk Support search reference
  • End users receiving "Couldn't authenticate you..." error when signing in
  • Exporting ticket, user, or organization data from your account

As an enthusiast with demonstrable expertise in Zendesk and its API authentication methods, I can confidently provide insights into the information presented in the provided article. Here's a breakdown of the concepts covered:

  1. Zendesk v2 API Authentication Methods:

    • Password Authentication:

      • Users need to be verified to make API requests.
      • Basic authentication is used with the email address and password.
      • Password access must be enabled in Admin Center under "Apps and integrations > APIs > Zendesk API."
      • The email address and password combination are Base-64 encoded to generate the authorization header.
    • API Token Authentication:

      • API tokens can be used for authentication.
      • Combine the email address and API token, and encode them in Base-64 for the authorization header.
    • OAuth Access Token Authentication:

      • OAuth authentication is another method.
      • The authorization header is formatted as "Authorization: Bearer oauth_access_token."
  2. Viewing Authorization Header:

    • Third-party pages like Request Bin can be used to view what the app sends.
    • In Python, headers for requests can be set using the provided Base-64 encoded code.
  3. Troubleshooting and Community Interactions:

    • Users like Bonaliza Garcia and Bheem Aitha face authentication issues and seek help in the Zendesk community.
    • Tomer Ben-Arye offers assistance in resolving a 403 error.
    • The article addresses issues raised by users, providing solutions and additional clarity.
  4. User Authorization and Security Concerns:

    • Waseem Khan inquires about API access and security.
    • Dwight Bussman, from Zendesk Customer Care, clarifies that sharing email and API token is sufficient for API access, emphasizing the need for caution due to potential destructive actions.
  5. Feedback and Improvements:

    • Nick Bolton suggests making it clearer that the token must be Base-64 encoded.
    • Dwight Bussman acknowledges the feedback and commits to updating the article.
  6. Issues and Solutions:

    • Dan Reyes-Cairo shares a resolution to a 403 error encountered in Postman due to Base-64 decoding issues.
    • Fraser, Vanessa faces a 401 error and seeks help, and Dwight Bussman advises on correct encoding for authorization.
  7. SSO Authentication and Multiple Sign-in Options:

    • Ramy Ben Aroya inquires about using SSO for end users.
    • Zendesk Engineering (Dane) confirms that SSO can be used for end users and provides a reference link.
  8. Additional Tips and Recommendations:

    • Dermot Doran shares a tip for macOS users regarding Base-64 encoding.

In summary, the article comprehensively covers various authentication methods, addresses common issues faced by users, provides troubleshooting guidance, and incorporates community interactions to enhance user understanding and resolve authentication challenges in the Zendesk API.

How can I authenticate API requests? (2024)

FAQs

What are the ways to authenticate API requests? ›

  1. #1 API Key (identification only) One of the easiest ways to identify an API client is by using an API key. ...
  2. #2 OAuth2 token. OAuth2 is a comprehensive industry standard that is widely used across API providers. ...
  3. #3 External token or assertion. ...
  4. #4 Token Exchange. ...
  5. #5 Identity facade for 3 legged OAuth.
Feb 9, 2023

How do I securely authenticate an API? ›

HTTP Bearer Authentication: API consumers send API requests with a unique API access token in an HTTP header. API providers then validate the API access token to authenticate API users. This API authentication method is more secure than Basic, as API requests cannot be intercepted easily.

Which three methods can be used to authenticate to an API? ›

We'll highlight three major methods of adding security to an API — HTTP Basic Auth, API Keys, and OAuth. We'll identify the pros and cons of each approach to authentication, and finally recommend the best way for most providers to leverage this power.

How many ways can you authenticate API? ›

There are many types of API authentication, such as HTTP basic authentication, API key authentication, JWT, and OAuth, and each one has its own benefits, trade-offs, and ideal use cases. Nevertheless, all API authentication mechanisms share the goal of protecting sensitive data and ensuring the API is not misused.

How to do authentication in rest API? ›

The client needs to include their API key as part of the request to authenticate themselves. The API key can be included anywhere in the request, such as the header, body, or query parameters. It ultimately depends on the API's design and is communicated to the developers via the API documentation.

How do I make my API request secure? ›

Always Use a Gateway

Our first recommendation is to always put your API behind a gateway. API gateways centralize traffic features and apply them to every request that hits your API. These features may be security-related, like rate limiting, blocking malicious clients, and proper logging.

What is basic authentication for API security? ›

Basic auth requires API tokens. You generate an API token for your Atlassian account and use it to authenticate anywhere where you would have used a password. This enhances security because: you're not saving your primary account password outside of where you authenticate.

How to do basic authentication in web API? ›

In IIS Manager, go to Features View, select Authentication, and enable Basic authentication. In your Web API project, add the [Authorize] attribute for any controller actions that need authentication. A client authenticates itself by setting the Authorization header in the request.

How to secure an API without authentication? ›

API Without Authentication: Risks and Solutions
  1. Implement Strong Authentication Methods.
  2. Enforce Role-Based Access Controls (RBAC)
  3. Implement Multi-Factor Authentication (MFA)
  4. Encrypt Sensitive Data.
  5. Monitor and Log API Activities.
  6. Regularly Update and Patch APIs.
Jan 3, 2024

What is API key authentication strategy? ›

The api key authentication strategy authenticates users using a apikey. The strategy requires a verify callback, which accepts these credentials and calls done providing a user.

What is the most common method used to authenticate? ›

Passwords are the most common methods of authentication. Passwords can be in the form of a string of letters, numbers, or special characters. To protect yourself you need to create strong passwords that include a combination of all possible options.

Which authentication method is commonly used for securing API requests? ›

HTTP Basic Authentication is by far the simplest approach to authentication. This method sends a username and password alongside every API call with an HTTP header for transmission.

Which is the most powerful authentication method? ›

Categories
  • The Three Types of Authentication Factors.
  • Least Secure: Passwords.
  • More Secure: One-time Passwords.
  • More Secure: Biometrics.
  • Most Secure: Hardware Keys.
  • Most Secure: Device Authentication and Trust Factors.
Jul 22, 2024

Which three authentication mechanisms are used in REST API? ›

4 Methods for REST API Authentication
  • API keys in headers.
  • API keys as query parameters.
  • Basic auth.
  • Bearer tokens.
Feb 21, 2024

How are APIs authenticated? ›

Common Methods of API Authentication

API keys have unique identifiers for users each time they try to authenticate. It's perfectly suitable for applications that have several users seeking access. A uniquely generated code or token is allocated to each first-time user to signify that the user is known.

What are the three major ways of authenticating users? ›

Top 3 Types of User Authentication
  • Password-based User Authentication. The first type of user authentication on our top 3 list is password-based user authentication. ...
  • One-time Password (OTP) One-time Password or OTP is commonly used as a second factor for authentication. ...
  • Biometric Authentication.
Jun 28, 2024

What are the different types of authentication in Web API? ›

There are four ways to authenticate when calling a web API: API key authentication. Basic authentication. OAuth 2.0 Client Credentials Grant.

What are the three primary methods for authenticating users? ›

a)Passwords, tokens, and biometrics.

Top Articles
Mastering the Order Types: Limit Orders
GapUp or GapDn Stop loss hits or not
Koopa Wrapper 1 Point 0
Z-Track Injection | Definition and Patient Education
Meer klaarheid bij toewijzing rechter
Northern Whooping Crane Festival highlights conservation and collaboration in Fort Smith, N.W.T. | CBC News
Fallout 4 Pipboy Upgrades
Nieuwe en jong gebruikte campers
Cars For Sale Tampa Fl Craigslist
Weather In Moon Township 10 Days
Rainfall Map Oklahoma
Chastity Brainwash
Facebook Marketplace Charlottesville
C Spire Express Pay
Bowie Tx Craigslist
Northern Whooping Crane Festival highlights conservation and collaboration in Fort Smith, N.W.T. | CBC News
Dallas Cowboys On Sirius Xm Radio
Chelactiv Max Cream
Grayling Purnell Net Worth
Ally Joann
Vandymania Com Forums
Glenda Mitchell Law Firm: Law Firm Profile
Lakewood Campground Golf Cart Rental
Mj Nails Derby Ct
Pirates Of The Caribbean 1 123Movies
Which Sentence is Punctuated Correctly?
Trivago Myrtle Beach Hotels
Idle Skilling Ascension
Margaret Shelton Jeopardy Age
Times Narcos Lied To You About What Really Happened - Grunge
Dailymotion
Southern Democrat vs. MAGA Republican: Why NC governor race is a defining contest for 2024
Golden Tickets
6143 N Fresno St
M3Gan Showtimes Near Cinemark North Hills And Xd
Pickle Juiced 1234
Police Academy Butler Tech
Hotels Near New Life Plastic Surgery
Mydocbill.com/Mr
Nearest Ups Office To Me
2007 Jaguar XK Low Miles for sale - Palm Desert, CA - craigslist
Sour OG is a chill recreational strain -- just have healthy snacks nearby (cannabis review)
Port Huron Newspaper
Canvas Elms Umd
UNC Charlotte Admission Requirements
Electric Toothbrush Feature Crossword
Game Akin To Bingo Nyt
Mkvcinemas Movies Free Download
Ubg98.Github.io Unblocked
Lorcin 380 10 Round Clip
San Pedro Sula To Miami Google Flights
Latest Posts
Article information

Author: Edmund Hettinger DC

Last Updated:

Views: 5851

Rating: 4.8 / 5 (78 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Edmund Hettinger DC

Birthday: 1994-08-17

Address: 2033 Gerhold Pine, Port Jocelyn, VA 12101-5654

Phone: +8524399971620

Job: Central Manufacturing Supervisor

Hobby: Jogging, Metalworking, Tai chi, Shopping, Puzzles, Rock climbing, Crocheting

Introduction: My name is Edmund Hettinger DC, I am a adventurous, colorful, gifted, determined, precious, open, colorful person who loves writing and wants to share my knowledge and understanding with you.