SendGrid · Capability

Twilio SendGrid Legacy Marketing Campaigns Contacts API — Segments

Twilio SendGrid Legacy Marketing Campaigns Contacts API — Segments. 6 operations. Lead operation: Create a Segment. Self-contained Naftiko capability covering one Sendgrid business surface.

Run with Naftiko SendgridSegments

What You Can Do

POST
Createsegment — Create a Segment
/v1/v3/contactdb/segments
GET
Listsegment — Retrieve all segments
/v1/v3/contactdb/segments
GET
Getsegment — Retrieve a segment
/v1/v3/contactdb/segments/{segment-id}
PATCH
Updatesegment — Update a segment
/v1/v3/contactdb/segments/{segment-id}
DELETE
Deletesegment — Delete a segment
/v1/v3/contactdb/segments/{segment-id}
GET
Listrecipientforsegment — Retrieve recipients on a segment
/v1/v3/contactdb/segments/{segment-id}/recipients

MCP Tools

create-segment

Create a Segment

retrieve-all-segments

Retrieve all segments

read-only idempotent
retrieve-segment

Retrieve a segment

read-only idempotent
update-segment

Update a segment

idempotent
delete-segment

Delete a segment

idempotent
retrieve-recipients-segment

Retrieve recipients on a segment

read-only idempotent

Capability Spec

tsg_lmc_contactdb_v3-segments.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Twilio SendGrid Legacy Marketing Campaigns Contacts API — Segments
  description: 'Twilio SendGrid Legacy Marketing Campaigns Contacts API — Segments. 6 operations. Lead operation: Create a
    Segment. Self-contained Naftiko capability covering one Sendgrid business surface.'
  tags:
  - Sendgrid
  - Segments
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    SENDGRID_API_KEY: SENDGRID_API_KEY
capability:
  consumes:
  - type: http
    namespace: tsg_lmc_contactdb_v3-segments
    baseUri: https://api.sendgrid.com
    description: Twilio SendGrid Legacy Marketing Campaigns Contacts API — Segments business capability. Self-contained, no
      shared references.
    resources:
    - name: v3-contactdb-segments
      path: /v3/contactdb/segments
      operations:
      - name: createsegment
        method: POST
        description: Create a Segment
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: false
      - name: listsegment
        method: GET
        description: Retrieve all segments
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: v3-contactdb-segments-segment_id
      path: /v3/contactdb/segments/{segment_id}
      operations:
      - name: getsegment
        method: GET
        description: Retrieve a segment
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: updatesegment
        method: PATCH
        description: Update a segment
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: false
      - name: deletesegment
        method: DELETE
        description: Delete a segment
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: delete_contacts
          in: query
          type: boolean
          description: True to delete all contacts matching the segment in addition to deleting the segment
    - name: v3-contactdb-segments-segment_id-recipients
      path: /v3/contactdb/segments/{segment_id}/recipients
      operations:
      - name: listrecipientforsegment
        method: GET
        description: Retrieve recipients on a segment
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: page
          in: query
          type: integer
        - name: page_size
          in: query
          type: integer
    authentication:
      type: bearer
      token: '{{env.SENDGRID_API_KEY}}'
  exposes:
  - type: rest
    namespace: tsg_lmc_contactdb_v3-segments-rest
    port: 8080
    description: REST adapter for Twilio SendGrid Legacy Marketing Campaigns Contacts API — Segments. One Spectral-compliant
      resource per consumed operation, prefixed with /v1.
    resources:
    - path: /v1/v3/contactdb/segments
      name: v3-contactdb-segments
      description: REST surface for v3-contactdb-segments.
      operations:
      - method: POST
        name: createsegment
        description: Create a Segment
        call: tsg_lmc_contactdb_v3-segments.createsegment
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
      - method: GET
        name: listsegment
        description: Retrieve all segments
        call: tsg_lmc_contactdb_v3-segments.listsegment
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v3/contactdb/segments/{segment-id}
      name: v3-contactdb-segments-segment-id
      description: REST surface for v3-contactdb-segments-segment_id.
      operations:
      - method: GET
        name: getsegment
        description: Retrieve a segment
        call: tsg_lmc_contactdb_v3-segments.getsegment
        outputParameters:
        - type: object
          mapping: $.
      - method: PATCH
        name: updatesegment
        description: Update a segment
        call: tsg_lmc_contactdb_v3-segments.updatesegment
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: deletesegment
        description: Delete a segment
        call: tsg_lmc_contactdb_v3-segments.deletesegment
        with:
          delete_contacts: rest.delete_contacts
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v3/contactdb/segments/{segment-id}/recipients
      name: v3-contactdb-segments-segment-id-recipients
      description: REST surface for v3-contactdb-segments-segment_id-recipients.
      operations:
      - method: GET
        name: listrecipientforsegment
        description: Retrieve recipients on a segment
        call: tsg_lmc_contactdb_v3-segments.listrecipientforsegment
        with:
          page: rest.page
          page_size: rest.page_size
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: tsg_lmc_contactdb_v3-segments-mcp
    port: 9090
    transport: http
    description: MCP adapter for Twilio SendGrid Legacy Marketing Campaigns Contacts API — Segments. One tool per consumed
      operation, routed inline through this capability's consumes block.
    tools:
    - name: create-segment
      description: Create a Segment
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: tsg_lmc_contactdb_v3-segments.createsegment
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: retrieve-all-segments
      description: Retrieve all segments
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: tsg_lmc_contactdb_v3-segments.listsegment
      outputParameters:
      - type: object
        mapping: $.
    - name: retrieve-segment
      description: Retrieve a segment
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: tsg_lmc_contactdb_v3-segments.getsegment
      outputParameters:
      - type: object
        mapping: $.
    - name: update-segment
      description: Update a segment
      hints:
        readOnly: false
        destructive: false
        idempotent: true
      call: tsg_lmc_contactdb_v3-segments.updatesegment
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: delete-segment
      description: Delete a segment
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: tsg_lmc_contactdb_v3-segments.deletesegment
      with:
        delete_contacts: tools.delete_contacts
      outputParameters:
      - type: object
        mapping: $.
    - name: retrieve-recipients-segment
      description: Retrieve recipients on a segment
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: tsg_lmc_contactdb_v3-segments.listrecipientforsegment
      with:
        page: tools.page
        page_size: tools.page_size
      outputParameters:
      - type: object
        mapping: $.