# Apply branding to documents using API

The branding feature in BoldSign empowers you to personalize the appearance of emails sent to recipients, including elements like logos, background colors, and button colors.

BoldSign also supports the creation of multiple brands within the same account.

### 1. Create a brand in the web app or API
To create a brand using the web app, follow the guide on how to [Create a Brand in the BoldSign Web App](https://support.boldsign.com/kb/article/616/how-to-send-a-document-with-your-brand-identity)

If you prefer to create a brand using the API, refer to the guide [Create a Brand via API](https://developers.boldsign.com/branding/create-brand/).

### 2. Applying the branding ID to the document
After successfully creating a brand, a brand ID will be generated. This brand ID will be used to associate the brand with a specific document.

Here are example codes that you can use for this purpose:

### Code snippet

{% codetab %}

cURL

```shell 
curl -X 'POST' \ 'https://api.boldsign.com/v1/document/send' \
     -H 'accept: application/json' \
     -H 'X-API-KEY: {your API key}' \
     -H 'Content-Type: multipart/form-data' \
     -F 'BrandId= {your brand ID}' \
     -F 'Message=' \
     -F 'Signers={
        "name": "Hanky",
        "emailAddress": "hankyWhites@cubeflakes.com",
        "signerType": "Signer",
        "formFields": [
           {
                "id": "string",
                "name": "string",
                "fieldType": "Signature",
                "pageNumber": 1,
                "bounds": {
                  "x": 50,
                  "y": 50,
                  "width": 1,
                  "height": 1
                   },
      "isRequired": true
    }
  ],
  "locale": "EN"
}' \
  -F 'Files={your file}' \
  -F 'Title={title}' \

```
C#

```csharp
var apiClient = new ApiClient("https://api.boldsign.com", "{your API key}");
var documentClient = new DocumentClient(apiClient);

var documentFilePath = new DocumentFilePath
{
   ContentType = "application/pdf",
   FilePath = "{Your file path}", 
};

var filesToUpload = new List<IDocumentFile>
{
    documentFilePath,
};

var signatureField = new FormField(
   id: "sign",
   isRequired: true,
   type: FieldType.Signature,
   pageNumber: 1,
   bounds: new Rectangle(x: 100, y: 100, width: 100, height: 50));

var formFieldCollections = new List<FormField>()
{
    signatureField
};

var signer = new DocumentSigner(
    signerName: "Signer Name 1",
    signerType: SignerType.Signer,
    signerEmail: "signer1@email.com",
    formFields: formFieldCollections,
    locale: Locales.EN);

var documentSigners = new List<DocumentSigner>()
{
    signer
};

var sendForSign = new SendForSign()
{
   Message = "please sign this",
   Title = "Agreement",
   BrandId = "{your brand ID}",
   Signers = documentSigners,
   Files = filesToUpload
};
var documentCreated = documentClient.SendDocument(sendForSign);
```

Python

```python
import requests
import json

url = "https://api.boldsign.com/v1/document/send"

signer_data = {
    "name": "Hanky",
    "emailAddress": "hankyWhites@cubeflakes.com",
    "signerType": "Signer",
    "formFields": [
        {
            "id": "string",
            "name": "string",
            "fieldType": "Signature",
            "pageNumber": 1,
            "bounds": {
                "x": 50,
                "y": 50,
                "width": 1,
                "height": 1
            },
            "isRequired": True
        }
    ],
    "locale": "EN"
}

payload = {
    'BrandId': '{Your Brand Id}',
    'Message': '',
    'Signers': json.dumps(signer_data),
    'Title': '{title}'
}

files = [
    ('Files', (
        'doc-2.pdf',
        open('{Your file path}', 'rb'),
        'application/pdf'
    ))
]

headers = {
    'accept': 'application/json',
    'X-API-KEY': '{Your API Key}'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)

```

NodeJS

```js
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
let data = new FormData();
data.append('BrandId', '{Your Brand Id}');
data.append('Message', '');
data.append('Signers', '{\r\n        "name": "Hanky",\r\n        "emailAddress": "hankyWhites@cubeflakes.com",\r\n        "signerType": "Signer",\r\n        "formFields": [\r\n           {\r\n                "id": "string",\r\n                "name": "string",\r\n                "fieldType": "Signature",\r\n                "pageNumber": 1,\r\n                "bounds": {\r\n                  "x": 50,\r\n                  "y": 50,\r\n                  "width": 1,\r\n                  "height": 1\r\n                   },\r\n      "isRequired": true\r\n    }\r\n  ],\r\n  "locale": "EN"\r\n}');
data.append('Files', fs.createReadStream('{Your file path}'));
data.append('Title', '{title}');

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.boldsign.com/v1/document/send',
  headers: { 
    'accept': 'application/json', 
    'X-API-KEY': '{Your API key}', 
    ...data.getHeaders()
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
```
PHP

```php
<?php
require_once "vendor/autoload.php";
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7;

$client = new Client([
    'verify' => false
]);

$headers = [
    'accept' => 'application/json',
    'X-API-KEY' => '{Your API Key}'
];

$url = "https://api.boldsign.com/v1/document/send";

$signer_data = [
    "name" => "hanky",
    "emailAddress" => "hankyWhites@cubeflakes.com",
    "signerType" => "Signer",
    "formFields" => [
        [
            "id" => "sign1",
            "name" => "sign",
            "fieldType" => "Signature",
            "pageNumber" => 1,
            "bounds" => [
                "x" => 50,
                "y" => 50,
                "width" => 200,
                "height" => 25
            ],
            "isRequired" => true
        ]
    ],
    "locale" => "EN"
];

$payload = [
    'Message' => 'Please sign this.',
     'Title' => 'Sample document',
     'BrandId' => '18779cd3-xxxx-xxxx-883e-4d9ead5c699a',
    'Signers' => json_encode($signer_data),
];

// File path
$file_path = '{Your file path}';

// Prepare multipart form data
$multipart = [];

foreach ($payload as $name => $content) {
    $multipart[] = [
        'name' => $name,
        'contents' => $content
    ];
}

$multipart[] = [
    'name' => 'Files',
    'contents' => fopen($file_path, 'r'),
    'filename' => basename($file_path)
];

$request = new Request('POST', $url, $headers, new MultipartStream($multipart));

$response = $client->send($request);

echo $response->getBody();
?>

```

{% /codetab %}

In the above example, replace `BrandId` with the actual brand ID that you want to apply to the document. Execute the curl command while ensuring to provide the necessary fields such as `Files,` `Title,` and `Signers.` By doing so, the desired brand will be seamlessly applied to the created document. Subsequently, the signer will receive an email containing the brand logo, and the same brand logo will be prominently displayed on the signing page of the document.

For a visual reference, please take a look at the branding logo located in the top left corner of the document, as shown in the following image.

![Step 1](/static/images/guides/apply-brand-to-documents/step1.png)
