# Recommend which text to send

Source: https://jointextkit.com/docs/api/copy/recommend-message
Index: https://jointextkit.com/llms.txt

`GET /v1/copy/recommend`

Candidate SMS copy for a goal, ranked by expected revenue per message, each with the evidence behind its score: the factors that moved it and how many case studies each rests on, the closest published SMS-only case studies with their source links, and how much of the score comes from your own sends. The prior is a dataset of documented SMS campaigns by industry, company type and message type (results that mix SMS with email or push are listed but never counted); your batches and automations (clicks, STOPs, and revenue from tracked events with a `revenue` property within 7 days) update it. Candidates are built only from your inputs, so none invents an offer, code or date. Sends and saves nothing.

Send your API key as a bearer token: `Authorization: Bearer tk_sk_...`. Test keys run this endpoint against the [sandbox](/docs/sandbox); see [Authentication](/docs/authentication) for key modes and scopes.

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `industry` | `apparel`, `home_goods`, `food_beverage`, `restaurant`, `beauty`, `health_wellness`, `cannabis`, `hospitality`, `consumer_app`, `fintech`, `fitness`, `pets`, `arts_crafts`, `jewelry_accessories`, `sporting_goods`, `electronics`, `services`, `other` | Yes | The sender's industry |
| `company_type` | `ecommerce`, `subscription_ecommerce`, `subscription_app`, `consumer_app`, `restaurant`, `hospitality`, `retail`, `marketplace`, `fintech`, `services` | Yes | Kind of business |
| `goal` | `any`, `abandoned_cart`, `abandoned_browse`, `welcome`, `winback`, `failed_payment`, `trial`, `promo`, `re_engagement`, `post_purchase`, `back_in_stock`, `quiz`, `launch`, `transactional`, `mixed` | No | The message type to write, or `any` to compare the types that fit `audience` Default "any". |
| `audience` | string | No | Who gets it, in words, e.g. "opened the paywall and left" |
| `brand` | string | Yes | Business name as customers know it At most 40 characters. |
| `product` | string | Yes | What is being sold, as the customer would say it, e.g. "your second number" At most 60 characters. |
| `offer` | string | No | Optional, e.g. "50% off your first month". Without one no candidate has an offer |
| `code` | string | No | Optional promo code |
| `deadline` | string | No | Optional, e.g. "tonight" |
| `link` | string | No | URL or merge field; default {{link}} |
| `first_name` | boolean | No | Your contacts have first names, so candidates may use {{first_name}} |
| `first_message` | boolean | No | The first text these people get from the number: the brand and opt-out line are added and counted |
| `candidates` | string | No | Your own drafts to score: a JSON array of up to 10 strings |
| `limit` | integer | No | How many messages to return (default 5, max 20) Default 5. Maximum 20. Minimum 1. |
| `use_history` | boolean | No | false ranks on the case studies only Default true. |

## Responses

| Status | Meaning | Body |
| --- | --- | --- |
| 200 | Ranked copy with evidence | JSON object |
| 400 | Invalid input | `Error` |
| 401 | Missing, malformed, or revoked API key | `Error` |
| 402 | Billable live calls only: the prepaid credit balance cannot cover the call (insufficient_credits); nothing was done or charged | `Error` |
| 429 | Rate limit or quota exceeded | `Error` |

### 200: response fields

| Field | Type | Description |
| --- | --- | --- |
| `object` | `copy_recommendation` |  |
| `recommendations` | array of object |  |
| `recommendations[].rank` | integer |  |
| `recommendations[].text` | string |  |
| `recommendations[].message_type` | string |  |
| `recommendations[].origin` | `composed`, `writer`, `yours` |  |
| `recommendations[].score` | number |  |
| `recommendations[].expected_revenue_per_message_usd` | object | Nullable. |
| `recommendations[].expected_revenue_per_message_usd.p10` | number |  |
| `recommendations[].expected_revenue_per_message_usd.p50` | number |  |
| `recommendations[].expected_revenue_per_message_usd.p90` | number |  |
| `recommendations[].expected_ctr` | number | Nullable. |
| `recommendations[].segments` | integer |  |
| `recommendations[].features` | array of string |  |
| `recommendations[].drivers` | array of object |  |
| `recommendations[].drivers[].factor` | string |  |
| `recommendations[].drivers[].effect` | number |  |
| `recommendations[].drivers[].rows` | integer |  |
| `recommendations[].history_weight` | number |  |
| `recommendations[].notes` | array of string |  |
| `message_types` | array of object |  |
| `evidence` | array of object |  |
| `blended_not_counted` | array of object |  |
| `history` | object |  |
| `model` | object |  |
| `caveats` | array of string |  |

## Errors

| Status | When |
| --- | --- |
| 400 | Invalid input |
| 401 | Missing, malformed, or revoked API key |
| 402 | Billable live calls only: the prepaid credit balance cannot cover the call (insufficient_credits); nothing was done or charged |
| 429 | Rate limit or quota exceeded |

Every error has the same JSON shape, and `request_id` matches the `X-Request-Id` response header. [Errors](/docs/errors) lists every code and what to do about it.

```json
{
  "error": {
    "code": "invalid_request",
    "message": "What went wrong, in plain words.",
    "param": "the_field",
    "request_id": "req_a1B2c3D4e5F6g7H8"
  }
}
```

## Examples

### Node.js

The Node.js SDK does not wrap this endpoint yet; call it over HTTP.

```javascript
const res = await fetch('https://api.jointextkit.com/v1/copy/recommend?limit=10', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.TEXTKIT_API_KEY}`,
  },
});

if (!res.ok) throw new Error((await res.json()).error.message);
const data = await res.json();
```

### PHP

```php
<?php

$ch = curl_init('https://api.jointextkit.com/v1/copy/recommend?limit=10');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('TEXTKIT_API_KEY'),
    ],
]);

$data = json_decode(curl_exec($ch), true);
```

### Python

The Python SDK does not wrap this endpoint yet; call it over HTTP.

```python
import json, os, urllib.request

req = urllib.request.Request(
    "https://api.jointextkit.com/v1/copy/recommend?limit=10",
    method="GET",
    headers={
        "Authorization": f"Bearer {os.environ['TEXTKIT_API_KEY']}",
    },
)
with urllib.request.urlopen(req) as res:
    data = json.load(res)
```

### Ruby

```ruby
require "net/http"
require "json"

uri = URI("https://api.jointextkit.com/v1/copy/recommend?limit=10")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV["TEXTKIT_API_KEY"]}"

res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, _ := http.NewRequest("GET", "https://api.jointextkit.com/v1/copy/recommend?limit=10", nil)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("TEXTKIT_API_KEY"))

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	data, _ := io.ReadAll(res.Body)
	fmt.Println(res.Status, string(data))
}
```

### Rust

```rust
// cargo add reqwest --features blocking,json
// cargo add serde_json

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let key = std::env::var("TEXTKIT_API_KEY")?;
    let res = reqwest::blocking::Client::new()
        .get("https://api.jointextkit.com/v1/copy/recommend?limit=10")
        .bearer_auth(key)
        .send()?
        .error_for_status()?;
    let data: serde_json::Value = res.json()?;
    println!("{data}");
    Ok(())
}
```

### Java

```java
import java.net.URI;
import java.net.http.*;

public class Main {
    public static void main(String[] args) throws Exception {
        var request = HttpRequest.newBuilder(URI.create("https://api.jointextkit.com/v1/copy/recommend?limit=10"))
            .header("Authorization", "Bearer " + System.getenv("TEXTKIT_API_KEY"))
            .GET()
            .build();

        var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode() + " " + response.body());
    }
}
```

### .NET

```csharp
using System.Net.Http.Headers;

var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
    "Bearer", Environment.GetEnvironmentVariable("TEXTKIT_API_KEY"));

var res = await http.GetAsync("https://api.jointextkit.com/v1/copy/recommend?limit=10");
res.EnsureSuccessStatusCode();

var data = await res.Content.ReadAsStringAsync();
```

### cURL

```bash
curl -X GET "https://api.jointextkit.com/v1/copy/recommend?limit=10" \
  -H "Authorization: Bearer $TEXTKIT_API_KEY"
```

## Related

- [All copy endpoints](/docs/api#copy)
- [API reference](/docs/api)
