---
title: "Create a honeytoken within a context"
method: POST
path: "/v1/honeytokens/with-context"
tags: ["Honeytokens"]
---

# Create a honeytoken within a context

`POST /v1/honeytokens/with-context`

This endpoint allows you to create a honeytoken of a given type within
a context. The context is a realistic file in which your honeytoken is inserted.

If `language`, `project_extensions` and `filename` are not provided, a random context will be generated.

## Request body

- object
  - `name` string, required — Honeytoken name.
  - `description` string — Honeytoken description.
  - `type` 'AWS', required — Honeytoken type.
  - `custom_tags` object[] — Custom tags to set on the honeytoken. If the custom tag doesn't exist, it will be created.
    - `id` string, uuid
    - `key` string
    - `value` string, nullable
  - `language` string — Language to use for the context. If not set but `project_extensions` is set, the languages will be inferred from the extensions.
  - `filename` string — Filename to use for the context.
  - `project_extensions` string[] — An array of file extensions that can be used for the context.

## Response `200`

Honeytoken within a context created

- object
  - `content` string
  - `filepath` string
  - `language` string
  - `suggested_commit_message` string — Suggestion of a commit message to use
  - `honeytoken_id` string, uuid
  - `gitguardian_url` string — URL of the honeytoken on the dashboard

## Other responses

- `400` — Invalid data
- `401` — Invalid API key
- `403` — Forbidden Call
- `409` — Data conflict
- `503` — API under maintenance

---

[API](https://skmtc.net/gitguardian/apis/gitguardian-api.md) · [All operations](https://skmtc.net/gitguardian/apis/gitguardian-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gitguardian/gitguardian-api/revisions/511b067cdcb1/schema)
