Skip to content
Cirrus home
Sign in

Reference

GTT orders

Good-till-triggered orders the broker holds for you.

Read the guide first

List GTTs #

GET /v1/gtt scope read

Every GTT at the broker, per account (a live read, including GTTs made outside this API; source broker).

More about this

Brokers that place GTTs but cannot list them, or whose list read failed where that read is best-effort (Pocketful, whose list reply is undocumented), are listed from this API's own records instead (source api_records): the GTTs placed through this API and not deleted here, with a note saying why and that GTTs placed outside it are not visible. An account whose list cannot be read carries an error; the others are still listed. Brokers without GTTs carry error_code not_supported_by_broker.

Parameters

  • account query · string

    Only this account; every account when absent.

Errors

HTTPCodeWhen
400invalid_query

The query string does not fit the route's parameters.

401unauthorized

No credential, or the credential is invalid, expired or revoked.

403forbidden

The credential may not use this route (missing scope, app-session-only route, IP not allowed).

404account_not_found

No linked broker account with this id for the caller.

429rate_limited

Too many requests for this credential (or too many failed attempts); retry after the Retry-After header (seconds; error.retry_after_ms has the exact wait).

503service_unavailable

A dependency is temporarily unavailable, or the feature is off on this server; retry later.

All fields (request and response schema)

Loading fields…

GET
curl "https://cirrus.pocketful.in/v1/gtt" \
  -H "Authorization: token $CIRRUS_API_KEY"
Response · 200
{
  "status": "success",
  "data": [
    {
      "account": "U1",
      "broker": "upstox",
      "source": "broker",
      "gtts": [],
      "note": null,
      "error": "Listing GTTs is not available for upstox accounts.",
      "error_code": "not_supported_by_broker"
    }
  ],
  "error": null
}

Create a GTT #

POST /v1/gtt scope orders

Creates a GTT at the broker in one account: a stop-loss, a target, or both (whichever fires first cancels the other).

More about this

Legs are checked against the tick grid and the live price. Once the request is valid the answer is 200 with the broker's verdict in status.

Broker limits: Pocketful has no GTT on BFO (and CDS) or on intraday (MIS) products. These, and brokers without GTT at all, come back as rejected with error_code not_supported_by_broker (nothing was sent to the broker).

Body fields

  • account string required

    Account id (see /v1/accounts).

  • instrument_token string required

    Instrument id (see /v1/instruments).

  • side string required

    Side of the order a trigger places (SELL to protect a long).

    One of: BUY, SELL

  • product string required

    MIS (intraday), CARRYFORWARD (overnight derivatives, NRML), DELIVERY (equity delivery, CNC) or MTF (margin trading facility).

    One of: MIS, CARRYFORWARD, DELIVERY, MTF

  • quantity integer (int64) required

    Units, or lots when qty_is_in_lot. Units round down to whole lots; under one lot is refused.

  • qty_is_in_lot boolean

    quantity counts lots, not units.

  • stop_loss object | null

    One GTT leg: the price that fires it and the order's limit price.

  • target object | null

    One GTT leg: the price that fires it and the order's limit price.

Errors

HTTPCodeWhen
400malformed_json

The body is not JSON, or does not fit the request shape (unknown or missing fields, wrong types).

401unauthorized

No credential, or the credential is invalid, expired or revoked.

403forbidden

The credential may not use this route (missing scope, app-session-only route, IP not allowed).

404account_not_found

No linked broker account with this id for the caller.

422invalid_request

The request is well-formed but not valid; field names the input.

429rate_limited

Too many requests for this credential (or too many failed attempts); retry after the Retry-After header (seconds; error.retry_after_ms has the exact wait).

503service_unavailable

A dependency is temporarily unavailable, or the feature is off on this server; retry later.

All fields (request and response schema)

Loading fields…

POST
curl -X POST "https://cirrus.pocketful.in/v1/gtt" \
  -H "Authorization: token $CIRRUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "account": "PF1",
    "instrument_token": "CT:TEST:RELIANCE",
    "side": "SELL",
    "product": "DELIVERY",
    "quantity": 5,
    "stop_loss": {
      "trigger": 2400,
      "price": 2399
    }
  }'
Response · 200
{
  "status": "success",
  "data": {
    "account": "PF1",
    "trigger_id": "0f6c1a52-4d7e-4b8e-9d51-2c7a9e3b1f20",
    "status": "accepted",
    "message": null,
    "error_code": null
  },
  "error": null
}

Modify a GTT #

PATCH /v1/gtt/{trigger_id} scope orders

Replaces a GTT's legs and quantity at the broker: send the GTT as it should be now (same body and checks as creating).

More about this

Once the request is valid the answer is 200 with the broker's verdict in status.

Parameters

  • trigger_id path · string required

    The broker's GTT id (1-64 letters, digits, -, _ or .).

Body fields

  • account string required

    Account id (see /v1/accounts).

  • instrument_token string required

    Instrument id (see /v1/instruments).

  • side string required

    Side of the order a trigger places (SELL to protect a long).

    One of: BUY, SELL

  • product string required

    MIS (intraday), CARRYFORWARD (overnight derivatives, NRML), DELIVERY (equity delivery, CNC) or MTF (margin trading facility).

    One of: MIS, CARRYFORWARD, DELIVERY, MTF

  • quantity integer (int64) required

    Units, or lots when qty_is_in_lot. Units round down to whole lots; under one lot is refused.

  • qty_is_in_lot boolean

    quantity counts lots, not units.

  • stop_loss object | null

    One GTT leg: the price that fires it and the order's limit price.

  • target object | null

    One GTT leg: the price that fires it and the order's limit price.

Errors

HTTPCodeWhen
400malformed_json

The body is not JSON, or does not fit the request shape (unknown or missing fields, wrong types).

401unauthorized

No credential, or the credential is invalid, expired or revoked.

403forbidden

The credential may not use this route (missing scope, app-session-only route, IP not allowed).

404account_not_found

No linked broker account with this id for the caller.

422invalid_request

The request is well-formed but not valid; field names the input.

429rate_limited

Too many requests for this credential (or too many failed attempts); retry after the Retry-After header (seconds; error.retry_after_ms has the exact wait).

503service_unavailable

A dependency is temporarily unavailable, or the feature is off on this server; retry later.

All fields (request and response schema)

Loading fields…

PATCH
curl -X PATCH "https://cirrus.pocketful.in/v1/gtt/<trigger_id>" \
  -H "Authorization: token $CIRRUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "account": "PF1",
    "instrument_token": "CT:TEST:RELIANCE",
    "side": "SELL",
    "product": "DELIVERY",
    "quantity": 5,
    "stop_loss": {
      "trigger": 2420,
      "price": 2419
    }
  }'
Response · 200
{
  "status": "success",
  "data": {
    "account": "PF1",
    "trigger_id": "0f6c1a52-4d7e-4b8e-9d51-2c7a9e3b1f20",
    "status": "accepted",
    "message": null,
    "error_code": null
  },
  "error": null
}

Delete a GTT #

DELETE /v1/gtt/{trigger_id} scope orders

Deletes a GTT at the broker.

More about this

Once the request is valid the answer is 200 with the broker's verdict in status.

Parameters

  • trigger_id path · string required

    The broker's GTT id (1-64 letters, digits, -, _ or .).

  • account query · string required

    Account id the GTT is in.

Errors

HTTPCodeWhen
400invalid_query

The query string does not fit the route's parameters.

401unauthorized

No credential, or the credential is invalid, expired or revoked.

403forbidden

The credential may not use this route (missing scope, app-session-only route, IP not allowed).

404account_not_found

No linked broker account with this id for the caller.

422invalid_request

The request is well-formed but not valid; field names the input.

429rate_limited

Too many requests for this credential (or too many failed attempts); retry after the Retry-After header (seconds; error.retry_after_ms has the exact wait).

503service_unavailable

A dependency is temporarily unavailable, or the feature is off on this server; retry later.

All fields (request and response schema)

Loading fields…

DELETE
curl -X DELETE "https://cirrus.pocketful.in/v1/gtt/<trigger_id>?account=<account>" \
  -H "Authorization: token $CIRRUS_API_KEY"
Response · 200
{
  "status": "success",
  "data": {
    "account": "PF1",
    "trigger_id": "0f6c1a52-4d7e-4b8e-9d51-2c7a9e3b1f20",
    "status": "accepted",
    "message": null,
    "error_code": null
  },
  "error": null
}