Create a customer

POST /customers

Create a new customer record for a company or a person, and get the newly created customer in return.

For a new company customer, define "name" property and set "isCompany" flag to true in the request body. For a new private person customer, define "firstName" and "lastName" under the "person" property, and set "isCompany" flag to false in the request body. These are the minimum required properties that should be defined in the request body for creating a new customer.

All other properties for a customer (see response attributes for each property description) can also be defined in the request body, except for "person" when a new customer is a company, and "organizationNumber" and "name" (this one is generated from "firstName" and "lastName" under the "person" property) when a new customer is a person.

Headers

application/json

Body object Required

One of:

Responses

  • 201 application/json

    Created

    Hide headers attributes Show headers attributes
    Hide response attributes Show response attributes object
    • id integer(int32)

      A unique identifier for the customer within 24SevenOffice CRM. This ID is used for reference and linking transactions to specific customers.

    • name string | null

      A human-readable name or label for a customer, making it easily identifiable to users.

    • person object

      The first and the last name of a customer if the customer is a person.

      Hide person attributes Show person attributes object
      • firstName string | null

        The first name of a person if the customer is a person.

      • lastName string | null

        The last name of a person if the customer is a person.

    • isCompany boolean

      A flag variable indicating whether the customer is a company (true) or a person (false).

    • isSupplier boolean

      A flag variable indicating whether the customer is also a supplier (true) or not (false).

    • organizationNumber string | null

      The organization number issued by authorities, like a VAT number, of the customer if the customer is a company.

    • address object

      Addresses for the customer.

      Hide address attributes Show address attributes object
      • visit object

        The visiting address of the customer.

        Hide visit attributes Show visit attributes object
        • countryCode string | null

          The two-letter country code for the address, as in ISO 3166-1 alpha-2 standard.

          Maximum length is 2.

        • street string | null

          The street for the address. Can contain a street name, building and apartment number, a PO box number, or similar.

        • postalCode string | null

          The postal code for the address.

        • postalArea string | null

          The postal area for the address.

        • countrySubdivision string | null

          The geographical subdivision for the address, like a county ("fylke" in Norway) or a state.

      • postal object

        The postal address of the customer.

        Hide postal attributes Show postal attributes object
        • street string | null

          The street for the address. Can contain a street name, building and apartment number, a PO box number, or similar.

        • postalCode string | null

          The postal code for the address.

        • postalArea string | null

          The postal area for the address.

        • countrySubdivision string | null

          The geographical subdivision for the address, like a county ("fylke" in Norway) or a state.

      • billing object

        The billing address of the customer.

        Hide billing attributes Show billing attributes object
        • name string | null

          The name for the address.

        • countryCode string | null

          The two-letter country code for the address, as in ISO 3166-1 alpha-2 standard.

          Maximum length is 2.

        • street string | null

          The street for the address. Can contain a street name, building and apartment number, a PO box number, or similar.

        • postalCode string | null

          The postal code for the address.

        • postalArea string | null

          The postal area for the address.

        • countrySubdivision string | null

          The geographical subdivision for the address, like a county ("fylke" in Norway) or a state.

      • delivery object

        The delivery address of the customer.

        Hide delivery attributes Show delivery attributes object
        • name string | null

          The name for the address.

        • countryCode string | null

          The two-letter country code for the address, as in ISO 3166-1 alpha-2 standard.

          Maximum length is 2.

        • street string | null

          The street for the address. Can contain a street name, building and apartment number, a PO box number, or similar.

        • postalCode string | null

          The postal code for the address.

        • postalArea string | null

          The postal area for the address.

        • countrySubdivision string | null

          The geographical subdivision for the address, like a county ("fylke" in Norway) or a state.

    • email object

      Email addresses for the customer.

      Hide email attributes Show email attributes object
      • contact string | null

        The email address for contacting the customer.

      • billing string | null

        The billing email address for the customer.

    • phone string | null

      A phone number for contacting the customer.

    • A timestamp for when a record was created, in ISO 8601 format.

    • A timestamp for when one of the properties of a record was last modified, in ISO 8601 format.

  • Unauthorized. Missing or invalid bearer token.

    Hide headers attributes Show headers attributes
POST /customers
curl \
 -X POST https://rest.api.24sevenoffice.com/v1/customers \
 -H "Content-Type: application/json" \
 -H "Authorization: string" \
 -d '["\u003c!-- A payload example for when a new customer is a company --\u003e",{"id":123,"name":"ABC Corporation","email":{"billing":"billing@example.com","contact":"contact@example.com"},"phone":"+47-12345678","address":{"visit":{"street":"Hovedgata 1","postalArea":"Fornebu","postalCode":"0123","countryCode":"NO","countrySubdivision":"Viken"}},"isCompany":true,"isSupplier":false,"organizationNumber":"123456789"},"\u003c!-- A payload example for when a new customer is a private person --\u003e",{"id":321,"email":{"billing":"billing@example.com","contact":"contact@example.com"},"phone":"+47-87654321","person":{"lastName":"Doe","firstName":"John"},"address":{"visit":{"street":"Hovedgata 2","postalArea":"Fornebu","postalCode":"0123","countryCode":"NO","countrySubdivision":"Viken"}},"isCompany":false,"isSupplier":false}]'
Request example
[
  "<!-- A payload example for when a new customer is a company -->",
  {
    "id": 123,
    "name": "ABC Corporation",
    "email": {
      "billing": "billing@example.com",
      "contact": "contact@example.com"
    },
    "phone": "+47-12345678",
    "address": {
      "visit": {
        "street": "Hovedgata 1",
        "postalArea": "Fornebu",
        "postalCode": "0123",
        "countryCode": "NO",
        "countrySubdivision": "Viken"
      }
    },
    "isCompany": true,
    "isSupplier": false,
    "organizationNumber": "123456789"
  },
  "<!-- A payload example for when a new customer is a private person -->",
  {
    "id": 321,
    "email": {
      "billing": "billing@example.com",
      "contact": "contact@example.com"
    },
    "phone": "+47-87654321",
    "person": {
      "lastName": "Doe",
      "firstName": "John"
    },
    "address": {
      "visit": {
        "street": "Hovedgata 2",
        "postalArea": "Fornebu",
        "postalCode": "0123",
        "countryCode": "NO",
        "countrySubdivision": "Viken"
      }
    },
    "isCompany": false,
    "isSupplier": false
  }
]
Response examples (201)
# Headers
Access-Control-Allow-Origin: string
Access-Control-Allow-Credentials: string
X-Trace-Id: string

# Payload
{
  "id": 12345,
  "name": "ABC Corporation",
  "person": {
    "firstName": "John",
    "lastName": "Doe"
  },
  "isCompany": true,
  "isSupplier": false,
  "organizationNumber": "123456789",
  "address": {
    "visit": {
      "countryCode": "NO",
      "street": "Hovedgata 1",
      "postalCode": "0123",
      "postalArea": "Fornebu",
      "countrySubdivision": "Viken"
    },
    "postal": {
      "street": "Hovedgata 1",
      "postalCode": "0123",
      "postalArea": "Fornebu",
      "countrySubdivision": "Viken"
    },
    "billing": {
      "name": "ABC Corporation",
      "countryCode": "NO",
      "street": "Hovedgata 1",
      "postalCode": "0123",
      "postalArea": "Fornebu",
      "countrySubdivision": "Viken"
    },
    "delivery": {
      "name": "ABC Corporation",
      "countryCode": "NO",
      "street": "Hovedgata 1",
      "postalCode": "0123",
      "postalArea": "Fornebu",
      "countrySubdivision": "Viken"
    }
  },
  "email": {
    "contact": "contact@example.com",
    "billing": "billing@example.com"
  },
  "phone": "+47-12345678",
  "createdAt": "2022-01-01 18:00:00.000Z",
  "modifiedAt": "2023-12-31 18:00:00.000Z"
}