> You are reading the Docusign Developer Documentation. For clean Markdown of any page, append .md to the page URL.
>
> Documentation indexes by section:
> - APIs and SDKs: https://docusign.docs.buildwithfern.com/docs/llms.txt
> - Platform 101: https://docusign.docs.buildwithfern.com/platform/llms.txt
> - Extension Apps: https://docusign.docs.buildwithfern.com/extension-apps/llms.txt
> - Docusign CLI: https://docusign.docs.buildwithfern.com/docusign-cli/llms.txt
>
> Authentication (OAuth, JWT Grant, M2M): https://docusign.docs.buildwithfern.com/platform/auth
> Webhooks and Connect: https://docusign.docs.buildwithfern.com/platform/webhooks
>
> OpenAPI specifications: https://docusign.docs.buildwithfern.com/openapi.json
> MCP server: https://docusign.docs.buildwithfern.com/_mcp/server

# How to make a direct API call

> This topic demonstrates how you can make a direct API call to the eSignature REST API from the Docusign iOS SDK module if there is no existing SDK method.

This topic demonstrates how you can make a  [direct API call](/docs/mobile-sdks/ios-sdk/ios101/core-interfaces#call-the-esignature-rest-api-directly) to the [eSignature REST API](/docs/esign-rest-api) from the Docusign [iOS SDK](/docs/mobile-sdks/ios-sdk) module if there is no existing SDK method; in this case, to retrieve a user’s signature ID.

## Required data

Running the code in this how-to requires this data:

| Data element               | Description                                                                                                                                                                                                                                                                              |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \{API_ACCOUNT_ID}          | A [GUID](http://guid.one/) value that identifies your account. This value is automatically generated by Docusign for any account you create. Copy the value from the **API Account ID** field on the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=appsAndKeys) page. |
| \{BASE_PATH}               | A string value that forms the root of the URL required to make API calls. The base path value in the example code is set to target the developer environment at https\://\<domain>/restapi Where \<domain> is demo.docusign.net for the developer environment.                           |
| \{IMPERSONATION_USER_GUID} | A [GUID](http://guid.one/) value that identifies the user. This value is automatically generated by Docusign. Copy the value from the **User ID** field on the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=appsAndKeys) page.                                       |

## Step 1. Log in to Docusign

To make the API calls shown in this how-to, you must be logged in to Docusign.

See [How to log in to Docusign from your app](/docs/mobile-sdks/ios-sdk/how-to/log-in) for details.

## Step 2. Construct your API headers

Use the [DSMAccountInfo](https://docusign.github.io/native-ios-sdk/documentation/docusignsdk/dsmaccountinfo)  object that is returned from the log in function in the previous step to retrieve the account information needed to initialize the API client and set API headers.

**`Objective-C`**

```text title="Objective-C"
NSString *accessToken = accountInfo.accessToken;
NSURL *basePath = accountInfo.host;
NSString *accountId = accountInfo.accountId;
NSString *userId = accountInfo.userId;

NSString * token = [[NSString alloc] initWithFormat:@"Bearer %@", accessToken];

// Initializing the API client with the access token and base url
(void)[[DSClientAPI alloc] initWithBasePath:basePath.absoluteString customHeaders:@{@"Authorization": token}];
```

**`Swift`**

```swift title="Swift"
func makeDirectApiCall(accountInfo: DSMAccountInfo){
        let token = accountInfo.accessToken
        let basePath = accountInfo.host
        let accountId = accountInfo.accountId
        let userId = accountInfo.userId

        DSClientAPI.init(basePath: basePath.absoluteString , customHeaders: ["Authorization": "Bearer \(token)"])
```

## Step 3. Call the eSignature REST API to get the user signature ID

Next, use the account information you retrieved in step 2 to make the API call via the [userSignaturesGetUserSignature](https://docusign.github.io/native-ios-sdk/documentation/docusignapi/usersapi/usersignaturesgetusersignature\(accountid:signatureid:userid:completion:\)) method.

**`Objective-C`**

```text title="Objective-C"
[UsersAPI userSignaturesGetUserSignaturesWithAccountId:accountId userId:userId stampType:NULL completion:^(DSAPIUserSignaturesInformation* data, NSError * error) {
        if (error) {
            NSString *errorDescription = [NSString stringWithFormat:@"[sample-app]-\nUnable to make direct API call-\n%@.", error.localizedDescription];
            NSLog(@"%@", errorDescription);
            self->_results.text = errorDescription;
            return;
        } else {
            NSString *resultsText = [NSString stringWithFormat:@"User Signature ID: \n%@", data.userSignatures[0].signatureId];
            self->_results.text = resultsText;
            NSLog(@"%@", data.userSignatures[0].signatureId);
        }
    }];
```

**`Swift`**

```swift title="Swift"
UsersAPI.userSignaturesGetUserSignature(accountId: accountId, userId: userId) { data, error in
      if let error = error {
            print(error)
       }
       else {
            print("Signature Id: \(String(describing: data?.userSignatures?[0].signatureId))")
```

## Expected response

You should receive your user’s signature ID.

```text
Signature Id: 7faf2365-xxxx-xxxx-xxxx-1cbd9e6dff30
```

## Next steps

* See [How to request a signature online (embedded signing)](/docs/mobile-sdks/ios-sdk/how-to/request-signature-embedded).
* Learn [How to create an envelope for offline signing (PDF)](/docs/mobile-sdks/ios-sdk/how-to/offline-signing-pdf).
* See [How to start the signing process for an unsigned envelope without connectivity (offline)](/docs/mobile-sdks/ios-sdk/how-to/start-signing-offline).