Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Full Unique Name Used by API entry
How-to guide

Create a custom field and set its API Name

You assign an API Name every time you create a custom field. The setup wizard proposes one from your Label, but you can refine it. Here is how to create a custom field and set a clean API Name on a custom or standard object in Lightning Experience.

By Dipojjal Chakrabarti · Founder & Editor, Salesforce DictionaryLast updated Jun 16, 2026

You assign an API Name every time you create a custom field. The setup wizard proposes one from your Label, but you can refine it. Here is how to create a custom field and set a clean API Name on a custom or standard object in Lightning Experience.

  1. Open the object in Object Manager

    From Setup, type Object Manager in Quick Find and open it. Click the object you want to extend, then choose Fields and Relationships, and click New.

  2. Pick the field type

    Select the data type, such as Text, Number, or Picklist, then click Next. The type cannot be changed freely later, so choose carefully.

  3. Enter the Label and review the API Name

    Type the Field Label. Salesforce fills in Field Name (the API Name) by replacing spaces with underscores. Adjust it now to keep it clear, short, and consistent with your other fields.

  4. Set visibility and save

    Choose field-level security and the page layouts where the field appears, then click Save. The platform appends __c to your API Name automatically.

Mandatory fields
Field Labelrequired

The display name users see. Salesforce derives a starting API Name from it but the two can differ.

Field Name (API Name)required

The programmatic identifier. Must start with a letter, use only letters, numbers, and single underscores, and stay within 40 characters.

Data Typerequired

Determines how the field stores and validates data, and shapes how it behaves in queries and formulas.

Gotchas
  • The API Name cannot end with an underscore or contain two consecutive underscores in the part you enter; the platform reserves __ for its own suffix.
  • Renaming the API Name after code or integrations reference it can throw errors, so settle on the name before you build automation.
  • On a field added by a managed package, the API Name includes the namespace prefix, and you must reference it exactly in code.

See the full Unique Name Used by API entry

Unique Name Used by API includes the definition, worked example, deep dive, related terms, and a quiz.