> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.hellosign.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.hellosign.com/_mcp/server.

# OAuth Token Generate

POST https://app.hellosign.com/oauth/token
Content-Type: application/json

Once you have retrieved the code from the user callback, you will need to exchange it for an access token via a backend call.

Reference: https://developers.hellosign.com/docs/guides/o-auth/token-generate

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Dropbox Sign API
  version: 1.0.0
paths:
  /oauth/token:
    post:
      operationId: tokenGenerate
      summary: OAuth Token Generate
      description: >-
        Once you have retrieved the code from the user callback, you will need
        to exchange it for an access token via a backend call.
      tags:
        - OAuth
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthTokenResponse'
        '400':
          description: failed_operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OAuthTokenGenerateRequest'
servers:
  - url: https://app.hellosign.com
    description: https://app.hellosign.com
components:
  schemas:
    OAuthTokenGenerateRequest:
      type: object
      properties:
        client_id:
          type: string
          description: The client id of the app requesting authorization.
        client_secret:
          type: string
          description: The secret token of your app.
        code:
          type: string
          description: The code passed to your callback when the user granted access.
        grant_type:
          type: string
          default: authorization_code
          description: When generating a new token use `authorization_code`.
        state:
          type: string
          description: Same as the state you specified earlier.
      required:
        - client_id
        - client_secret
        - code
        - grant_type
        - state
      title: OAuthTokenGenerateRequest
    OAuthTokenResponse:
      type: object
      properties:
        access_token:
          type: string
        token_type:
          type: string
        refresh_token:
          type: string
        expires_in:
          type: integer
          description: Number of seconds until the `access_token` expires. Uses epoch time.
        state:
          type:
            - string
            - 'null'
      title: OAuthTokenResponse
    ErrorResponseError:
      type: object
      properties:
        error_msg:
          type: string
          description: Message describing an error.
        error_path:
          type: string
          description: Path at which an error occurred.
        error_name:
          type: string
          description: >-
            Name of the error. See the `x-error-codes` catalog in openapi file
            for a complete list of possible error codes with detailed
            information including HTTP status codes, causes, remediation steps,
            and retry guidance.
      required:
        - error_msg
        - error_name
      description: Contains information about an error that occurred.
      title: ErrorResponseError
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorResponseError'
      required:
        - error
      title: ErrorResponse

```

## Examples

### Retrieving the OAuth token



**Request**

```json
undefined
```

**Response**

```json
{
  "access_token": "NWNiOTMxOGFkOGVjMDhhNTAxZN2NkNjgxMjMwOWJiYTEzZTBmZGUzMjMThhMzYyMzc=",
  "token_type": "Bearer",
  "refresh_token": "hNTI2MTFmM2VmZDQxZTZjOWRmZmFjZmVmMGMyNGFjMzI2MGI5YzgzNmE3",
  "expires_in": 86400,
  "state": "900e06e2"
}
```

**SDK Code**

```php PHP
<?php

namespace Dropbox\SignSandbox;

require_once __DIR__ . '/../vendor/autoload.php';

use SplFileObject;
use Dropbox;

$config = Dropbox\Sign\Configuration::getDefaultConfiguration();

$o_auth_token_generate_request = (new Dropbox\Sign\Model\OAuthTokenGenerateRequest())
    ->setClientId("cc91c61d00f8bb2ece1428035716b")
    ->setClientSecret("1d14434088507ffa390e6f5528465")
    ->setCode("1b0d28d90c86c141")
    ->setState("900e06e2")
    ->setGrantType("authorization_code");

try {
    $response = (new Dropbox\Sign\Api\OAuthApi(config: $config))->oauthTokenGenerate(
        o_auth_token_generate_request: $o_auth_token_generate_request,
    );

    print_r($response);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling OAuthApi#oauthTokenGenerate: {$e->getMessage()}";
}

```

```csharp C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;

using Dropbox.Sign.Api;
using Dropbox.Sign.Client;
using Dropbox.Sign.Model;

namespace Dropbox.SignSandbox;

public class OauthTokenGenerateExample
{
    public static void Run()
    {
        var config = new Configuration();

        var oAuthTokenGenerateRequest = new OAuthTokenGenerateRequest(
            clientId: "cc91c61d00f8bb2ece1428035716b",
            clientSecret: "1d14434088507ffa390e6f5528465",
            code: "1b0d28d90c86c141",
            state: "900e06e2",
            grantType: "authorization_code"
        );

        try
        {
            var response = new OAuthApi(config).OauthTokenGenerate(
                oAuthTokenGenerateRequest: oAuthTokenGenerateRequest
            );

            Console.WriteLine(response);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling OAuthApi#OauthTokenGenerate: " + e.Message);
            Console.WriteLine("Status Code: " + e.ErrorCode);
            Console.WriteLine(e.StackTrace);
        }
    }
}

```

```typescript TypeScript
import * as fs from 'fs';
import api from "@dropbox/sign"
import models from "@dropbox/sign"

const apiCaller = new api.OAuthApi();

const oAuthTokenGenerateRequest: models.OAuthTokenGenerateRequest = {
  clientId: "cc91c61d00f8bb2ece1428035716b",
  clientSecret: "1d14434088507ffa390e6f5528465",
  code: "1b0d28d90c86c141",
  state: "900e06e2",
  grantType: "authorization_code",
};

apiCaller.oauthTokenGenerate(
  oAuthTokenGenerateRequest,
).then(response => {
  console.log(response.body);
}).catch(error => {
  console.log("Exception when calling OAuthApi#oauthTokenGenerate:");
  console.log(error.body);
});

```

```java Java
package com.dropbox.sign_sandbox;

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.JSON;
import com.dropbox.sign.model.*;

import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class OauthTokenGenerateExample
{
    public static void main(String[] args)
    {
        var config = Configuration.getDefaultApiClient();

        var oAuthTokenGenerateRequest = new OAuthTokenGenerateRequest();
        oAuthTokenGenerateRequest.clientId("cc91c61d00f8bb2ece1428035716b");
        oAuthTokenGenerateRequest.clientSecret("1d14434088507ffa390e6f5528465");
        oAuthTokenGenerateRequest.code("1b0d28d90c86c141");
        oAuthTokenGenerateRequest.state("900e06e2");
        oAuthTokenGenerateRequest.grantType("authorization_code");

        try
        {
            var response = new OAuthApi(config).oauthTokenGenerate(
                oAuthTokenGenerateRequest
            );

            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling OAuthApi#oauthTokenGenerate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

```

```ruby Ruby
require "json"
require "dropbox-sign"

Dropbox::Sign.configure do |config|
end

o_auth_token_generate_request = Dropbox::Sign::OAuthTokenGenerateRequest.new
o_auth_token_generate_request.client_id = "cc91c61d00f8bb2ece1428035716b"
o_auth_token_generate_request.client_secret = "1d14434088507ffa390e6f5528465"
o_auth_token_generate_request.code = "1b0d28d90c86c141"
o_auth_token_generate_request.state = "900e06e2"
o_auth_token_generate_request.grant_type = "authorization_code"

begin
    response = Dropbox::Sign::OAuthApi.new.oauth_token_generate(
        o_auth_token_generate_request,
    )

    p response
rescue Dropbox::Sign::ApiError => e
    puts "Exception when calling OAuthApi#oauth_token_generate: #{e}"
end

```

```python Python
import json
from datetime import date, datetime
from pprint import pprint

from dropbox_sign import ApiClient, ApiException, Configuration, api, models

configuration = Configuration(
)

with ApiClient(configuration) as api_client:
    o_auth_token_generate_request = models.OAuthTokenGenerateRequest(
        client_id="cc91c61d00f8bb2ece1428035716b",
        client_secret="1d14434088507ffa390e6f5528465",
        code="1b0d28d90c86c141",
        state="900e06e2",
        grant_type="authorization_code",
    )

    try:
        response = api.OAuthApi(api_client).oauth_token_generate(
            o_auth_token_generate_request=o_auth_token_generate_request,
        )

        pprint(response)
    except ApiException as e:
        print("Exception when calling OAuthApi#oauth_token_generate: %s\n" % e)

```

```go Retrieving the OAuth token
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://app.hellosign.com/oauth/token"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```swift Retrieving the OAuth token
import Foundation

let headers = ["Content-Type": "application/json"]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.hellosign.com/oauth/token")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### OAuth Token Generate Example



**Request**

```json
{
  "client_id": "cc91c61d00f8bb2ece1428035716b",
  "client_secret": "1d14434088507ffa390e6f5528465",
  "code": "1b0d28d90c86c141",
  "grant_type": "authorization_code",
  "state": "900e06e2"
}
```

**Response**

```json
{
  "access_token": "NWNiOTMxOGFkOGVjMDhhNTAxZN2NkNjgxMjMwOWJiYTEzZTBmZGUzMjMThhMzYyMzc=",
  "token_type": "Bearer",
  "refresh_token": "hNTI2MTFmM2VmZDQxZTZjOWRmZmFjZmVmMGMyNGFjMzI2MGI5YzgzNmE3",
  "expires_in": 86400,
  "state": "900e06e2"
}
```

**SDK Code**

```php PHP
<?php

namespace Dropbox\SignSandbox;

require_once __DIR__ . '/../vendor/autoload.php';

use SplFileObject;
use Dropbox;

$config = Dropbox\Sign\Configuration::getDefaultConfiguration();

$o_auth_token_generate_request = (new Dropbox\Sign\Model\OAuthTokenGenerateRequest())
    ->setClientId("cc91c61d00f8bb2ece1428035716b")
    ->setClientSecret("1d14434088507ffa390e6f5528465")
    ->setCode("1b0d28d90c86c141")
    ->setState("900e06e2")
    ->setGrantType("authorization_code");

try {
    $response = (new Dropbox\Sign\Api\OAuthApi(config: $config))->oauthTokenGenerate(
        o_auth_token_generate_request: $o_auth_token_generate_request,
    );

    print_r($response);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling OAuthApi#oauthTokenGenerate: {$e->getMessage()}";
}

```

```csharp C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;

using Dropbox.Sign.Api;
using Dropbox.Sign.Client;
using Dropbox.Sign.Model;

namespace Dropbox.SignSandbox;

public class OauthTokenGenerateExample
{
    public static void Run()
    {
        var config = new Configuration();

        var oAuthTokenGenerateRequest = new OAuthTokenGenerateRequest(
            clientId: "cc91c61d00f8bb2ece1428035716b",
            clientSecret: "1d14434088507ffa390e6f5528465",
            code: "1b0d28d90c86c141",
            state: "900e06e2",
            grantType: "authorization_code"
        );

        try
        {
            var response = new OAuthApi(config).OauthTokenGenerate(
                oAuthTokenGenerateRequest: oAuthTokenGenerateRequest
            );

            Console.WriteLine(response);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling OAuthApi#OauthTokenGenerate: " + e.Message);
            Console.WriteLine("Status Code: " + e.ErrorCode);
            Console.WriteLine(e.StackTrace);
        }
    }
}

```

```typescript TypeScript
import * as fs from 'fs';
import api from "@dropbox/sign"
import models from "@dropbox/sign"

const apiCaller = new api.OAuthApi();

const oAuthTokenGenerateRequest: models.OAuthTokenGenerateRequest = {
  clientId: "cc91c61d00f8bb2ece1428035716b",
  clientSecret: "1d14434088507ffa390e6f5528465",
  code: "1b0d28d90c86c141",
  state: "900e06e2",
  grantType: "authorization_code",
};

apiCaller.oauthTokenGenerate(
  oAuthTokenGenerateRequest,
).then(response => {
  console.log(response.body);
}).catch(error => {
  console.log("Exception when calling OAuthApi#oauthTokenGenerate:");
  console.log(error.body);
});

```

```java Java
package com.dropbox.sign_sandbox;

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.JSON;
import com.dropbox.sign.model.*;

import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class OauthTokenGenerateExample
{
    public static void main(String[] args)
    {
        var config = Configuration.getDefaultApiClient();

        var oAuthTokenGenerateRequest = new OAuthTokenGenerateRequest();
        oAuthTokenGenerateRequest.clientId("cc91c61d00f8bb2ece1428035716b");
        oAuthTokenGenerateRequest.clientSecret("1d14434088507ffa390e6f5528465");
        oAuthTokenGenerateRequest.code("1b0d28d90c86c141");
        oAuthTokenGenerateRequest.state("900e06e2");
        oAuthTokenGenerateRequest.grantType("authorization_code");

        try
        {
            var response = new OAuthApi(config).oauthTokenGenerate(
                oAuthTokenGenerateRequest
            );

            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling OAuthApi#oauthTokenGenerate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

```

```ruby Ruby
require "json"
require "dropbox-sign"

Dropbox::Sign.configure do |config|
end

o_auth_token_generate_request = Dropbox::Sign::OAuthTokenGenerateRequest.new
o_auth_token_generate_request.client_id = "cc91c61d00f8bb2ece1428035716b"
o_auth_token_generate_request.client_secret = "1d14434088507ffa390e6f5528465"
o_auth_token_generate_request.code = "1b0d28d90c86c141"
o_auth_token_generate_request.state = "900e06e2"
o_auth_token_generate_request.grant_type = "authorization_code"

begin
    response = Dropbox::Sign::OAuthApi.new.oauth_token_generate(
        o_auth_token_generate_request,
    )

    p response
rescue Dropbox::Sign::ApiError => e
    puts "Exception when calling OAuthApi#oauth_token_generate: #{e}"
end

```

```python Python
import json
from datetime import date, datetime
from pprint import pprint

from dropbox_sign import ApiClient, ApiException, Configuration, api, models

configuration = Configuration(
)

with ApiClient(configuration) as api_client:
    o_auth_token_generate_request = models.OAuthTokenGenerateRequest(
        client_id="cc91c61d00f8bb2ece1428035716b",
        client_secret="1d14434088507ffa390e6f5528465",
        code="1b0d28d90c86c141",
        state="900e06e2",
        grant_type="authorization_code",
    )

    try:
        response = api.OAuthApi(api_client).oauth_token_generate(
            o_auth_token_generate_request=o_auth_token_generate_request,
        )

        pprint(response)
    except ApiException as e:
        print("Exception when calling OAuthApi#oauth_token_generate: %s\n" % e)

```

```go OAuth Token Generate Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.hellosign.com/oauth/token"

	payload := strings.NewReader("{\n  \"client_id\": \"cc91c61d00f8bb2ece1428035716b\",\n  \"client_secret\": \"1d14434088507ffa390e6f5528465\",\n  \"code\": \"1b0d28d90c86c141\",\n  \"grant_type\": \"authorization_code\",\n  \"state\": \"900e06e2\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```swift OAuth Token Generate Example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "client_id": "cc91c61d00f8bb2ece1428035716b",
  "client_secret": "1d14434088507ffa390e6f5528465",
  "code": "1b0d28d90c86c141",
  "grant_type": "authorization_code",
  "state": "900e06e2"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.hellosign.com/oauth/token")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```