# Tags

## Get All Tags

> Retrieve all tags

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"servers":[{"url":"https://api.dmchamp.com/v1","description":"Production API Server"}],"security":[{"ApiKeyAuth":[]},{"UserIdAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"query","name":"apiKey","description":"Your DM Champ API key. Obtain from Settings → API Keys."},"UserIdAuth":{"type":"apiKey","in":"query","name":"userId","description":"Your DM Champ User ID. Alternative to apiKey authentication. Cannot be used for agency-only endpoints."}},"parameters":{"ApiKeyParam":{"name":"apiKey","in":"query","description":"API key for authentication. At least one of apiKey or userId is required for protected endpoints.","required":false,"schema":{"type":"string"}}},"schemas":{"Tag":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Tag name"},"description":{"type":"string","description":"Tag description"}}}}},"paths":{"/tags":{"get":{"summary":"Get All Tags","description":"Retrieve all tags","tags":["Tags"],"parameters":[{"$ref":"#/components/parameters/ApiKeyParam"}],"responses":{"200":{"description":"List of tags","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Tag"}}}}}}}}}}
```

## Tag a Contact

> Assign a tag to a contact. If the tag does not exist yet, it is created automatically. If the tag already exists, the contact is added to it. Identify the contact by phone number or email.<br>

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"servers":[{"url":"https://api.dmchamp.com/v1","description":"Production API Server"}],"security":[{"ApiKeyAuth":[]},{"UserIdAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"query","name":"apiKey","description":"Your DM Champ API key. Obtain from Settings → API Keys."},"UserIdAuth":{"type":"apiKey","in":"query","name":"userId","description":"Your DM Champ User ID. Alternative to apiKey authentication. Cannot be used for agency-only endpoints."}},"parameters":{"ApiKeyParam":{"name":"apiKey","in":"query","description":"API key for authentication. At least one of apiKey or userId is required for protected endpoints.","required":false,"schema":{"type":"string"}}},"schemas":{"Tag":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Tag name"},"description":{"type":"string","description":"Tag description"}}}}},"paths":{"/tags":{"post":{"summary":"Tag a Contact","description":"Assign a tag to a contact. If the tag does not exist yet, it is created automatically. If the tag already exists, the contact is added to it. Identify the contact by phone number or email.\n","tags":["Tags"],"parameters":[{"$ref":"#/components/parameters/ApiKeyParam"},{"name":"tag","in":"query","required":true,"schema":{"type":"string"},"description":"The tag name to assign (created automatically if it does not exist)"},{"name":"phoneNumber","in":"query","required":false,"schema":{"type":"string"},"description":"Phone number of the contact (include country code, e.g. +15551234567). Required if email is not provided."},{"name":"email","in":"query","required":false,"schema":{"type":"string"},"description":"Email address of the contact. Required if phoneNumber is not provided."}],"responses":{"201":{"description":"Tag assigned to contact successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"$ref":"#/components/schemas/Tag"}}}}}},"400":{"description":"Missing required parameters (tag and either phoneNumber or email)"},"401":{"description":"Invalid API key"},"402":{"description":"Insufficient credits"},"404":{"description":"Contact not found"}}}}}}
```

## Get Tag by Name

> Retrieve a specific tag by name

```json
{"openapi":"3.1.0","info":{"title":"DM Champ API","version":"1.0.0"},"servers":[{"url":"https://api.dmchamp.com/v1","description":"Production API Server"}],"security":[{"ApiKeyAuth":[]},{"UserIdAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"query","name":"apiKey","description":"Your DM Champ API key. Obtain from Settings → API Keys."},"UserIdAuth":{"type":"apiKey","in":"query","name":"userId","description":"Your DM Champ User ID. Alternative to apiKey authentication. Cannot be used for agency-only endpoints."}},"parameters":{"ApiKeyParam":{"name":"apiKey","in":"query","description":"API key for authentication. At least one of apiKey or userId is required for protected endpoints.","required":false,"schema":{"type":"string"}}},"schemas":{"Tag":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Tag name"},"description":{"type":"string","description":"Tag description"}}}}},"paths":{"/tags/{name}":{"get":{"summary":"Get Tag by Name","description":"Retrieve a specific tag by name","tags":["Tags"],"parameters":[{"$ref":"#/components/parameters/ApiKeyParam"},{"name":"name","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tag found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tag"}}}},"404":{"description":"Tag not found"}}}}}}
```
