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

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.dintero.com/feedback

```json
{
  "path": "/api-reference/users/create-new-customer",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Create new Customer

> Create a new customer, `customer_id`, `email` and `phone_number` must
be unique if specified.
scopes:
- admin:customers
- write:customers
- create:customers:/users




## OpenAPI

````yaml /mintlify-docs/openapi/spec-customers.yaml post /accounts/{aid}/customers/users
openapi: 3.0.0
info:
  title: Customers API
  description: >
    API for managing customers


    # Changelog

    All notable changes to the API.


    ## 2026-02-13


    > **new**: Add endpoint for searching organization subunits (branches).

    > Extended organization search to include `underenheter` (subunits)
    information in the response.

    > Currently supports Norway (`no`) organization lookups.

    > - [GET
    /search/external/organizations/{country}/{organization_number}/subunits](#operation/aid_get_external_organization_subunits)

    > - [GET
    /search/external/organizations/{country}/{organization_number}](#operation/aid_get_external_organizations)


    ## 2025-07-01


    > **new**: Extend `marketing_consent` for customer user to support custom
    consents

    > - [POST /customers/users](#operation/aid_customers_post)


    ## 2024-09-01


    > **new**: Make country parameter dynamic and add support for Denmark.

    > - [GET /search/external/organizations/no (renamed to GET
    /search/external/organizations/{country})](#operation/aid_search_external_organizations_country)


    ## 2024-03-01


    > **doc**: Improve description for customer `enrolled_by` type, add

    > examples

    > - [POST /customers/users](#operation/aid_customers_post)


    ## 2023-10-01


    > **new**: Support new customer type `contact`. A user contact can be

    > linked with users and a search matching a contact will match its

    > linked users


    > - [POST /customers/users](#operation/aid_customers_post)

    > - [PUT /customers/users/{customer_id}](#operation/aid_customers_cid_put)

    > - [GET
    /v1/accounts/{aid}/customers/users?type=contact](#operation/aid_customers_get)


    ## 2023-09-01


    > **new**: Add endpoint for validating a given address and returning close
    matching alternatives if found.

    > - [POST
    /v1/accounts/{aid}/search/external/address/{country}/validate](#operation/aid_search_external_validate_address)


    ## 2020-12-01

    > Add endpoint for getting multiple addresses for given organization number.

    > - [GET
    /search/external/organizations/{country}/{organization_number}](#operation/aid_get_external_organizations)


    ## 2021-10-01


    > Support multiple users sharing the same `phone_number`. Use the

    new `users.phone_number_validation.allow_duplicates` option to control

    the unique phone_number constraint on users


    > - [PUT
    /customers/settings](http://localhost:8080/#operation/aid_customers_atributes_put)


    ## 2021-03-01


    > Support new [customer](customer) type `other`.

    > - [POST /customers/users](#operation/aid_customers_post)

    > - [PUT /customers/users/{customer_id}](#operation/aid_customers_cid_put)


    ## 2021-02-01


    > Extend customer `enrolled_by.type` to allow any string value, not just
    `url`,

    > `store` and `custom`.

    >

    > - [POST /v1/accounts/{aid}/customers/users](#operation/aid_customers_post)

    > - [PUT
    /v1/accounts/{aid}/customers/users/{customer_id}](#operation/aid_customers_cid_put)


    > Add support for removing customer terms and `include_deleted` when getting

    > list of all terms.

    >

    > - [DELETE
    /v1/accounts/{aid}/customers/terms/{tid}](#operation/aid_customers_terms_tid_delete)

    > - [GET
    /v1/accounts/{aid}/customers/terms/{tid}](#operation/aid_customers_terms_get)


    ## 2021-01-01


    > Add support for limited access to customer

    > details with `user:customers:/customer/details`

    > - [GET
    /v1/accounts/{aid}/customers/users/{customer_id}](#operation/aid_customers_cid_get)

    >

    > Add support for logging on without MFA even if configured with MFA

    > - [GET
    /v1/accounts/{aid}/customers/login](#operation/aid_customers_login_post)


    ## 2020-12-01


    > **new** Support filter users with `type` query parameter.

    > - [GET
    /v1/accounts/{aid}/customers/users?type=company](#operation/aid_customers_get)


    ## 2020-11-01


    > **new** Support filter user tokens with `include_deleted` query parameter.

    > - [GET
        /v1/accounts/{aid}/customers/users/{cid}/tokens?include_deleted=false](#operation/aid_customers_cid_tokens_get)

    > **new** Support filter and search on sales locations

    > - [GET /v1/accounts/{aid}/locations](#operation/aid_locations_get)


    > **new** Extend SalesLocation with `address.latitude`, `address.longitude`,

    > `chain`, `mcc`, `gln` and `franchise`. The `account_id` will be included

    > in any SalesLocation responses.

    > - [GET /v1/accounts/{aid}/locations](#operation/aid_locations_get)


    ## 2020-05-01


    > Add setting for require verification when updating user phone_number.
    Prevent

    > all update of user phone_number without completing a verification via SMS.

    > - [PUT
    /customers/settings](http://localhost:8080/#operation/aid_customers_atributes_put)


    ## 2020-04-01

    > Adds proxy to enhetsregisteret.

    > - [GET
    /search/external/organizations/no/?name=dintero](#operation/aid_search_external_organizations_no)


    ## 2020-03-10


    > Add support for `attributes_keys` and `attributes_values` query

    > parameters for filtering customer users

    > - [GET
    /customers/users?attributes_keys=key&attributes_values=value](#operation/aid_customers_get)


    ## 2020-02-28


    > Add support for enabling automatic tokens when phone numbers or emails
    change

    > -  [PUT /customers/settings]((#operation/aid_customers_atributes_put)


    ## 2019-09-31


    > Extends settings with support for configuring

    > users `customer_id_format`.

    > - [PUT /customers/settings](#operation/aid_customers_atributes_put)


    > Extends the TokenEvent definition with `expires_at

    > read only property.


    > Extends settings with support for configuring

    > token events expiry

    > - [PUT /customers/settings](#operation/aid_customers_atributes_put)


    ## 2019-07-31


    > Extend user Address, add support for  `latitude`,

    > `longitude` and `comment` properties.

    > - [POST /customers/users](#operation/aid_customers_post)

    > - [PUT /customers/users/{customer_id}](#operation/aid_customers_cid_put)


    ## 2019-07-31


    > Add new endpoint for deleting a tag

    > - [DELETE
    /customers/tags/{tag_id}](#operation/aid_customers_tags_tid_delete)


    ## 2019-06-31


    > The scope required for accessing endpoint has changed,

    > we will continue to support the old scopes but they was removed from

    > the documentation


    ## 2019-05-31


    > Make type and company property optional when updating

    > a customer user

    > - [PUT /customers/users/{customer_id}](#operation/aid_customers_cid_put)


    ## 2019-01-31


    > Support new customer type `employee`.

    > - [POST /customers/users](#operation/aid_customers_post)

    > - [PUT /customers/users/{customer_id}](#operation/aid_customers_cid_put)


    ## 2018-06-04


    > Adding tokens to deleted customers will

    > now fail with BAD_REQUEST.

    > - [POST
    /customers/users/{customer_id}/tokens](#operation/aid_customers_cid_tokens_post)


    > Duplication control of `customer.email` is now

    >  case insensitive. email case will be ignore on Search and login.


    > Add support for query parameter

    > `total` on GET user/token lists. Includes a `total-count`

    > header in the response when enabled..

    > - [GET
    /customers/users/{customer_id}/tokens](#operation/aid_customers_cid_tokens_get)


    ## 2018-04-11


    > Add support for `delete_token_events` parameter when

    > creating

    > - [POST
    /customers/users/{customer_id}/tokens](#operation/aid_customers_cid_tokens_post)


    > Add support for filtering token events by `since_datetime`.

    > - [GET
    /customers/tokens/events](#operation/aid_customers_tokens_events_get)


    > Delete customer and all tokens owed by the customer in one

    > request when using `delete_tokens` query parameter.

    > - [DELETE
    /customers/users/{customer_id}](#operation/aid_customers_cid_delete)


    > Token event status. The status in response will now be set

    > to `customer.status` if a customer with status is included

    > in the response.

    > - [POST
    /customers/tokens/events](#operation/aid_customers_tokens_events_post)


    ## 2018-02-15


    > Add minimum length for token token_id/type/value

    > - [POST
    /customers/tokens/events](#operation/aid_customers_tokens_events_post)

    > - [DELETE
    /customers/tokens/events](#operation/aid_customers_tokens_events_delete)

    > - [POST
    /customers/users/uid/tokens](#operation/aid_customers_cid_tokens_post)


    > Add endpoint for GET/DELETE token events

    > - [DELETE
    /customers/tokens/events](#operation/aid_customers_tokens_events_delete)

    > - [GET
    /customers/tokens/events](#operation/aid_customers_tokens_events_get)


    ## 2018-02-02


    > Add `type` property to the customer.

    > Support multiple customer types, add support for Company type for

    > additional properties


    > Move endpoints for retrieving/updating token (events),

    > use one endpoint for both retrieving and updating details about a token

    > - [POST
    /customers/tokens/events](#operation/aid_customers_tokens_events_post)
  contact:
    name: API Integration Support
    email: integration@dintero.com
  version: LATEST
  license:
    name: UNLICENSED
    url: https://dintero.com
servers:
  - url: https://api.dintero.com/v1
security:
  - JWT: []
paths:
  /accounts/{aid}/customers/users:
    post:
      tags:
        - users
      summary: Create new Customer
      description: |
        Create a new customer, `customer_id`, `email` and `phone_number` must
        be unique if specified.
        scopes:
        - admin:customers
        - write:customers
        - create:customers:/users
      operationId: aid_customers_post
      parameters:
        - $ref: '#/components/parameters/accountId'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              allOf:
                - $ref: '#/components/schemas/Customer'
                - properties:
                    customer_id:
                      type: string
                      maxLength: 255
                      description: |
                        The customer id you have defined for the customer.
                        (must not have trailing or leading spaces)
                        An auto-generated customer_id will be created if no
                        customer_id is provided.
                    password:
                      type: string
                      minLength: 8
                      maxLength: 255
                      description: >
                        The customer password. The caller must have scope

                        `write:accounts:/auth/users` when password is included
                        in the body
                    pin:
                      type: string
                      minLength: 6
                      maxLength: 6
                      pattern: ^\d{6}$
                      description: >
                        6 digit customer pin, can only used for MFA login. The
                        caller must have scope

                        `write:accounts:/auth/users` when pin is included in the
                        body
        description: customer to create
        required: true
      responses:
        '200':
          description: Customer created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerResponse'
        '400':
          description: |
            Bad request - missing required fields or
            duplicate field detected
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/AccessForbidden'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - JWT: []
components:
  parameters:
    accountId:
      name: aid
      description: |
        An id that uniquely identifies the account.
      in: path
      required: true
      schema:
        type: string
        format: ^[PT]{1}\d{8}$
        minLength: 9
        maxLength: 9
  schemas:
    Customer:
      type: object
      allOf:
        - $ref: '#/components/schemas/CustomerData'
        - $ref: '#/components/schemas/Entity'
        - $ref: '#/components/schemas/BasicUser'
        - required:
            - type
          properties:
            type:
              type: string
              enum:
                - customer
                - company
                - contact
                - employee
                - other
              default: customer
    CustomerResponse:
      allOf:
        - $ref: '#/components/schemas/Customer'
        - required:
            - customer_id
          properties:
            customer_id:
              type: string
              maxLength: 255
              description: |
                The customer id you have defined for the customer.
                (must not have trailing or leading spaces)
                An auto-generated customer_id will be created if no
                customer_id is provided.
              readOnly: true
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            code:
              type: string
              description: The code used to identify the error/warning
            errors:
              type: array
              description: The nested error(s) encountered during validation
              items:
                type: object
            message:
              type: string
              description: The human readable description of the error/warning
    CustomerData:
      type: object
      allOf:
        - properties:
            metadata:
              type: object
              maxProperties: 40
              description: |
                A set of key/value pairs that you can attach to a
                customer object. It can be useful for storing additional
                information about the customer in a structured format.
                You can unset an individual key by setting its value to
                null and then saving. To clear all keys, set metadata to null
              example:
                dob_year: 1985
    Entity:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: |
            An UUID that uniquely identifies the resource
          readOnly: true
        created_at:
          type: string
          format: date-time
          description: |
            The date-time when the resource was created
          readOnly: true
        created_by:
          type: string
          example: 1c92f7e1-2897-4d46-bdcc-c127a914fb4e
          description: |
            The ID of the user/client created the resource
          readOnly: true
        updated_at:
          type: string
          format: date-time
          description: |
            The date-time when the resource was last updated
          readOnly: true
        deleted_by:
          type: string
          example: 1c92f7e1-2897-4d46-bdcc-c127a914fb4e
          description: |
            The ID of the user/client created the resource
          readOnly: true
        deleted_at:
          type: string
          format: date-time
          readOnly: true
    BasicUser:
      type: object
      properties:
        first_name:
          example: John
          nullable: true
          type: string
        last_name:
          example: Doe
          nullable: true
          type: string
        email:
          description: |
            customer email,
            case insensitive duplication control prevents
            multiple user with same `type` to have equal email

            customer@example.com is equal to CUStOMer@EXAMPLE.com
          example: customer@example.com
          nullable: true
          type: string
        phone_number:
          description: |
            A phone number in E.164 number formatting.
          format: ^\+?[1-9]\d{1,14}$
          example: '+4799999999'
          nullable: true
          type: string
        attributes:
          type: object
          description: |
            Custom attributes
        status:
          description: Status of the customer
          nullable: true
          type: string
        favorite_store:
          description: customer favorite store
          nullable: true
          type: string
        enrolled_by:
          type: object
          required:
            - value
          description: The source that recruited the customer
          properties:
            type:
              type: string
              description: |
                Enrollment type, e.g. `url`, `store`, `qr_code`, any string
              example: url
            value:
              example: https://facebook.com
              nullable: true
              type: string
        marketing_consent:
          type: object
          description: Customers consent for marketing in different channels
          maxProperties: 10
          properties:
            sms:
              $ref: '#/components/schemas/UserConsent'
            email:
              $ref: '#/components/schemas/UserConsent'
          additionalProperties:
            $ref: '#/components/schemas/UserConsent'
        type:
          type: string
          enum:
            - customer
            - company
            - contact
            - employee
            - other
          description: >
            Describe type of a user.


            - `company` property is required when using the type `company`

            - `company` property is only supported for users with type `other`
              or `company`
            - Creating or updating user with type `employee` or `other` requires
              `admin:customers` or `write:customers` scope.
            - User login is only available for users with type `customer` or
            `company`
          default: customer
        addresses:
          type: array
          items:
            $ref: '#/components/schemas/CustomerAddress'
        term:
          $ref: '#/components/schemas/CustomerTerm'
        company:
          type: object
          required:
            - bussiness_name
          description: |
            Company details, supported when type is Company
          properties:
            organization_number:
              type: string
              description: Companys identification number
              example: 123456789MVA
            bussiness_name:
              type: string
              example: TKP tech AS
            department:
              type: string
              description: companys department
              example: sales department
            industry:
              type: string
              example: computer industry
            website:
              type: string
            number_of_employees:
              type: string
        gender:
          example: male
          nullable: true
          type: string
        date_of_birth:
          format: date
          example: '1990-09-20'
          nullable: true
          type: string
        contact_for:
          type: array
          description: |
            The users that it is a contact for, supported when type is `contact`
          items:
            type: object
            required:
              - customer_id
            properties:
              customer_id:
                type: string
                description: |
                  The customer id that it is a contact for
    UserConsent:
      type: object
      properties:
        consent:
          type: boolean
          example: true
        updated_at:
          readOnly: true
          type: string
          format: date-time
          example: '2018-01-12T13:42:00Z'
          description: |
            The date-time when the resource was last updated:
    CustomerAddress:
      description: Customer's addresses
      allOf:
        - $ref: '#/components/schemas/Address'
        - properties:
            latitude:
              type: number
              example: 59.942112
            longitude:
              type: number
              example: 10.716991
            type:
              type: string
              description: The address type
              enum:
                - custom
                - home
                - other
                - work
            custom_type:
              type: string
              description: |
                If the address `type` is `custom`, this
                property contains the custom value
            comment:
              type: string
              description: |
                Comment about the address
              example: 5th floor, use doorbell.
    CustomerTerm:
      type: object
      properties:
        id:
          type: string
          format: uuid
        accepted_at:
          type: string
          format: date-time
          readOnly: true
    Address:
      type: object
      required:
        - address_line
        - postal_place
        - country
      properties:
        address_line:
          type: string
          example: Sommerkroveien 34
        address_line_2:
          type: string
          example: PB 123
        postal_code:
          type: string
          example: '0349'
        postal_place:
          type: string
          example: Oslo
        country:
          type: string
          format: iso-3166-1
          description: |
            ISO 3166-1 country code
          example: 'NO'
  responses:
    AccessForbidden:
      description: Access forbidden, invalid JWT token was used
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: Unexpected Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    JWT:
      type: http
      description: >
        Bearer authentication (token authentication) should be used for
        accessing the API.


        Use [Get
        Token](https://docs.dintero.com/api.html#operation/aid_auths_oauth_token_post)
        to get an access token for client credentials.

        Pass the token in the request header:

            Authorization: Bearer {access_token}

        where the **access_token** is JSON Web Tokens (JWT).
      scheme: bearer
      bearerFormat: JWT

````