# Associate a Shared Custom Field with an object type

POST https://api.close.com/api/v1/custom_field/shared/{scf_id}/association/
Content-Type: application/json

Associates a Shared Custom Field with an object type such as Lead, Contact, or Custom Activity Type. Once associated, the Shared Custom Field can be set on objects of that type.

This endpoint accepts the following attributes:

- `object_type` – can be one of: `lead`, `contact`, `opportunity`, `custom_activity_type`,
  `custom_object_type`.
- `custom_activity_type_id` – ID of the Custom Activity Type that you want to
  associate this Shared Field with. Only relevant if you chose the `object_type` of `custom_activity_type`.
- `custom_object_type_id` – ID of the Custom Object Type that you want to
  associate this Shared Field with. Only relevant if you chose the `object_type` of `custom_object_type`.
- `editable_with_roles` – list of [Roles](/resources/roles/) that can edit the values of
  this Field on the given object. Note that this is a per-association setting, meaning that editing of the Shared Custom Field can be restricted on one object and not restricted on another.
- `required` – whether a value *must* be provided for this Field on the given
  object. Only relevant if you chose the `object_type` of `custom_activity_type` or `custom_object_type`. Note that this is a per-association setting, meaning that this Shared Custom Field can be required on one object and not required on another.

Reference: https://developer.close.com/api/resources/custom-fields/custom-fields-shared/create-association

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Close API
  version: 1.0.0
paths:
  /custom_field/shared/{scf_id}/association/:
    post:
      operationId: create-association
      summary: Associate a Shared Custom Field with an object type
      description: "Associates a Shared Custom Field with an object type such as Lead, Contact, or Custom Activity Type. Once associated, the Shared Custom Field can be set on objects of that type.\n\nThis endpoint accepts the following attributes:\n\n- `object_type` –\_can be one of: `lead`, `contact`, `opportunity`, `custom_activity_type`,\n  `custom_object_type`.\n- `custom_activity_type_id` – ID of the Custom Activity Type that you want to\n  associate this Shared Field with. Only relevant if you chose the `object_type` of `custom_activity_type`.\n- `custom_object_type_id` – ID of the Custom Object Type that you want to\n  associate this Shared Field with. Only relevant if you chose the `object_type` of `custom_object_type`.\n- `editable_with_roles` – list of [Roles](/resources/roles/) that can edit the values of\n  this Field on the given object. Note that this is a per-association setting, meaning that editing of the Shared Custom Field can be restricted on one object and not restricted on another.\n- `required` – whether a value *must* be provided for this Field on the given\n  object. Only relevant if you chose the `object_type` of `custom_activity_type` or `custom_object_type`. Note that this is a per-association setting, meaning that this Shared Custom Field can be required on one object and not required on another."
      tags:
        - subpackage_customFieldsShared
      parameters:
        - name: scf_id
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Basic authentication
          required: true
          schema:
            type: string
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/custom_fields.shared_createAssociation_Response_201
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                description: Any type
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                description: Any type
        '404':
          description: Not found
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              description: Any type
servers:
  - url: https://api.close.com/api/v1
components:
  schemas:
    custom_fields.shared_createAssociation_Response_201:
      type: object
      properties: {}
      description: Empty response body
      title: custom_fields.shared_createAssociation_Response_201
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: basic
    OAuth2:
      type: http
      scheme: bearer

```