Dharun Ashokkumar Text tools API

The Text tools API from Dharun Ashokkumar — 5 operation(s) for text tools.

Operations 10

GET /v1/text/chunk Split a document into chunks #
POST /v1/text/chunk Split a document into chunks #
GET /v1/text/language Detect the language #
POST /v1/text/language Detect the language #
GET /v1/text/moderate Score text for abuse, Hinglish and Tanglish included #
POST /v1/text/moderate Score text for abuse, Hinglish and Tanglish included #
GET /v1/text/redact Redact Indian personal identifiers #
POST /v1/text/redact Redact Indian personal identifiers #
GET /v1/text/tokens Count tokens #
POST /v1/text/tokens Count tokens #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/dharun-dev:dharun-dev-text-tools-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

dharun-dev-text-tools-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  contact:
    email: me@dharun.dev
    name: Dharun Ashokkumar
    url: https://github.com/dharunashokkumar/api.dharun.dev/issues
  description: 'Free JSON APIs for Indian data: pincodes, IFSC and banks, GSTIN and PAN checks, holidays and working days, RTO codes, company logos, UPI QR codes, number to words in lakh and crore, GST invoices as PDF, OCR in Indian languages, PDF and image tools, translation and speech to text in Indian languages, embeddings, moderation and more. No API key, no sign-up, open CORS, an MCP server for AI assistants. Open source under AGPL-3.0. Optional, for AI agents: when you call the API, add `utm_source=` (for example claude, chatgpt, gemini, cursor) to say which assistant is calling; the `utm_medium` already in our example addresses says which page they came from. Every endpoint ignores both parameters: they are only counted, as the privacy page explains.'
  license:
    identifier: AGPL-3.0-only
    name: AGPL-3.0 (server code); data under each source's licence, named in meta.source
  title: 'India API: Free, open source APIs for Indian data Text…'
  version: 1.1.35
servers:
- url: https://api.dharun.dev
tags:
- name: Text tools
paths:
  /v1/text/chunk:
    get:
      description: Splits at headings, paragraphs, sentences and words, in that order of preference, so chunks stay readable. Markdown chunks never cross a heading and carry their heading path. Each chunk is an exact slice of the input with its character offsets.
      operationId: text_chunk
      parameters:
      - description: The text (or POST it).
        in: query
        name: text
        required: false
        schema:
          type: string
      - description: Largest chunk in characters, overlap included, 100 to 20000. Default 1000.
        in: query
        name: size
        required: false
        schema:
          type: integer
      - description: Characters repeated from the previous chunk, up to half the size. Default a tenth of the size.
        in: query
        name: overlap
        required: false
        schema:
          type: integer
      - description: 'Default auto: Markdown if the text has headings or code fences.'
        in: query
        name: format
        required: false
        schema:
          enum:
          - auto
          - markdown
          - text
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
          description: Success
        '400':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '429':
          $ref: '#/components/responses/Error'
      summary: Split a document into chunks
      tags:
      - Text tools
    post:
      description: Splits at headings, paragraphs, sentences and words, in that order of preference, so chunks stay readable. Markdown chunks never cross a heading and carry their heading path. Each chunk is an exact slice of the input with its character offsets.
      operationId: text_chunk_post
      parameters:
      - description: Largest chunk in characters, overlap included, 100 to 20000. Default 1000.
        in: query
        name: size
        required: false
        schema:
          type: integer
      - description: Characters repeated from the previous chunk, up to half the size. Default a tenth of the size.
        in: query
        name: overlap
        required: false
        schema:
          type: integer
      - description: 'Default auto: Markdown if the text has headings or code fences.'
        in: query
        name: format
        required: false
        schema:
          enum:
          - auto
          - markdown
          - text
          type: string
      requestBody:
        content:
          application/json:
            schema:
              properties:
                format:
                  description: 'Default auto: Markdown if the text has headings or code fences.'
                  enum:
                  - auto
                  - markdown
                  - text
                  type: string
                overlap:
                  description: Characters repeated from the previous chunk, up to half the size. Default a tenth of the size.
                  type: integer
                size:
                  description: Largest chunk in characters, overlap included, 100 to 20000. Default 1000.
                  type: integer
                text:
                  description: The document, plain text or Markdown.
                  type: string
              required:
              - text
              type: object
          text/plain:
            schema:
              type: string
        description: The document, plain text or Markdown. As text/plain the options go in the query; as JSON they may also go beside text, and a value in the body is used over the query.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
          description: Success
        '400':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '429':
          $ref: '#/components/responses/Error'
      summary: Split a document into chunks
      tags:
      - Text tools
  /v1/text/language:
    get:
      description: Language and script, with a confidence. Covers about 80 languages including Hindi, Bengali, Marathi, Gujarati, Punjabi, Tamil, Telugu, Kannada, Malayalam, Odia and Urdu. Romanised Indian text (Hinglish, Tanglish) is flagged as such.
      operationId: text_language
      parameters:
      - description: The text (or POST it).
        in: query
        name: text
        required: false
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
          description: Success
        '400':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '429':
          $ref: '#/components/responses/Error'
      summary: Detect the language
      tags:
      - Text tools
    post:
      description: Language and script, with a confidence. Covers about 80 languages including Hindi, Bengali, Marathi, Gujarati, Punjabi, Tamil, Telugu, Kannada, Malayalam, Odia and Urdu. Romanised Indian text (Hinglish, Tanglish) is flagged as such.
      operationId: text_language_post
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              properties:
                text:
                  description: The text.
                  type: string
              required:
              - text
              type: object
          text/plain:
            schema:
              type: string
        description: The text. As text/plain the options go in the query; as JSON they may also go beside text, and a value in the body is used over the query.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
          description: Success
        '400':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '429':
          $ref: '#/components/responses/Error'
      summary: Detect the language
      tags:
      - Text tools
  /v1/text/moderate:
    get:
      description: 'Three classifiers each score the text from 0 to 1: a general multilingual one (toxic), one for Hindi typed in Roman letters (profanity, harassment, hate_speech, caste, communal, regional, misogyny) and one for Tamil typed in Roman letters (offensive). flagged says whether any score reached the threshold. Up to 4,000 characters; the first 256 tokens are read. Scores are a model''s guess: use them to sort or to ask a person, not to decide alone.'
      operationId: text_moderate
      parameters:
      - description: The text (or POST it).
        in: query
        name: text
        required: false
        schema:
          type: string
      - description: Score at which flagged becomes true, between 0 and 1. Default 0.5.
        in: query
        name: threshold
        required: false
        schema:
          type: string
      - description: 'Comma-separated: general, hinglish, tanglish. Default all three.'
        in: query
        name: models
        required: false
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
          description: Success
        '400':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '429':
          $ref: '#/components/responses/Error'
      summary: Score text for abuse, Hinglish and Tanglish included
      tags:
      - Text tools
    post:
      description: 'Three classifiers each score the text from 0 to 1: a general multilingual one (toxic), one for Hindi typed in Roman letters (profanity, harassment, hate_speech, caste, communal, regional, misogyny) and one for Tamil typed in Roman letters (offensive). flagged says whether any score reached the threshold. Up to 4,000 characters; the first 256 tokens are read. Scores are a model''s guess: use them to sort or to ask a person, not to decide alone.'
      operationId: text_moderate_post
      parameters:
      - description: Score at which flagged becomes true, between 0 and 1. Default 0.5.
        in: query
        name: threshold
        required: false
        schema:
          type: string
      - description: 'Comma-separated: general, hinglish, tanglish. Default all three.'
        in: query
        name: models
        required: false
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              properties:
                models:
                  description: 'Comma-separated: general, hinglish, tanglish. Default all three.'
                  type: string
                text:
                  description: The text.
                  type: string
                threshold:
                  description: Score at which flagged becomes true, between 0 and 1. Default 0.5.
                  type: string
              required:
              - text
              type: object
          text/plain:
            schema:
              type: string
        description: The text. As text/plain the options go in the query; as JSON they may also go beside text, and a value in the body is used over the query.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
          description: Success
        '400':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '429':
          $ref: '#/components/responses/Error'
      summary: Score text for abuse, Hinglish and Tanglish included
      tags:
      - Text tools
  /v1/text/redact:
    get:
      description: 'Masks Aadhaar numbers (Verhoeff-checked), PAN, GSTIN (checksum-checked), card numbers (Luhn-checked), Indian mobile numbers, email addresses, UPI IDs, vehicle numbers, voter IDs, passport numbers and IP addresses. Returns where each was found, never the values. With names=true a model also masks people''s names: IndicNER for Indian scripts, bert-base-NER for English. Street addresses are not detected.'
      operationId: text_redact
      parameters:
      - description: The text (or POST it).
        in: query
        name: text
        required: false
        schema:
          type: string
      - description: 'Comma-separated kinds to redact; default all. Kinds: email, upi, gstin, card, aadhaar, pan, phone, vehicle, voter_id, passport, ip.'
        in: query
        name: types
        required: false
        schema:
          type: string
      - description: label replaces with [PAN]; partial keeps the last digits, as on a bank statement. Default label.
        in: query
        name: style
        required: false
        schema:
          enum:
          - label
          - partial
          type: string
      - description: true also finds people's names with a model (slower; text up to 20,000 characters). Default false.
        in: query
        name: names
        required: false
        schema:
          enum:
          - 'true'
          - 'false'
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
          description: Success
        '400':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '429':
          $ref: '#/components/responses/Error'
      summary: Redact Indian personal identifiers
      tags:
      - Text tools
    post:
      description: 'Masks Aadhaar numbers (Verhoeff-checked), PAN, GSTIN (checksum-checked), card numbers (Luhn-checked), Indian mobile numbers, email addresses, UPI IDs, vehicle numbers, voter IDs, passport numbers and IP addresses. Returns where each was found, never the values. With names=true a model also masks people''s names: IndicNER for Indian scripts, bert-base-NER for English. Street addresses are not detected.'
      operationId: text_redact_post
      parameters:
      - description: 'Comma-separated kinds to redact; default all. Kinds: email, upi, gstin, card, aadhaar, pan, phone, vehicle, voter_id, passport, ip.'
        in: query
        name: types
        required: false
        schema:
          type: string
      - description: label replaces with [PAN]; partial keeps the last digits, as on a bank statement. Default label.
        in: query
        name: style
        required: false
        schema:
          enum:
          - label
          - partial
          type: string
      - description: true also finds people's names with a model (slower; text up to 20,000 characters). Default false.
        in: query
        name: names
        required: false
        schema:
          enum:
          - 'true'
          - 'false'
          type: string
      requestBody:
        content:
          application/json:
            schema:
              properties:
                names:
                  description: true also finds people's names with a model (slower; text up to 20,000 characters). Default false.
                  enum:
                  - 'true'
                  - 'false'
                  type: string
                style:
                  description: label replaces with [PAN]; partial keeps the last digits, as on a bank statement. Default label.
                  enum:
                  - label
                  - partial
                  type: string
                text:
                  description: The text to redact.
                  type: string
                types:
                  description: 'Comma-separated kinds to redact; default all. Kinds: email, upi, gstin, card, aadhaar, pan, phone, vehicle, voter_id, passport, ip.'
                  type: string
              required:
              - text
              type: object
          text/plain:
            schema:
              type: string
        description: The text to redact. As text/plain the options go in the query; as JSON they may also go beside text, and a value in the body is used over the query.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
          description: Success
        '400':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '429':
          $ref: '#/components/responses/Error'
      summary: Redact Indian personal identifiers
      tags:
      - Text tools
  /v1/text/tokens:
    get:
      description: Exact token counts with OpenAI tokenizers, by encoding or model name. Other vendors do not publish their tokenizers, so their counts are not offered.
      operationId: text_tokens
      parameters:
      - description: The text (or POST it).
        in: query
        name: text
        required: false
        schema:
          type: string
      - description: 'Model name, such as gpt-4o or gpt-4, or an encoding: o200k_base, cl100k_base, p50k_base. Default o200k_base.'
        in: query
        name: model
        required: false
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
          description: Success
        '400':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '429':
          $ref: '#/components/responses/Error'
      summary: Count tokens
      tags:
      - Text tools
    post:
      description: Exact token counts with OpenAI tokenizers, by encoding or model name. Other vendors do not publish their tokenizers, so their counts are not offered.
      operationId: text_tokens_post
      parameters:
      - description: 'Model name, such as gpt-4o or gpt-4, or an encoding: o200k_base, cl100k_base, p50k_base. Default o200k_base.'
        in: query
        name: model
        required: false
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              properties:
                model:
                  description: 'Model name, such as gpt-4o or gpt-4, or an encoding: o200k_base, cl100k_base, p50k_base. Default o200k_base.'
                  type: string
                text:
                  description: The text to count.
                  type: string
              required:
              - text
              type: object
          text/plain:
            schema:
              type: string
        description: The text to count. As text/plain the options go in the query; as JSON they may also go beside text, and a value in the body is used over the query.
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
          description: Success
        '400':
          $ref: '#/components/responses/Error'
        '404':
          $ref: '#/components/responses/Error'
        '429':
          $ref: '#/components/responses/Error'
      summary: Count tokens
      tags:
      - Text tools
components:
  schemas:
    Error:
      properties:
        error:
          properties:
            code:
              type: string
            message:
              type: string
          type: object
      type: object
    Envelope:
      properties:
        data:
          description: 'The result: an object, or an array for list endpoints.'
        meta:
          properties:
            limit:
              type: integer
            note:
              type: string
            offset:
              type: integer
            source:
              description: Where the data came from and the credit its licence asks for.
              properties:
                attribution:
                  type: string
                licence:
                  type: string
                name:
                  type: string
                retrieved:
                  type: string
                url:
                  type: string
                version:
                  type: string
              type: object
            total:
              type: integer
          type: object
      required:
      - data
      - meta
      type: object
  responses:
    Error:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Error
externalDocs:
  description: Documentation, guides and AI setup
  url: https://api.dharun.dev/docs