<!-- Generated from the reviewed public OpenAPI contract. Do not edit this file. -->

# Reserve initial fees and submit a campaign; auto-renewal is disabled


**POST** ` /v1/orgs/{orgId}/messaging/campaign `


Organization DEVELOPER session or project key with lines:write for writes, membership/lines:read for reads. Agent credentials alone are insufficient. Carrier outcomes may be asynchronous; follow returned references.

Operation ID: ` post__v1_orgs_orgId_messaging_campaign `.

**Feature availability**
This feature is not currently enabled. See [availability](../index.md#what-is-available) before using the API contract below.

## Authentication

Use **one** of these authentication alternatives. Schemes on the same line are required together:

- ` sessionCookie ` (cookie: ordan_session)
- ` bearerKey ` (bearer token)

Organization roles, key scopes, grant capabilities, policy and spend limits still apply. See [Authentication](../authentication.md).

## Request

### Path parameters


| Parameter | Type | Required | Description / constraints |
| --- | --- | --- | --- |
| ` orgId ` | string | Yes | — |


### Header parameters


| Parameter | Type | Required | Description / constraints |
| --- | --- | --- | --- |
| ` Idempotency-Key ` | string | No | One key per logical operation; reuse only with identical body. Retrieve committed resources after ambiguous outcomes. |


### Body (required)



**Content type:** ` application/json `

**Type:** object

Required means required **within its containing object**, when that object is present. Union/conditional constraints remain defined by the JSON Schema below.


| Field | Type | Presence | Description / constraints |
| --- | --- | --- | --- |
| ` description ` | string | Required | minLength: ` 20 `. maxLength: ` 4000 ` |
| ` embeddedLink ` | boolean | Optional | — |
| ` embeddedPhone ` | boolean | Optional | — |
| ` helpMessage ` | string | Required | minLength: ` 10 `. maxLength: ` 1600 ` |
| ` messageFlow ` | string | Required | minLength: ` 20 `. maxLength: ` 4000 ` |
| ` optoutMessage ` | string | Required | minLength: ` 10 `. maxLength: ` 1600 ` |
| ` privacyPolicyLink ` | string (uri) | Required | — |
| ` sample1 ` | string | Required | minLength: ` 10 `. maxLength: ` 1600 ` |
| ` sample2 ` | string | Required | minLength: ` 10 `. maxLength: ` 1600 ` |
| ` subUsecases ` | Array of string | Optional | — |
| ` termsAndConditions ` | Exactly ` true ` | Required | — |
| ` termsAndConditionsLink ` | string (uri) | Required | — |
| ` usecase ` | string | Required | pattern: ` ^[A-Z0-9_]+$ ` |


**JSON Schema**
```json
{
  "additionalProperties": true,
  "properties": {
    "description": {
      "maxLength": 4000,
      "minLength": 20,
      "type": "string"
    },
    "embeddedLink": {
      "type": "boolean"
    },
    "embeddedPhone": {
      "type": "boolean"
    },
    "helpMessage": {
      "maxLength": 1600,
      "minLength": 10,
      "type": "string"
    },
    "messageFlow": {
      "maxLength": 4000,
      "minLength": 20,
      "type": "string"
    },
    "optoutMessage": {
      "maxLength": 1600,
      "minLength": 10,
      "type": "string"
    },
    "privacyPolicyLink": {
      "format": "uri",
      "type": "string"
    },
    "sample1": {
      "maxLength": 1600,
      "minLength": 10,
      "type": "string"
    },
    "sample2": {
      "maxLength": 1600,
      "minLength": 10,
      "type": "string"
    },
    "subUsecases": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "termsAndConditions": {
      "const": true
    },
    "termsAndConditionsLink": {
      "format": "uri",
      "type": "string"
    },
    "usecase": {
      "pattern": "^[A-Z0-9_]+$",
      "type": "string"
    }
  },
  "required": [
    "usecase",
    "description",
    "sample1",
    "sample2",
    "messageFlow",
    "helpMessage",
    "optoutMessage",
    "privacyPolicyLink",
    "termsAndConditionsLink",
    "termsAndConditions"
  ],
  "type": "object"
}
```

## Request examples

These are **request templates**, not executed requests. Replace `REPLACE_…` and `<…>` placeholders, set the credential environment variables, and supply any conditional fields your action needs. JSON values are illustrative, not live records. Use a stable idempotency key per logical operation.

```bash
curl --request POST --url 'https://api.ordan.io/v1/orgs/REPLACE_orgId/messaging/campaign' \
  --header "Authorization: Bearer $ORDAN_API_KEY" \
  --header "Idempotency-Key: $ORDAN_IDEMPOTENCY_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "description": "<description>",
  "helpMessage": "<helpMessage>",
  "messageFlow": "<messageFlow>",
  "optoutMessage": "<optoutMessage>",
  "privacyPolicyLink": "<privacyPolicyLink>",
  "sample1": "<sample1>",
  "sample2": "<sample2>",
  "termsAndConditions": true,
  "termsAndConditionsLink": "<termsAndConditionsLink>",
  "usecase": "<usecase>"
}'
```

```js
const response = await fetch("https://api.ordan.io/v1/orgs/REPLACE_orgId/messaging/campaign", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.ORDAN_API_KEY,
    "Idempotency-Key": "" + process.env.ORDAN_IDEMPOTENCY_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "description": "<description>",
  "helpMessage": "<helpMessage>",
  "messageFlow": "<messageFlow>",
  "optoutMessage": "<optoutMessage>",
  "privacyPolicyLink": "<privacyPolicyLink>",
  "sample1": "<sample1>",
  "sample2": "<sample2>",
  "termsAndConditions": true,
  "termsAndConditionsLink": "<termsAndConditionsLink>",
  "usecase": "<usecase>"
}),
});
const text = await response.text();
if (!response.ok) throw new Error(`${response.status}: ${text}`);
const result = text ? JSON.parse(text) : null;
```

```python
import json
import os
from urllib.request import Request, urlopen

request = Request("https://api.ordan.io/v1/orgs/REPLACE_orgId/messaging/campaign",
    method="POST",
    headers={
        "Authorization": "Bearer " + os.environ["ORDAN_API_KEY"],
        "Idempotency-Key": "" + os.environ["ORDAN_IDEMPOTENCY_KEY"],
        "Content-Type": "application/json",
    },
    data="{\n  \"description\": \"<description>\",\n  \"helpMessage\": \"<helpMessage>\",\n  \"messageFlow\": \"<messageFlow>\",\n  \"optoutMessage\": \"<optoutMessage>\",\n  \"privacyPolicyLink\": \"<privacyPolicyLink>\",\n  \"sample1\": \"<sample1>\",\n  \"sample2\": \"<sample2>\",\n  \"termsAndConditions\": true,\n  \"termsAndConditionsLink\": \"<termsAndConditionsLink>\",\n  \"usecase\": \"<usecase>\"\n}".encode("utf-8"),
)
with urlopen(request, timeout=30) as response:
    text = response.read().decode("utf-8")
    result = json.loads(text) if text else None
```

## Responses

| Status | Meaning |
| --- | --- |
| ` 400 ` | Invalid request; device token polling uses RFC 8628 string errors |
| ` 402 ` | spend_limit_exceeded: inspect details.scope (org/grant/line) and outstanding_micros |
| ` 403 ` | Missing authority, policy_violation, approval_required (details.approval_request), limit_reached, destination_not_supported or feature_disabled (details.feature) |
| ` 409 ` | Conflict, idempotency in progress, or a2p_registration_pending; retrieve state instead of duplicating work |
| ` 422 ` | validation_error: the request is not valid; details name each field |
| ` 429 ` | Rate limited; back off and retain the same idempotency key |
| ` 502 ` | provider_error: unknown routes need verified quotes; ambiguous operations retain resource references and cost holds |
| ` 2XX ` | Success (created objects use 201) |
| ` default ` | Error |

Status ranges such as `2XX` are retained exactly as declared. See [Errors and recovery](../errors.md) for retries and pending outcomes.

### 400 response

**Content type:** ` application/json `

**Type:** [Error](schemas/error.md)

Required means required **within its containing object**, when that object is present. Union/conditional constraints remain defined by the JSON Schema below.


| Field | Type | Presence | Description / constraints |
| --- | --- | --- | --- |
| ` error ` | object | Required | Additional properties allowed |
| ` error.code ` | string | Required | — |
| ` error.details ` | object | Optional | Additional properties allowed |
| ` error.message ` | string | Required | — |


**JSON Schema**
```json
{
  "$ref": "#/components/schemas/Error"
}
```

### 2XX response

**Content type:** ` application/json `

**Type:** [MessagingRegistration](schemas/messagingregistration.md)

Required means required **within its containing object**, when that object is present. Union/conditional constraints remain defined by the JSON Schema below.


| Field | Type | Presence | Description / constraints |
| --- | --- | --- | --- |
| ` auto_renewal ` | Exactly ` false ` | Optional | — |
| ` brand_reference ` | anyOf: string; null | Optional | — |
| ` campaign_generation ` | integer | Optional | minimum: ` 0 ` |
| ` campaign_reference ` | anyOf: string; null | Optional | — |
| ` costs ` | object | Optional | Additional properties allowed |
| ` costs.brand_micros ` | anyOf: string; null | Optional | — |
| ` costs.campaign_initial_term_micros ` | anyOf: string; null | Optional | — |
| ` costs.campaign_monthly_micros ` | anyOf: string; null | Optional | — |
| ` org ` | string | Optional | Public org_… reference (not a UUID). pattern: ` ^org_[0-7][0-9A-HJKMNP-TV-Z]{25}$ ` |
| ` profile_ready ` | boolean | Optional | — |
| ` status ` | ` not_registered `, ` brand_unknown `, ` brand_pending `, ` brand_ready `, ` campaign_unknown `, ` campaign_pending `, ` active `, ` expired `, ` failed ` | Optional | — |


**JSON Schema**
```json
{
  "$ref": "#/components/schemas/MessagingRegistration"
}
```

**Illustrative response template**
Placeholder values show the shape, not a live response. Nullable costs remain null rather than implying zero usage.

```json
{
  "auto_renewal": false,
  "brand_reference": null,
  "campaign_generation": 0,
  "campaign_reference": null,
  "costs": {
    "brand_micros": null,
    "campaign_initial_term_micros": null,
    "campaign_monthly_micros": null
  },
  "org": "<org>",
  "profile_ready": false,
  "status": "not_registered"
}
```

### default response

**Content type:** ` application/json `

**Type:** [Error](schemas/error.md)

Required means required **within its containing object**, when that object is present. Union/conditional constraints remain defined by the JSON Schema below.


| Field | Type | Presence | Description / constraints |
| --- | --- | --- | --- |
| ` error ` | object | Required | Additional properties allowed |
| ` error.code ` | string | Required | — |
| ` error.details ` | object | Optional | Additional properties allowed |
| ` error.message ` | string | Required | — |


**JSON Schema**
```json
{
  "$ref": "#/components/schemas/Error"
}
```
