Create a Customer

POST

/v1/customers

Creates a customer with given attributes.


Attributes

name

The full name of the customer.

email

The email of the customer.

city Optional

The city of the customer.

region Optional

The region of the customer.

country Optional

The ISO 3166-1 two-letter country code for the customer (e.g. US, GB, etc).


Relationships

store

The store this customer belongs to.


curl -X "POST" "https://api.lemonsqueezy.com/v1/customers" \
  -H 'Accept: application/vnd.api+json' \
  -H 'Content-Type: application/vnd.api+json' \
  -H 'Authorization: Bearer {api_key}' \
  -d $'{
  "data": {
    "type": "customers",
    "attributes": {
      "name": "John Doe",
      "email": "[email protected]",
      "city": "New York",
      "region": "NY",
      "country": "US"
    },
    "relationships": {
      "store": {
        "data": {
          "type": "stores",
          "id": "1"
        }
      }
    }
  }
}'

Returns

Returns the created customer object.

{
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "https://api.lemonsqueezy.com/v1/customers/1"
  },
  "data": {
    "type": "customers",
    "id": "1",
    "attributes": {
      "store_id": 1,
      "name": "John Doe",
      "email": "[email protected]",
      "status": "subscribed",
      "city": "New York",
      "region": "NY",
      "country": "US",
      "total_revenue_currency": 0,
      "mrr": 0,
      "status_formatted": "Subscribed",
      "country_formatted": "United States",
      "total_revenue_currency_formatted": "0.00",
      "mrr_formatted": "$0.00",
      "urls": {
        "customer_portal": null
      },
      "created_at": "2022-12-01T13:01:07.000000Z",
      "updated_at": "2022-12-09T09:05:21.000000Z",
      "test_mode": false
    },
    "relationships": {
      "store": {
        "links": {
          "related": "https://api.lemonsqueezy.com/v1/customers/1/store",
          "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/store"
        }
      },
      "orders": {
        "links": {
          "related": "https://api.lemonsqueezy.com/v1/customers/1/orders",
          "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/orders"
        }
      },
      "subscriptions": {
        "links": {
          "related": "https://api.lemonsqueezy.com/v1/customers/1/subscriptions",
          "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/subscriptions"
        }
      },
      "license-keys": {
        "links": {
          "related": "https://api.lemonsqueezy.com/v1/customers/1/license-keys",
          "self": "https://api.lemonsqueezy.com/v1/customers/1/relationships/license-keys"
        }
      }
    },
    "links": {
      "self": "https://api.lemonsqueezy.com/v1/customers/1"
    }
  }
}

Was this page helpful?