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

# Create a customer or opportunity

> kind is contacts, companies or opportunities. Uses the same core-field rules, tenant access and record-type custom field validation as the CRM. customFields is a key/value object: patches merge only supplied keys and null clears a value. Get /fields for active keys, options and required rules. PATCH requires the current version. Fixed core columns cannot be reconfigured. Opportunities must be enabled. Dedicated crm.records scopes are required; lead and capture keys gain no access. List responses are paginated and include customFields plus labelled customFieldDisplay. Create/update returns id and version; read the record for normalized values. Request bodies use the contact, company or opportunity variant matching kind.

Scope: `crm.records.write`.



## OpenAPI

````yaml /openapi.json post /api/v1/crm/{kind}
openapi: 3.1.0
info:
  title: Marro API
  version: 1.0.0
  description: >-
    Server-to-server access to one organization’s data in Marro. Each key
    belongs to an organization and can use only the scopes it was given for
    modules the organization subscribes to. Keys go only in the Authorization
    header, over HTTPS, from a server: never in browser code or a URL. A key
    that was ever sent over plain HTTP or in a URL must be treated as leaked:
    revoke it and create a new one. The API sends no CORS headers.


    Every response carries `X-Request-Id`, to quote to support. Once the key is
    checked, responses also carry `RateLimit-Limit`, `RateLimit-Remaining` and
    `RateLimit-Reset` (seconds until the window resets) for whichever limit is
    closer to running out. An address that is not an endpoint answers 404
    `NOT_FOUND` in the same error shape.
servers:
  - url: https://app.marro.si
security: []
tags:
  - name: Leads
    description: >-
      Record-link custom fields accept numeric target ID arrays (one or up to 20
      according to recordLink.multiple). Reads resolve accessible targets to
      id/kind/name/href objects. Deleted, archived, disabled and inaccessible
      targets are omitted. Destinations require the corresponding leads.read or
      crm.records.read scope; user destinations have no public API scope. Object
      destinations use object:<id>, require objects.records.read and the key
      creator current object grants.
  - name: Customers
    description: >-
      Contacts, companies and enabled opportunities with record-type custom
      fields. Dedicated crm.records scopes are required.
  - name: Reference
    description: 'How this organization is set up: fields, stages, sources and people.'
  - name: Money
    description: >-
      Products, quotes, invoices and payments. Amounts are integers in the
      smallest currency unit (paise, cents); a new document is in the
      organization's own currency. Tax follows the organization's regional
      settings: under India GST an invoice carries CGST and SGST inside the
      organization's state, IGST outside it, and no GST without a supplier
      GSTIN; under a single-rate tax (Australia GST 10%, UK VAT) each taxed line
      carries that tax (singleTaxMinor), and none without the supplier's
      registration number. Each document keeps the tax it was issued under
      (tax.model).
  - name: Reports
    description: >-
      Custom reports shared with everyone in the organization, and their
      figures. Built in the app under Reports → Custom reports; a key reads them
      over every lead.
paths:
  /api/v1/crm/{kind}:
    post:
      tags:
        - Customers
      summary: Create a customer or opportunity
      description: >-
        kind is contacts, companies or opportunities. Uses the same core-field
        rules, tenant access and record-type custom field validation as the CRM.
        customFields is a key/value object: patches merge only supplied keys and
        null clears a value. Get /fields for active keys, options and required
        rules. PATCH requires the current version. Fixed core columns cannot be
        reconfigured. Opportunities must be enabled. Dedicated crm.records
        scopes are required; lead and capture keys gain no access. List
        responses are paginated and include customFields plus labelled
        customFieldDisplay. Create/update returns id and version; read the
        record for normalized values. Request bodies use the contact, company or
        opportunity variant matching kind.


        Scope: `crm.records.write`.
      operationId: create-record
      parameters:
        - name: kind
          in: path
          required: true
          description: contacts, companies or opportunities
          schema:
            type: integer
            minimum: 1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              anyOf:
                - type: object
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 200
                    email:
                      anyOf:
                        - type: string
                          maxLength: 320
                          format: email
                          pattern: >-
                            ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                        - type: 'null'
                    phone:
                      anyOf:
                        - type: string
                          maxLength: 40
                        - type: 'null'
                    customFields:
                      type: object
                      propertyNames:
                        type: string
                      additionalProperties: {}
                    accountId:
                      anyOf:
                        - type: integer
                          exclusiveMinimum: 0
                          maximum: 9007199254740991
                        - type: 'null'
                    ownerId:
                      type: integer
                      exclusiveMinimum: 0
                      maximum: 9007199254740991
                    notes:
                      anyOf:
                        - type: string
                          maxLength: 5000
                        - type: 'null'
                  required:
                    - name
                  additionalProperties: false
                - type: object
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 200
                    customFields:
                      type: object
                      propertyNames:
                        type: string
                      additionalProperties: {}
                    domain:
                      anyOf:
                        - type: string
                          maxLength: 253
                        - type: 'null'
                    email:
                      anyOf:
                        - type: string
                          maxLength: 320
                          format: email
                          pattern: >-
                            ^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                        - type: 'null'
                    phone:
                      anyOf:
                        - type: string
                          maxLength: 40
                        - type: 'null'
                    ownerId:
                      type: integer
                      exclusiveMinimum: 0
                      maximum: 9007199254740991
                    notes:
                      anyOf:
                        - type: string
                          maxLength: 5000
                        - type: 'null'
                  required:
                    - name
                  additionalProperties: false
                - type: object
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 200
                    customFields:
                      type: object
                      propertyNames:
                        type: string
                      additionalProperties: {}
                    contactId:
                      type: integer
                      exclusiveMinimum: 0
                      maximum: 9007199254740991
                    accountId:
                      anyOf:
                        - type: integer
                          exclusiveMinimum: 0
                          maximum: 9007199254740991
                        - type: 'null'
                    pipelineId:
                      type: integer
                      exclusiveMinimum: 0
                      maximum: 9007199254740991
                    stageId:
                      type: integer
                      exclusiveMinimum: 0
                      maximum: 9007199254740991
                    ownerId:
                      type: integer
                      exclusiveMinimum: 0
                      maximum: 9007199254740991
                    valueMinor:
                      type: integer
                      minimum: 0
                      maximum: 9000000000000
                    currency:
                      type: string
                      pattern: ^[A-Z]{3}$
                    expectedClose:
                      anyOf:
                        - type: string
                          pattern: ^\d{4}-\d{2}-\d{2}$
                        - type: 'null'
                    nextReviewOn:
                      anyOf:
                        - type: string
                          pattern: ^\d{4}-\d{2}-\d{2}$
                        - type: 'null'
                    lifecycle:
                      type: string
                      enum:
                        - sales
                        - onboarding
                        - delivery
                        - follow_up
                        - renewal
                        - complete
                    notes:
                      anyOf:
                        - type: string
                          maxLength: 5000
                        - type: 'null'
                  required:
                    - name
                    - contactId
                    - currency
                  additionalProperties: false
            example:
              name: Example company
              customFields: {}
      responses:
        '201':
          description: The requested records, fields, or saved ID and version.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  version:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                required:
                  - id
                  - version
                additionalProperties: false
              example:
                id: 1
                version: 1
        '400':
          description: 'INVALID_QUERY: Invalid pagination or search.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: 'UNAUTHORIZED: The key is missing, wrong, revoked or expired.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            FORBIDDEN: The key lacks the scope, or the organization’s plan does
            not include it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 'NOT_FOUND: Invalid kind or ID.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            RECORD_CONFLICT: A unique value or related record conflicts,
            opportunities are disabled (OPPORTUNITIES_DISABLED), or key owner
            was removed (KEY_OWNER_REMOVED).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            VALIDATION_FAILED: Invalid input; RECORD_REFUSED for scoped record
            access, version conflict or field validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            RATE_LIMITED: More than 600 requests in an hour with this key, or
            3000 with all of the organization’s keys together. `Retry-After`
            says how many seconds to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: >-
            INTERNAL: Something failed on our side. Retry; if it persists,
            contact support quoting the `X-Request-Id` response header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKey:
            - crm.records.write
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: >-
                Stable, machine-readable: UNAUTHORIZED, FORBIDDEN, NOT_FOUND,
                VALIDATION_FAILED, DUPLICATE_LEAD, RATE_LIMITED…
            message:
              type: string
              description: A sentence for people.
            details:
              description: >-
                For VALIDATION_FAILED, `fields` maps each field key to its
                problem.
              type: object
              propertyNames:
                type: string
              additionalProperties: {}
          required:
            - code
            - message
          additionalProperties: false
      required:
        - error
      additionalProperties: false
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      description: >-
        An organization API key, created in Settings → Integrations → API keys.
        Keys start with `mk_live_`. Marro stores only a hash of a key, so it is
        shown once, when it is created: copy it then. Revoking a key ends its
        access at once. To replace a key without downtime, create the new one,
        switch your server to it, then revoke the old one. Changes made with a
        key appear on the lead’s timeline as made by the person who created the
        key, via the API. Scopes: `objects.records.read` (Read custom objects),
        `objects.records.write` (Create and update custom-object records),
        `objects.records.delete` (Delete custom-object records), `leads.read`
        (Read leads), `leads.write` (Create and update leads), `leads.capture`
        (Capture leads), `crm.records.read` (Read customers and opportunities),
        `crm.records.write` (Create and update customers and opportunities),
        `reports.read` (Read reports), `money.read` (Read products, quotes,
        invoices and payments), `money.write` (Create quotes and invoices and
        record payments), `agent.tools` (AI agent tools (MCP)).
      x-scopes:
        objects.records.read:
          label: Read custom objects
          description: >-
            Read definitions and records within the key creator’s current
            per-object access.
          module: objects
        objects.records.write:
          label: Create and update custom-object records
          description: >-
            Create and edit within current per-object grants. Needs
            objects.records.read.
          module: objects
        objects.records.delete:
          label: Delete custom-object records
          description: >-
            Permanently delete with current object delete grant, version and
            exact title. Needs objects.records.read.
          module: objects
        leads.read:
          label: Read leads
          description: >-
            Leads with every field, and the lists that describe them: fields,
            stages, sources and people.
          module: leads
        leads.write:
          label: Create and update leads
          description: >-
            Create leads, change their fields, stage and owner, and add notes.
            Needs leads.read.
          module: leads
        leads.capture:
          label: Capture leads
          description: >-
            Capture leads from a website or form: add a lead or update the
            existing one with the same phone or email. Cannot read, list or
            change anything else.
          module: leads
        crm.records.read:
          label: Read customers and opportunities
          description: >-
            Read contacts, companies and enabled opportunities, including their
            custom fields.
          module: customers
        crm.records.write:
          label: Create and update customers and opportunities
          description: >-
            Create and update contacts, companies and enabled opportunities with
            validated custom fields. Needs crm.records.read.
          module: customers
        reports.read:
          label: Read reports
          description: >-
            List the custom reports shared with everyone in the organization and
            read their figures for any period.
          module: reports.custom
        money.read:
          label: Read products, quotes, invoices and payments
          description: >-
            Read the product catalogue, quotes and GST invoices with their lines
            and totals, and payments received.
          module: finance.quotes
        money.write:
          label: Create quotes and invoices and record payments
          description: >-
            Create quotes and invoices (as drafts, or issued with their number)
            and record payments against invoices. Needs money.read.
          module: finance.quotes
        agent.tools:
          label: AI agent tools (MCP)
          description: >-
            Connect another AI agent over MCP: find and read leads, see what
            your agents may do, and ask Marro's agent to act on a lead within
            your agents' permissions.
          module: ai.agents
      x-key-types:
        - name: Website form
          scopes:
            - leads.capture
          lifetimeDays: 730
          description: >-
            A website or landing-page form that sends enquiries in as leads. Can
            do nothing else.
        - name: Another application
          lifetimeDays: 90
          description: >-
            Any other integration. Choose the scopes it needs when you create
            it.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.