Salesly API
API Reference

Create an opportunity

POST
/opportunities

Authorization

x-api-key<token>

Your tenant API key

In: header

Request Body

application/jsonRequired
enterprise_identifier
Required
string

Contact ID, name, email, or CIF

user_email
Required
string
Format: "email"
namestring
stateobject
close_datestring
Format: "date"
campaign_idinteger
extra_fieldsobject
commentstring
productsarray<object>
curl -X POST "https://rest.salesly.app/api/v1/developers/opportunities" \
  -H "x-api-key: <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "enterprise_identifier": "string",
    "user_email": "[email protected]",
    "name": "string",
    "state": {
      "state": 0,
      "amount": 0
    },
    "close_date": "2019-08-24",
    "campaign_id": 0,
    "extra_fields": {},
    "comment": "string",
    "products": [
      {
        "reference": "string",
        "rate_sku": "string",
        "cost": 0,
        "price": 0,
        "discount": 100,
        "quantity": 0,
        "comment": "string",
        "description": "string"
      }
    ]
  }'

Opportunity created

{
  "data": {
    "id": 0,
    "name": "string",
    "enterprise_id": 0,
    "user_id": 0,
    "campaign_id": 0,
    "expected_sale_date": "2019-08-24T14:15:22Z",
    "close_date": "2019-08-24T14:15:22Z",
    "extra_fields": {},
    "states": [
      {
        "id": 0,
        "state": 0,
        "amount": 0.1,
        "created_at": "2019-08-24T14:15:22Z"
      }
    ],
    "products": [
      {
        "id": 0,
        "reference": "string",
        "name": "string",
        "pivot": {
          "cost": 0,
          "price": 0,
          "discount": 0,
          "quantity": 0,
          "comment": "string"
        }
      }
    ],
    "comments": [
      {
        "id": 0,
        "comment": "string",
        "user_id": 0,
        "created_at": "2019-08-24T14:15:22Z"
      }
    ],
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z"
  }
}