Skip to main content

Configure X App Permissions and Get Four API Credentials

To publish to X and collect X Marketing data with Torai, create an App in the X Developer Console and obtain four OAuth 1.0a credentials. You do not need a separate set of credentials for analytics:

  • API Key
  • API Key Secret
  • Access Token
  • Access Token Secret
caution

Some credentials are displayed only once. When they appear, store them in a secure location such as a password manager. Do not save them in screenshots, chats, Git repositories, or public folders.

Before you start

Prepare the following:

  • The X account you will use for posting
  • Access to the X Developer Console
  • Billing settings or credits required to use the X API
  • Your Apps Script web app URL
  • The Torai website URL

Enter the Apps Script web app URL as the X Callback URL / Redirect URL. If you do not have this URL yet, set up Google Sheets and Apps Script first.

1. Open the X Developer Console

Open the X Developer Console and sign in with the X account you will use for posting.

X Developer Platform home page with the Go to Console button

On your first visit, you may need to accept the Developer Agreement and enter profile information. Follow the on-screen instructions.

X Developer Agreement and Policy form

2. Check billing and credits

Using the X API may require X billing or credits. On the Developer Console dashboard, check your payment settings, credits, and usage.

Developer Console dashboard showing usage and credit balance

Click the menu button in the upper-left corner, then select Credits from the menu that appears.

Credits page with the Purchase credits button

To purchase credits, follow the on-screen instructions to register payment information.

Credits page with the Purchase credits button

Credit purchase form

Review your credit balance and automatic top-up settings to reduce the chance of failed posts caused by insufficient credit.

3. Create a Project and App

Create a new app, or select the default app if it is not currently in use.

Select apps from menu

Select the default app

Click apps in Development. This is a default app when you first signin to X developer.

Select default app

Create a new app

Developer Console Apps list

Enter the Project name, App name, description, intended use, and other requested information. Use names that will make the purpose clear later.

Create new X app

The API Key and API Key Secret may be displayed when you create the App. But you do not need to save them. You will need to regenerate the keys after changing the app permissions later.

Select app you created.

Select app you created

4. Open User Authentication Settings

Open the settings for the App you created and edit User Authentication Settings or Authentication Settings.

Open the App, then click Set up under User authentication settings.

Keys and Tokens page with the User authentication settings section

This is where you configure the permissions and application type required to publish from Torai and retrieve your own post information, engagement metrics, and responders.

5. Configure app permissions

Enable OAuth 1.0a and select App permissions.

For Torai, normally select Read and write. Write permission is used for publishing, while read permission is used to verify posts and collect X Marketing data.

Select Read, write, and DMs only if you will also send and receive direct messages.

info

Read only is not sufficient to publish to X from Torai. It causes a permission error when posting.

For Type of App, select Web App, Automated App, or Bot.

Select permissions

Enter your Apps Script web app URL as the Callback URL / Redirect URL. Enter the Torai website, https://torai.try-try.com, as the Website URL.

User Authentication Settings with app type and app URLs

Click Save when you are done.

caution

If you change app permissions, always regenerate the Access Token and Access Token Secret. Existing tokens do not receive the new permissions.

6. Open Keys and Tokens

Open Keys and tokens for the App.

Keys and Tokens page

On this page, you can review or regenerate the API Key and API Key Secret, and generate the Access Token and Access Token Secret.

7. Save the API Key and API Key Secret

In the Consumer Keys section, display or regenerate the API Key and API Key Secret.

A confirmation page appears when you regenerate them. If an existing integration uses the current keys, it will stop working after regeneration.

Confirmation dialog for regenerating the API Key and API Key Secret

Save the displayed API Key and API Key Secret.

API Key and API Key Secret dialog with credential values redacted

8. Generate the Access Token and Access Token Secret

In the Access Token section, click Generate or Regenerate.

Generate button in the Access Token section

Save the displayed Access Token and Access Token Secret.

Access Token and Access Token Secret dialog with credential values redacted

You now have all four credentials required by Torai.

9. Register the credentials in Torai

On Torai's X account management page, register all four credentials for the corresponding X account:

  • API Key
  • API Key Secret
  • Access Token
  • Access Token Secret

After registering them, create a test post or a normal post to confirm that publishing works. If you use X Marketing, save its collection settings, click Refresh Now, and confirm that data appears in Post Analytics or the Response Inbox.

Common problems

Posts fail

App permissions may still be set to Read only. Change them to Read and write or higher, then regenerate the Access Token and Access Token Secret.

Permission changes do not take effect

You may be using the old Access Token and Access Token Secret. Regenerate them under Keys and tokens, then register the new values in Torai.

You forgot to save a credential

Regenerate any credential that cannot be displayed again. Regeneration invalidates the old credential, so also update it in Torai.

Posts fail because there is not enough credit

Check your credit balance, billing settings, and Usage on the Developer Console dashboard.

Security notes

  • Never share the four credentials with anyone.
  • Do not paste them into GitHub, chats, email, or public folders.
  • If you suspect unauthorized use, regenerate them immediately.
  • Delete or regenerate Apps and credentials you no longer use.

References