# API_CallCurrentOrg

**Class** · Group: `Web Services`

Learn it: [Web Services guide](/web-services-guide)

<div class="apex-member apex-class">

```apex
global virtual inherited sharing class API_CallCurrentOrg extends API_Outbound
```

**Extends:** [API_Outbound](/reference/apex/api-outbound)

Base API class for all handlers that call the current Org standard APIs. Uses session-ID-based authentication and resolves the org base URL dynamically via URL.getOrgDomainURL(). A call to your own org's domain needs neither a Remote Site Setting nor a Named Credential (a stored, reusable connection definition): the platform allows it, and the session id signs it.

**Example**

```apex
global class API_OrgMetadata extends API_CallCurrentOrg
{
    global override void configure()
    {
        super.configure();
        requestPayload = new DTO_Request();
        responsePayload = new DTO_Response();
    }
}
```

</div>

---

## Methods

| Method | Description |
|--------|-------------|
| global virtual override void [configure](#configure)() | Initialises the handler and sets the base URL to the current org domain. |
| global virtual override [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [getAuthorisationToken](#getauthorisationtoken)() | Will return the current session Id as authorisation token. |
| global virtual override [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) [getWebServiceEndPoint](#getwebserviceendpoint)() | Constructs the full endpoint URL by combining the current org domain URL with the endpoint path from ApiSetting__mdt configuration. |

### configure

<div class="apex-member">

```apex
global virtual override void configure()
```

Initialises the handler and sets the base URL to the current org domain.

**Example**

```apex
global override void configure()
{
    super.configure();
    requestPayload = new DTO_Request();
}
```

</div>

### getAuthorisationToken

<div class="apex-member">

```apex
global virtual override String getAuthorisationToken()
```

Will return the current session Id as authorisation token.

**Returns** [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) — Authorisation Header value

**Example**

```apex
global class API_OrgMetadata extends API_CallCurrentOrg
{
    // Uses inherited getAuthorisationToken() which returns 'Bearer <sessionId>'
    // to authenticate against the current org's REST API
}
```

</div>

### getWebServiceEndPoint

<div class="apex-member">

```apex
global virtual override String getWebServiceEndPoint()
```

Constructs the full endpoint URL by combining the current org domain
URL with the endpoint path from ApiSetting__mdt configuration.

**Returns** [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm) — The full URL endpoint for the web service

**Example**

```apex
// With EndpointPath__c = '/services/data/v{0}/sobjects/StreamingChannel/{1}/push'
// Returns: 'https://myorg.my.salesforce.com/services/data/v{0}/sobjects/StreamingChannel/{1}/push'
```

</div>
