---
agentTools:
  projectIndex: https://uspacy.readme.io/llms.txt
---

# Get field by code

Returns a single field definition by its code for a specific entity.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "CRM service",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://{domain}.uspacy.ua",
      "description": "Ukrainian server"
    },
    {
      "url": "https://{domain}.uspacy.eu",
      "description": "EU server"
    },
    {
      "url": "https://{domain}.uspacy.com.br",
      "description": "Brazilian server"
    },
    {
      "url": "https://{domain}.uspacy.com",
      "description": "International server"
    }
  ],
  "tags": [
    {
      "name": "fields",
      "description": "Fields, field types, list values, and field dependencies"
    }
  ],
  "paths": {
    "/crm/v1/entities/{entity}/fields/{field}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/entity"
        },
        {
          "$ref": "#/components/parameters/field"
        }
      ],
      "get": {
        "tags": [
          "fields"
        ],
        "summary": "Get field by code",
        "description": "Returns a single field definition by its code for a specific entity.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Field"
                },
                "example": {
                  "name": "Source",
                  "code": "source",
                  "required": false,
                  "editable": true,
                  "show": true,
                  "hidden": false,
                  "multiple": false,
                  "fieldSectionId": 1,
                  "default_value": "",
                  "tooltip": "Lead source channel",
                  "type": "list",
                  "sort": 20
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedError"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "responses": {
      "UnauthorizedError": {
        "description": "Access token is missing or invalid"
      }
    },
    "parameters": {
      "entity": {
        "name": "entity",
        "in": "path",
        "description": "Entity table name",
        "required": true,
        "schema": {
          "type": "string",
          "enum": [
            "leads",
            "deals",
            "contacts",
            "companies"
          ]
        },
        "example": "leads"
      },
      "field": {
        "name": "field",
        "in": "path",
        "description": "Field code",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "Field": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "Source"
          },
          "code": {
            "type": "string",
            "example": "source"
          },
          "required": {
            "type": "boolean",
            "example": false
          },
          "editable": {
            "type": "boolean",
            "example": true
          },
          "show": {
            "type": "boolean",
            "example": true
          },
          "hidden": {
            "type": "boolean",
            "example": false
          },
          "multiple": {
            "type": "boolean",
            "example": false
          },
          "fieldSectionId": {
            "type": "integer",
            "example": 11
          },
          "default_value": {
            "type": "string",
            "example": "value"
          },
          "tooltip": {
            "type": "string",
            "example": "example"
          },
          "type": {
            "type": "string",
            "example": "entity_reference"
          },
          "entity_reference_id": {
            "type": "integer",
            "example": 123
          },
          "sort": {
            "type": "integer",
            "example": 90
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 105,
      "1": 145,
      "2": 108,
      "3": 28,
      "4": 165,
      "5": 162,
      "6": 20,
      "7": 148,
      "8": 43,
      "9": 242,
      "10": 235,
      "11": 56
    }
  }
}
```