Find

Take the part of a text before or after or between markers

POST/v1/find/string/part

View as Markdown

Returns the text before or after the first or last occurrence of a delimiter, or the text between a start and an end marker (the first pair, or every pair). A missing delimiter never fails the call unless you choose the error option: it returns an empty text or the whole text and found is false.

Request body

Name Type Required Description
text string yes The text
mode one of: before_first, before_last, after_first, after_last, between yes before_first, before_last, after_first, after_last or between
delimiter string no For the before and after modes: the text to cut at
start_marker string no For between: the text that starts the part
end_marker string no For between: the text that ends the part
all_matches boolean no For between: return every part, not only the first (default false)
ignore_case boolean no Find the delimiter or markers whatever their case (default false)
if_missing one of: empty, whole_text, error no When nothing is found: empty, whole_text or error (default "empty")

Example request

A request body that works, as JSON.

{
  "text": "https://example.com/files/report-2026.pdf",
  "mode": "after_last",
  "delimiter": "/"
}

Code samples

Replace YOUR_TOKEN with your access token.

curl

curl -X POST 'https://api.skillfulsardine.com/v1/find/string/part' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "text": "https://example.com/files/report-2026.pdf",
  "mode": "after_last",
  "delimiter": "/"
}'

PowerShell

$body = @'
{
  "text": "https://example.com/files/report-2026.pdf",
  "mode": "after_last",
  "delimiter": "/"
}
'@
$response = Invoke-RestMethod -Method Post -Uri 'https://api.skillfulsardine.com/v1/find/string/part' `
  -Headers @{ Authorization = 'Bearer YOUR_TOKEN' } `
  -ContentType 'application/json; charset=utf-8' `
  -Body ([System.Text.Encoding]::UTF8.GetBytes($body))
$response | ConvertTo-Json -Depth 10

Python

import requests

payload = {
    "text": "https://example.com/files/report-2026.pdf",
    "mode": "after_last",
    "delimiter": "/",
}

response = requests.post(
    "https://api.skillfulsardine.com/v1/find/string/part",
    headers={"Authorization": "Bearer YOUR_TOKEN"},
    json=payload,
    timeout=30,
)
print(response.json())

JavaScript

const response = await fetch("https://api.skillfulsardine.com/v1/find/string/part", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "text": "https://example.com/files/report-2026.pdf",
  "mode": "after_last",
  "delimiter": "/"
}),
});
const result = await response.json();
console.log(result);

Node

// Node 18 or later. Save as call.mjs and run: API_TOKEN=... node call.mjs
const token = process.env.API_TOKEN;

const response = await fetch("https://api.skillfulsardine.com/v1/find/string/part", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${token}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "text": "https://example.com/files/report-2026.pdf",
  "mode": "after_last",
  "delimiter": "/"
}),
});
const result = await response.json();
console.log(result);

Rust

// Cargo.toml: reqwest = { version = "0.12", features = ["blocking", "json"] }, serde_json = "1"
fn main() -> Result<(), Box<dyn std::error::Error>> {
    let body: serde_json::Value = serde_json::from_str(r#"{
  "text": "https://example.com/files/report-2026.pdf",
  "mode": "after_last",
  "delimiter": "/"
}"#)?;
    let response = reqwest::blocking::Client::new()
        .post("https://api.skillfulsardine.com/v1/find/string/part")
        .bearer_auth("YOUR_TOKEN")
        .json(&body)
        .send()?;
    println!("{}", response.text()?);
    Ok(())
}

Swift

import Foundation

var request = URLRequest(url: URL(string: "https://api.skillfulsardine.com/v1/find/string/part")!)
request.httpMethod = "POST"
request.setValue("Bearer YOUR_TOKEN", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = Data(#"""
{
  "text": "https://example.com/files/report-2026.pdf",
  "mode": "after_last",
  "delimiter": "/"
}
"""#.utf8)

let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))

Response

The fields inside data of a successful response.

Name Type Required Description
text string yes The first part found, or the answer chosen for when nothing was found
texts array of string yes Every part found, or the single answer chosen for when nothing was found
found boolean yes True when the delimiter or markers were in the text

Example response

A real answer from the operation, as JSON. The fields in the table above are inside data.

{
  "data": {
    "text": "report-2026.pdf",
    "texts": [
      "report-2026.pdf"
    ],
    "found": true
  },
  "errors": null,
  "meta": {
    "request_id": "b5066eb1-19af-4f72-a43a-ff4344e01b1b",
    "timestamp": "2026-10-27T07:19:42.126198Z",
    "version": "2026-03-26"
  },
  "pagination": null
}

Responses

Status When it happens
200 Successful Response
400 The body respects the operation schema, but the use case rejected it. Each problem is one ApiError entry
413 The request is larger than the request size limit of the API allows
422 The body does not respect the operation schema. Each problem is one ApiError entry with the code validation_error
500 Something failed inside the server and was not an input problem. The same envelope, errors may be empty