> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Save Target Group

> Updates the existing TargetGroup or creates a new TargetGroup if the id parameter is 0.

NsApiSlow threshold: 5000 ms.



## OpenAPI

````yaml /openapi/agent/openapi-v3-TargetsAgent.json post /api/v1/Agents/Targets/SaveTargetGroup
openapi: 3.0.0
info:
  version: v1-Agents
  title: SuperOffice Agent API v1
  description: SuperOffice Agent API - TargetsAgent
  contact:
    name: SuperOffice DevNet
    url: https://docs.superoffice.com/en/api/index.html
    email: sdk@superoffice.com
servers:
  - url: http://localhost:56350
  - url: https://localhost:56350
security: []
tags: []
externalDocs:
  description: >-
    The SuperOffice DevNet Community has more documentation, examples, and
    discussion forums.
  url: https://community.superoffice.com/en/developer/
paths:
  /api/v1/Agents/Targets/SaveTargetGroup:
    post:
      tags:
        - Targets_Agent
      summary: Save Target Group
      description: >-
        Updates the existing TargetGroup or creates a new TargetGroup if the id
        parameter is 0.


        NsApiSlow threshold: 5000 ms.
      operationId: v1TargetsAgent_SaveTargetGroup
      parameters:
        - name: Accept-Language
          in: header
          description: >-
            Convert string references and multi-language values into a specified
            language (iso2) code.
          required: false
          schema:
            type: string
        - name: SO-Language
          in: header
          description: >-
            Convert string references and multi-language values into a specified
            language (iso2) code. Overrides Accept-Language value.
          required: false
          schema:
            type: string
        - name: SO-Culture
          in: header
          description: >-
            Number, date formatting in a specified culture (iso2 language) code.
            Partially overrides SO-Language/Accept-Language value. Ignored if no
            Language set.
          required: false
          schema:
            type: string
        - name: SO-TimeZone
          in: header
          description: >-
            Specify the timezone code that you would like date/time responses
            converted to.
          required: false
          schema:
            type: string
        - name: SO-AppToken
          in: header
          description: >-
            The application token that identifies the partner app. Used when
            calling Online WebAPI from a server.
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetGroup'
          text/json:
            schema:
              $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetGroup'
          application/xml:
            schema:
              $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetGroup'
          text/xml:
            schema:
              $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetGroup'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetGroup'
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetGroup'
          application/merge-patch+json:
            schema:
              $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetGroup'
        description: The TargetGroup that is saved
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetGroup'
            text/json:
              schema:
                $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetGroup'
            application/xml:
              schema:
                $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetGroup'
            text/xml:
              schema:
                $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetGroup'
            application/json-patch+json:
              schema:
                $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetGroup'
            application/merge-patch+json:
              schema:
                $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetGroup'
      security:
        - SuperOffice_Password: []
          SuperId_Authentication: []
components:
  schemas:
    SuperOffice.CRM.Services.TargetGroup:
      description: "Target Group carrier\r\n<para />\r\nCarrier object for TargetGroup.\r\nServices for the TargetGroup Carrier is available from the <see cref=\"T:SuperOffice.CRM.Services.ITargetsAgent\">Targets Agent</see>."
      type: object
      properties:
        TargetGroupId:
          format: int32
          description: Primary key
          type: integer
        Year:
          format: int32
          description: The year this set of targets are associated with (2020, 2021...)
          type: integer
        EntityType:
          description: >-
            Entity type for this set of targets (Sale, Project, Selection,
            Appointment...)
          enum:
            - None
            - Sale
          type: string
        PeriodType:
          description: Period type for editing this set of targets (Year, Quarter...)
          enum:
            - None
            - Year
            - HalfYear
            - Quarter
            - Month
          type: string
        TargetAssignments:
          description: Collection of target values
          type: array
          items:
            $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetAssignment'
        TargetDimension:
          $ref: '#/components/schemas/SuperOffice.CRM.Services.TargetDimension'
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Services.TargetAssignment:
      description: "Target Period Assignment carrier\r\n<para />\r\nCarrier object for TargetAssignment.\r\nServices for the TargetAssignment Carrier is available from the <see cref=\"T:SuperOffice.CRM.Services.ITargetsAgent\">Targets Agent</see>."
      type: object
      properties:
        TargetAssignmentInfoId:
          format: int32
          description: Primary key
          type: integer
        Values:
          description: Values of the target; all periods; in ascending order.
          type: array
          items:
            format: double
            type: number
        Locked:
          description: Locked, should not be editable
          type: boolean
        TargetAssociate:
          $ref: '#/components/schemas/SuperOffice.CRM.Services.Associate'
        TargetContact:
          $ref: '#/components/schemas/SuperOffice.CRM.Services.Contact'
        TargetUserGroup:
          $ref: '#/components/schemas/SuperOffice.CRM.Services.UserGroup'
        Currency:
          $ref: '#/components/schemas/SuperOffice.CRM.Services.Currency'
        DimensionListItem:
          format: int32
          description: Id of the dimension list item this assignement is for
          type: integer
        DimensionListItemDisplayName:
          description: Display name of the dimension list item this assignement is for.
          type: string
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Services.TargetDimension:
      description: "Target Dimension carrier\r\n<para />\r\nCarrier object for TargetDimension.\r\nServices for the TargetDimension Carrier is available from the <see cref=\"T:SuperOffice.CRM.Services.ITargetsAgent\">Targets Agent</see>."
      type: object
      properties:
        TargetDimensionId:
          format: int32
          description: Primary key
          type: integer
        AssignmentLevel:
          description: >-
            What level this dimension can be assigned to (Company, Group,
            Associate)
          enum:
            - None
            - Company
            - Group
            - Associate
          type: string
        EntityType:
          description: >-
            Entity type for this set of targets (Sale, Project, Selection,
            Appointment...)
          enum:
            - None
            - Sale
          type: string
        MeasurementUnit:
          description: What to measure (Amount, Count, Profit...
          enum:
            - None
            - Amount
            - Count
            - Profit
          type: string
        DimensionListField:
          description: >-
            List that defines the dimensions for this target matrix (ex: Sale
            type, source, partner, business, udef or extrafield lists...)
          type: string
        DimensionListName:
          description: List name (can be used by list provider system to get list items)
          type: string
        DimensionListId:
          format: int32
          description: List id (can be used by list provider system to get list items)
          type: integer
        DimensionListLabel:
          description: list label (list column name)
          type: string
        SelectedDimensions:
          description: >-
            id's of the selected/wanted dimensions (what sale types or udef list
            lines that should be target dimensions)
          type: array
          items:
            format: int32
            type: integer
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Security.TableRight:
      description: "Wraps a table right together with an explanatory reason.\r\nCode can indicate why access is restricted."
      type: object
      properties:
        Mask:
          type: string
        Reason:
          type: string
    SuperOffice.CRM.Security.FieldProperty:
      description: >-
        Class holding properties like field length, field type about a field in
        the carrier.
      type: object
      properties:
        FieldRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldRight'
        FieldType:
          type: string
        FieldLength:
          format: int32
          description: ''
          type: integer
    SuperOffice.CRM.Services.Associate:
      description: "Carrier object for Associate.\r\nServices for the Associate Carrier is available from the <see cref=\"T:SuperOffice.CRM.Services.IAssociateAgent\">Associate Agent</see>."
      type: object
      properties:
        AssociateId:
          format: int32
          description: Primary key
          type: integer
        Name:
          description: Initials, also login name, possibly database user name
          type: string
        PersonId:
          format: int32
          description: "Owning person record \r\n<para>Use MDO List name \"person\" to get list items.</para>"
          type: integer
        Rank:
          format: int32
          description: Rank order
          type: integer
        Tooltip:
          description: Tooltip or other description
          type: string
        Type:
          description: >-
            User type - 1 = internal user, 2 = resource, 3 = external user, 4 =
            anonymous, 5 = system
          enum:
            - Unknown
            - InternalAssociate
            - ResourceAssociate
            - ExternalAssociate
            - AnonymousAssociate
            - SystemAssociate
          type: string
        GroupIdx:
          format: int32
          description: >-
            Primary group membership, see UserGroupLink for secondary
            memberships
          type: integer
        FullName:
          description: >-
            The associate's culture formatted fullname (firstname, middleName
            and lastname)
          type: string
        FormalName:
          description: >-
            The associate's culture formatted formalname (firstname, middleName
            and lastname, title, mrmrs)
          type: string
        Deleted:
          description: >-
            If true, the user is retired and should have no rights, not appear
            in lists, etc.
          type: boolean
        EjUserId:
          format: int32
          description: >-
            ID of the ej user record corresponding to this associate; 0 for
            associates that are not ej users
          type: integer
        UserName:
          description: User name
          type: string
        ExtraFields:
          description: "Deprecated: Use {SuperOffice.CRM.Services.Associate.CustomFields} instead.\r\nExtra fields added to the carrier. This could be data from Plug-ins, the foreign key system, external applications, etc."
          type: object
          additionalProperties:
            type: string
        CustomFields:
          description: "Udef + Extra fields added to the carrier. Extra fields as defined by changes to database schema + user-defined fields as defined by admin.\r\nCustom fields combines user defined fields and extra fields into one bucket. \r\nThe individual {SuperOffice.CRM.Services.Associate.ExtraFields} and <see cref=\"!:UserDefinedFields\">UserDefinedFields</see> properties are deprecated in favor of this\r\ncombined collection."
          type: object
          additionalProperties:
            type: string
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Services.Contact:
      description: "Carrier object for Contact.\r\nServices for the Contact Carrier is available from the <see cref=\"T:SuperOffice.CRM.Services.IContactAgent\">Contact Agent</see>."
      type: object
      properties:
        ContactId:
          format: int32
          description: Primary key
          type: integer
        Name:
          description: Contact name
          type: string
        OrgNr:
          description: VAT number or similar
          type: string
        Department:
          description: Department
          type: string
        URL:
          description: The internet address to this contact
          type: string
        City:
          description: City corresponding to zip code
          type: string
        DirectPhone:
          description: The contacts phone
          type: string
        AssociateId:
          format: int32
          description: Our contact
          type: integer
        CountryId:
          format: int32
          description: Country
          type: integer
        EmailAddress:
          description: The contact email address
          type: string
        Kananame:
          description: Contact kana name, used in Japanese versions only
          type: string
        EmailAddressName:
          description: Visible field
          type: string
        URLName:
          description: Visible field
          type: string
        AssociateFullName:
          description: >-
            The associate's culture formatted fullname (firstname, middleName
            and lastname)
          type: string
        BusinessName:
          description: The business list item name
          type: string
        CategoryName:
          description: The category list item name
          type: string
        CountryName:
          description: Name of country in installed language
          type: string
        Address:
          $ref: '#/components/schemas/SuperOffice.CRM.Services.Address'
        FormattedAddress:
          description: >-
            The contact's address, formatted with linebreaks and spaces into a
            single string.
          type: string
        FullName:
          description: ''
          type: string
        IsOwnerContact:
          description: >-
            Is the contact an owner contact.  This means that all persons on
            this contact can on only be internal users and not external users.
          type: boolean
        ActiveErpLinks:
          format: int32
          description: The number of active erp links
          type: integer
        Number1:
          description: Alphanumeric user field
          type: string
        Number2:
          description: Alphanumeric user field
          type: string
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Services.UserGroup:
      description: "The main user group that this user belongs to\r\n<para />\r\nCarrier object for UserGroup.\r\nServices for the UserGroup Carrier is available from the <see cref=\"T:SuperOffice.CRM.Services.IUserAgent\">User Agent</see>."
      type: object
      properties:
        Value:
          description: UserGroup name
          type: string
        Tooltip:
          description: Tooltip or other description
          type: string
        Id:
          format: int32
          description: Primary key
          type: integer
        Rank:
          format: int32
          description: Rank order
          type: integer
        Deleted:
          description: >-
            Deleted equal to true means that this is a user group that no longer
            can be selected by the user.  It is not permitted to delete a
            UserGroup.
          type: boolean
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Services.Currency:
      description: "Carrier object for Currency.\r\nServices for the Currency Carrier is available from the <see cref=\"T:SuperOffice.CRM.Services.IListAgent\">List Agent</see>."
      type: object
      properties:
        Id:
          format: int32
          description: The List Item Id
          type: integer
        Value:
          description: The List Item Value
          type: string
        Tooltip:
          description: The List Item Tooltip
          type: string
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Security.FieldRight:
      description: "Wraps the field right together with an explanatory reason.\r\nAlso adds logical operators to the field rights so that they can be easily combined."
      type: object
      properties:
        Mask:
          type: string
        Reason:
          type: string
    SuperOffice.CRM.Services.Address:
      description: "Street and/or Postal address, in both formatted and structured forms. You only need to modify one of the two for the change to be registered.\r\n<para />\r\nCarrier object for Address."
      type: object
      properties:
        Wgs84Latitude:
          format: double
          description: >-
            Latitude (that's north/south), decimal degrees, relative to WGS 84
            ellipsoid. SuperOffice ASA is at 59.91892. This value needs no
            further grid reference or other qualifying information.
          type: number
        Wgs84Longitude:
          format: double
          description: >-
            Longitude (that's East/west), decimal degrees, relative to WGS 84
            ellipsoid. SuperOffice ASA is at 10.73159. This value needs no
            further grid reference or other qualifying information.
          type: number
        LocalizedAddress:
          description: >-
            LocalizedFieldArray is a list of LocalizedFieldList objects. Used to
            store localized information such as formatted address data.
          type: array
          items:
            type: array
            items:
              $ref: '#/components/schemas/SuperOffice.CRM.Services.LocalizedField'
        Street:
          $ref: '#/components/schemas/SuperOffice.CRM.Services.StructuredAddress'
        Postal:
          $ref: '#/components/schemas/SuperOffice.CRM.Services.StructuredAddress'
        Formatted:
          description: >-
            Read-only formatted address multi-line string. Combines street and
            postal into one string. e.g.: <c>"Postboks 123,\nBrugata 123,\n1234
            OSLO\n"</c> or <c>"Postbox 123,\nBridgelane 123,\nWest
            Tooting,\nEast Shire ES2 W31\n"</c>.
          type: string
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Services.LocalizedField:
      description: "LocalizedField is used to store localized information such as formatted address data, a formatted phone number, etc.\r\n<para />\r\nCarrier object for LocalizedField."
      type: object
      properties:
        Name:
          description: Name of the value field
          type: string
        Value:
          description: The field's value
          type: string
        Tooltip:
          description: The tooltip
          type: string
        Label:
          description: The label of the field
          type: string
        ValueLength:
          format: int32
          description: Database length of the value
          type: integer
        AddressType:
          description: ''
          type: string
        TableRight:
          $ref: '#/components/schemas/SuperOffice.CRM.Security.TableRight'
        FieldProperties:
          description: >-
            Field property dictionary mapping field names to field access
            rights.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/SuperOffice.CRM.Security.FieldProperty'
    SuperOffice.CRM.Services.StructuredAddress:
      description: "Address with structured fields (Address1, City, Zip) - does not vary its layout by country, unliked the formatted address.\r\n<para />\r\nCarrier object for StructuredAddress."
      type: object
      properties:
        AtypeIdx:
          description: >-
            Bit mask, combines address type (EAddressType) and owner type
            (EOwnerType)
          enum:
            - Unknown
            - ContactPostalAddress
            - ContactStreetAddress
            - PersonPrivateAddress
            - QuoteBillingAddress
            - QuoteShippingAddress
          type: string
        Address1:
          description: Address line 1
          type: string
        Address2:
          description: Address line 2
          type: string
        Address3:
          description: Address line 3
          type: string
        City:
          description: City corresponding to zip code
          type: string
        County:
          description: County (not country)
          type: string
        State:
          description: State
          type: string
        Zipcode:
          description: Zip code, alphanumeric
          type: string
        Formatted:
          description: >-
            Read-only formatted address multi-line string. e.g.: <c>"Brugata
            123,\n1234 OSLO\n"</c> or <c>"Bridgelane 123,\nWest Tooting,\nThe
            Shire ES2 W31\n"</c>.
          type: string

````

## Related topics

- [SuperOffice.WebApi.Agents.TargetsAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.TargetsAgent.md)
- [SuperOffice.WebApi.Agents.ITargetsAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ITargetsAgent.md)
- [Save Target Dimension](/en/api/reference/restful/agent/targets_agent/save-target-dimension.md)
- [Delete Target Group](/en/api/reference/restful/agent/targets_agent/delete-target-group.md)
- [target_group table](/en/database/tables/target-group.md)
- [Get Target Group](/en/api/reference/restful/agent/targets_agent/get-target-group.md)
