---
schema_version: "1"
id: cbbadc9ecde38e52098bb7272669372654bb70721d83e6901c85ed2c20f75d5c
title: Define a Charset in the Schema
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/external_services_define_charset.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.external_services_define_charset.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 2aab1ebce174faa262da2d3c78b38b1389aeda9b5fa1e99ccda391ab23da3bbd
description: To specify a charset for external callouts, populate the Content-Type header. A charset can be set if specifically defined in the schema.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# Define a Charset in the Schema

To specify a `charset` for external callouts, populate the `Content-Type` header. A `charset` can be set if specifically defined in the schema.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr></tbody></table>

During an external callout, the `Content-Type` header is used to describe the media type (for example, application/json, text/plain, etc.) of a resource that can be consumed by the operation.

`charset` is an optional parameter of `Content-Type` that specifies the character encoding of the media type.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_note.png)

Note With the Spring ’23 release, `charset` in the `Content-Type` header is no longer populated by default when making external callouts. Previously, `Content-Type` included the `charset=UTF-8` parameter by default.

As an example, we'll edit the BankService schema to set `charset` to `UTF-8`. As OpenAPI 2.0 and Open API 3.0 schema versions are implemented differently, we'll use both versions.

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_example.png)

Example Define `charset` in an OpenAPI 2.0 Schema

```
{
    "swagger":"2.0",
    "basePath":"/",
    "info":{
        "version":"1.0",
        "title":"External Service for demo bank",
        "description":"### External Service for demo bank",
        "x-vcap-service-name":"DemoBankRestServices"
    },
    "securityDefinitions":{
        "basicAuth":{
            "type":"basic"
        }
    },
    "security":[
        {
            "basicAuth":[
                
            ]
        }
    ],
    "tags":[
        {
            "name":"DemoBankRestServices"
        }
    ],
    "paths":{
        "/accounts/{accountName}":{
            "get":{
                "operationId":"getAccount",
                "summary":"Retrieves an account",
                "description":"Retrieves the account with specific name",
                "consumes":[
                    "text/plain; charset=UTF-8"
                ],
                "produces":[
                    "application/json"
                ],
                "parameters":[
                    {
                        "name":"accountName",
                        "in":"path",
                        "required":true,
                        "type":"string",
                        "description":"Name of the account"
                    }
                ],
                "responses":{
                    "200":{
                        "description":"The response when system finds an account with given name",
                        "schema":{
                            "$ref":"#/definitions/accountDetails"
                        }
                    },
                    "400":{
                        "description":"Error response if the account name parameter is less than minimum characters",
                        "schema":{
                            "$ref":"#/definitions/errorModel"
                        }
                    },
                    "404":{
                        "description":"Error response if the account is not supported by service or account is not found",
                        "schema":{
                            "$ref":"#/definitions/errorModel"
                        }
                    }
                }
            },
            "delete":{
                "operationId":"DeleteAccount",
                "summary":"Deletes an account",
                "description":"Deletes the account with specific name",
                "consumes":[
                    "text/plain; charset=UTF-8"
                ],
                "produces":[
                    "application/json"
                ],
                "parameters":[
                    {
                        "name":"accountName",
                        "in":"path",
                        "required":true,
                        "type":"string",
                        "description":"Name of the account"
                    }
                ],
                "responses":{
                    "204":{
                        "description":"The response when system finds an account with given name",
                        "schema":{
                            "type":"string"
                        }
                    },
                    "400":{
                        "description":"Error response if the account name parameter is less than minimum characters",
                        "schema":{
                            "$ref":"#/definitions/errorModel"
                        }
                    },
                    "404":{
                        "description":"Error response if the account is not supported by service or account is not found",
                        "schema":{
                            "$ref":"#/definitions/errorModel"
                        }
                    }
                }
            },
            "post":{
                "operationId":"addAccount",
                "summary":"Add an account",
                "description":"Add an account to the database",
                "consumes":[
                    "text/plain; charset=UTF-8"
                ],
                "produces":[
                    "application/json"
                ],
                "parameters":[
                    {
                        "name":"accountName",
                        "in":"path",
                        "required":true,
                        "type":"string",
                        "description":"Name of the account"
                    },
                    {
                        "name":"accountType",
                        "in":"query",
                        "required":true,
                        "type":"string",
                        "description":"The type of account"
                    }
                ],
                "responses":{
                    "201":{
                        "description":"The response when the account does not already exist and we can create one",
                        "schema":{
                            "$ref":"#/definitions/accountDetails"
                        }
                    },
                    "409":{
                        "description":"The response when the account already exists and we cannot create one",
                        "schema":{
                            "$ref":"#/definitions/accountDetails"
                        }
                    },
                    "400":{
                        "description":"Error response if the account name parameter is less than minimum characters",
                        "schema":{
                            "$ref":"#/definitions/errorModel"
                        }
                    },
                    "404":{
                        "description":"Error response if the account is not supported by service or account is not found",
                        "schema":{
                            "$ref":"#/definitions/errorModel"
                        }
                    }
                }
            },
            "put":{
                "operationId":"updateAccount",
                "summary":"Updates an account",
                "description":"Updates the account with specified name",
                "consumes":[
                    "text/plain; charset=UTF-8"
                ],
                "produces":[
                    "application/json"
                ],
                "parameters":[
                    {
                        "name":"accountName",
                        "in":"path",
                        "required":true,
                        "type":"string",
                        "description":"Name of the account"
                    },
                    {
                        "name":"accountType",
                        "in":"query",
                        "required":true,
                        "type":"string",
                        "description":"The type of account"
                    }
                ],
                "responses":{
                    "200":{
                        "description":"The response when system finds an account with given name",
                        "schema":{
                            "$ref":"#/definitions/accountDetails"
                        }
                    },
                    "400":{
                        "description":"Error response if the account name parameter is less than minimum characters",
                        "schema":{
                            "$ref":"#/definitions/errorModel"
                        }
                    },
                    "404":{
                        "description":"Error response if the account is not supported by service or account is not found",
                        "schema":{
                            "$ref":"#/definitions/errorModel"
                        }
                    }
                }
            }
        }
    },
    "definitions":{
        "accountDetails":{
            "required":[
                "id",
                "name",
                "type",
                "availableBal"
            ],
            "properties":{
                "id":{
                    "type":"string",
                    "description":"id"
                },
                "name":{
                    "type":"string",
                    "description":"name"
                },
                "type":{
                    "type":"string",
                    "description":"type"
                },
                "availableBal":{
                    "type":"string",
                    "description":"availableBal"
                }
            }
        },
        "errorModel":{
            "required":[
                "errorCode",
                "errorMessage"
            ],
            "properties":{
                "errorCode":{
                    "type":"string",
                    "description":"A service-specific error code."
                },
                "errorMessage":{
                    "type":"string",
                    "description":"A service-specific error code."
                }
            }
        }
    }
}
```

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_example.png)

Example Define `charset` in an OpenAPI 3.0 Schema

```
{
  "openapi": "3.0.1",
  "info": {
    "title": "External Service for demo bank",
    "description": "### External Service for demo bank",
    "version": "1.0",
    "x-vcap-service-name": "DemoBankRestServices"
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "security": [
    {
      "basicAuth": []
    }
  ],
  "tags": [
    {
      "name": "DemoBankRestServices"
    }
  ],
  "paths": {
    "/accounts/{accountName}": {
      "get": {
        "summary": "Retrieves an account",
        "description": "Retrieves the account with specific name",
        "operationId": "getAccount",
        "parameters": [
          {
            "name": "accountName",
            "in": "path",
            "description": "Name of the account",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The response when system finds an account with given name",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/accountDetails"
                }
              }
            }
          },
          "400": {
            "description": "Error response if the account name parameter is less than minimum characters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorModel"
                }
              }
            }
          },
          "404": {
            "description": "Error response if the account is not supported by service or account is not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorModel"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Updates an account",
        "description": "Updates the account with specified name",
        "operationId": "updateAccount",
        "parameters": [
          {
            "name": "accountName",
            "in": "path",
            "description": "Name of the account",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accountType",
            "in": "query",
            "description": "The type of account",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded; charset=UTF-8": {
              "schema": {
                "type": "string"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The response when system finds an account with given name",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/accountDetails"
                }
              }
            }
          },
          "400": {
            "description": "Error response if the account name parameter is less than minimum characters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorModel"
                }
              }
            }
          },
          "404": {
            "description": "Error response if the account is not supported by service or account is not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorModel"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Add an account",
        "description": "Add an account to the database",
        "operationId": "addAccount",
        "parameters": [
          {
            "name": "accountName",
            "in": "path",
            "description": "Name of the account",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accountType",
            "in": "query",
            "description": "The type of account",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded; charset=UTF-8": {
              "schema": {
                "type": "string"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The response when the account does not already exist and we can create one",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/accountDetails"
                }
              }
            }
          },
          "400": {
            "description": "Error response if the account name parameter is less than minimum characters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorModel"
                }
              }
            }
          },
          "404": {
            "description": "Error response if the account is not supported by service or account is not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorModel"
                }
              }
            }
          },
          "409": {
            "description": "The response when the account already exists and we cannot create one",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/accountDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Deletes an account",
        "description": "Deletes the account with specific name",
        "operationId": "DeleteAccount",
        "parameters": [
          {
            "name": "accountName",
            "in": "path",
            "description": "Name of the account",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The response when system finds an account with given name",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Error response if the account name parameter is less than minimum characters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorModel"
                }
              }
            }
          },
          "404": {
            "description": "Error response if the account is not supported by service or account is not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorModel"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "accountDetails": {
        "required": [
          "availableBal",
          "id",
          "name",
          "type"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "id"
          },
          "name": {
            "type": "string",
            "description": "name"
          },
          "type": {
            "type": "string",
            "description": "type"
          },
          "availableBal": {
            "type": "string",
            "description": "availableBal"
          }
        }
      },
      "errorModel": {
        "required": [
          "errorCode",
          "errorMessage"
        ],
        "type": "object",
        "properties": {
          "errorCode": {
            "type": "string",
            "description": "A service-specific error code."
          },
          "errorMessage": {
            "type": "string",
            "description": "A service-specific error code."
          }
        }
      }
    },
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      }
    }
  }
}
```