Which API is to be used for generating API token in exchange with code?

I’m integrating jira cloud services, need to know two things:

  1. Which API is to be used for generating API token in exchange with code (code provided while authenticating user and sent with callback)?
  2. How to get user domain xxx.atlassian.com, is there any API that will provide this details because in integration while calling api’s this domain will be prefixed to access user data.

Thanks,
Khushal

Welcome to the Atlassian developer community @KhushalSingh,

  1. Which API is to be used for generating API token in exchange with code (code provided while authenticating user and sent with callback)?

The short answer, https://auth.atlassian.com/oauth/token is explained in Exchange authorization code for access token. The longer answer is that documentation itself, which will explain how to use the developer console to register the client id, secret, and callback URL.

  1. How to get user domain xxx.atlassian.com, is there any API that will provide this details because in integration while calling api’s this domain will be prefixed to access user data.

I’m not sure I understand this part of your question. There are a lot of things packed into that question, some of which is wrong. First (and I suspect just a typo), customer domains do not end with .com but with .net, like my sample instance devpartisan.atlassian.net. Second, the above mentioned documentation on OAuth explains how to Construct the request URL:

Requests that use OAuth 2.0 (3LO) are made via api.atlassian.com (not https://your-domain.atlassian.net). Construct your request URL using the following structure:

  • Jira apps: https://api.atlassian.com/ex/jira/{cloudid}/{api}
  • Confluence apps: https://api.atlassian.com/ex/confluence/{cloudid}/{api}

It also goes on to explain how to obtain the cloudid and how to make requests.