Skip to content

REST API: CRM Contacts ​

← All modules

5 endpoints.

GET /api/v1/rest/contacts ​

List contacts

Parameters

NameInRequiredTypeDescription
pagequerynointeger
per_pagequerynointeger
searchqueryno
created_sincequeryno
updated_sincequeryno
sortqueryno

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response List Contacts Api V1 Rest Contacts Get"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/rest/contacts ​

Create a contact

Request body

json
{
  "properties": {
    "full_name": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Full Name"
    },
    "email": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 320
        },
        {
          "type": "null"
        }
      ],
      "title": "Email"
    },
    "phone": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64
        },
        {
          "type": "null"
        }
      ],
      "title": "Phone"
    },
    "company": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Company"
    }
  },
  "type": "object",
  "title": "ContactIn"
}

201 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Create Contact Api V1 Rest Contacts Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

Find contacts by email or phone

Exact email (case-insensitive) or phone. Phone matches the stored canonical spelling (app.utils.phone.canonical_phone, what every CRM write stores) or, failing that, the last nine digits — so +27 82 … and 082 … find the same person.

Parameters

NameInRequiredTypeDescription
emailqueryno
phonequeryno

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Search Contacts Api V1 Rest Contacts Search Get"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/rest/contacts/{contact_id} ​

Get a contact

Parameters

NameInRequiredTypeDescription
contact_idpathyesstring

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Get Contact Api V1 Rest Contacts  Contact Id  Get"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

PATCH /api/v1/rest/contacts/{contact_id} ​

Update a contact

Parameters

NameInRequiredTypeDescription
contact_idpathyesstring

Request body

json
{
  "properties": {
    "full_name": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Full Name"
    },
    "email": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 320
        },
        {
          "type": "null"
        }
      ],
      "title": "Email"
    },
    "phone": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64
        },
        {
          "type": "null"
        }
      ],
      "title": "Phone"
    },
    "company": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Company"
    }
  },
  "type": "object",
  "title": "ContactIn"
}

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Update Contact Api V1 Rest Contacts  Contact Id  Patch"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

Lubb One Documentation