# Include Authorization Headers in RPC Method Calls

Every time an RPC method executes, it uses the headers to authorize access to resources.

How you set the headers depends on your programming language. In Python, the headers are provided in a tuple as a parameter to each call. For more information, see [Python Quick Start for Pub/Sub API](/docs/platform/pub-sub-api/guide/qs-python-quick-start.md). In other languages, such as Java, you can provide the headers in the stub separately before making a gRPC call.

## `accesstoken`

The OAuth access token or the session ID returned in the `login()` call response. For more information about getting an OAuth access token, see [OAuth Authorization Flows](https://help.salesforce.com/s/articleView?id=xcloud.remoteaccess_oauth_flows.htm\&type=5) in *Salesforce Help*. For more information about the `login()` call, see [login()](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_login.htm) in the *SOAP API Developer Guide*.

## `instanceurl`

The first part of your Salesforce server URL without the ending path portion. You can get this URL in one of two ways.

- From the `login()` call result in `serverUrl`, as outlined in the [quick start example](/docs/platform/pub-sub-api/guide/qs-python-quick-start.md) in this guide. For more information, see [LoginResult](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_login_loginresult.htm) in the *SOAP API Developer Guide*.
- From the result that Salesforce returns as part of the OAuth authorization flow in `instance_url`. For more information, see [OAuth 2.0 User-Agent Flow for Desktop or Mobile App Integration](https://help.salesforce.com/s/articleView?id=remoteaccess_oauth_user_agent_flow.htm\&type=5\&language=en_US) in *Salesforce Help*.

The Salesforce URL can be:

- A MyDomain URL. For example, `https://MyDomainName.my.salesforce.com`.
- A custom domain URL. For example, `https://www.example.com`.

## `tenantid`

An ID that uniquely identifies your org. If you set this header to the org ID, the Pub/Sub API constructs the entire value for you. These values are valid.

- `{Org ID}`
- `core/{Subdomain}/{Org ID}`

Examples:

- Org ID: `00D5e000003TIrB`
- Entire value: `core/MyDomainName/00D5e000003TIrB`

The org ID is returned in the [login()](https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_login.htm) call response. Alternatively, you can get your org ID value by following the steps in [Find your Salesforce Organization ID](https://help.salesforce.com/articleView?id=000325251\&mode=1\&type=1) in *Salesforce Help*.

If you build the entire value, use your org’s My Domain login URL. You can find this value in **Setup > My Domain**. For more information, see [What Is My Domain?](https://help.salesforce.com/s/articleView?id=xcloud.faq_domain_name_what.htm\&type=5) in *Salesforce Help*.
